uncomment settings.cpp

This commit is contained in:
altalk23 2022-10-13 14:18:00 +03:00
parent 6350feae74
commit 80796b9ca4

View file

@ -13,26 +13,26 @@ std::string Setting::getKey() const {
return m_key;
}
// Result<std::shared_ptr<Setting>> Setting::parse(
// std::string const& type,
// std::string const& key,
// JsonMaybeObject<ModJson>& obj
// ) {
// switch (hash(type.c_str())) {
// case hash("bool"): return BoolSetting::parse(key, obj);
// case hash("int"): return IntSetting::parse(key, obj);
// case hash("float"): return FloatSetting::parse(key, obj);
// case hash("string"): return StringSetting::parse(key, obj);
// case hash("rgb"):
// case hash("color"): return ColorSetting::parse(key, obj);
// case hash("rgba"): return ColorAlphaSetting::parse(key, obj);
// case hash("path"):
// case hash("file"): return FileSetting::parse(key, obj);
// default: return Err(
// "Setting \"" + key + "\" has unknown type \"" + type + "\""
// );
// }
// }
Result<std::shared_ptr<Setting>> Setting::parse(
std::string const& type,
std::string const& key,
JsonMaybeObject<ModJson>& obj
) {
switch (hash(type.c_str())) {
case hash("bool"): return BoolSetting::parse(key, obj);
case hash("int"): return IntSetting::parse(key, obj);
case hash("float"): return FloatSetting::parse(key, obj);
case hash("string"): return StringSetting::parse(key, obj);
case hash("rgb"):
case hash("color"): return ColorSetting::parse(key, obj);
case hash("rgba"): return ColorAlphaSetting::parse(key, obj);
case hash("path"):
case hash("file"): return FileSetting::parse(key, obj);
default: return Err(
"Setting \"" + key + "\" has unknown type \"" + type + "\""
);
}
}
Result<std::shared_ptr<Setting>> Setting::parse(
std::string const& key,
@ -59,54 +59,54 @@ void Setting::valueChanged() {
SettingChangedEvent(m_modID, shared_from_this()).post();
}
// SettingNode* BoolSetting::createNode(float width) {
// return BoolSettingNode::create(
// std::static_pointer_cast<BoolSetting>(shared_from_this()),
// width
// );
// }
SettingNode* BoolSetting::createNode(float width) {
return BoolSettingNode::create(
std::static_pointer_cast<BoolSetting>(shared_from_this()),
width
);
}
// SettingNode* IntSetting::createNode(float width) {
// return IntSettingNode::create(
// std::static_pointer_cast<IntSetting>(shared_from_this()),
// width
// );
// }
SettingNode* IntSetting::createNode(float width) {
return IntSettingNode::create(
std::static_pointer_cast<IntSetting>(shared_from_this()),
width
);
}
// SettingNode* FloatSetting::createNode(float width) {
// return FloatSettingNode::create(
// std::static_pointer_cast<FloatSetting>(shared_from_this()),
// width
// );
// }
SettingNode* FloatSetting::createNode(float width) {
return FloatSettingNode::create(
std::static_pointer_cast<FloatSetting>(shared_from_this()),
width
);
}
// SettingNode* StringSetting::createNode(float width) {
// return StringSettingNode::create(
// std::static_pointer_cast<StringSetting>(shared_from_this()),
// width
// );
// }
SettingNode* StringSetting::createNode(float width) {
return StringSettingNode::create(
std::static_pointer_cast<StringSetting>(shared_from_this()),
width
);
}
// SettingNode* FileSetting::createNode(float width) {
// return FileSettingNode::create(
// std::static_pointer_cast<FileSetting>(shared_from_this()),
// width
// );
// }
SettingNode* FileSetting::createNode(float width) {
return FileSettingNode::create(
std::static_pointer_cast<FileSetting>(shared_from_this()),
width
);
}
// SettingNode* ColorSetting::createNode(float width) {
// return ColorSettingNode::create(
// std::static_pointer_cast<ColorSetting>(shared_from_this()),
// width
// );
// }
SettingNode* ColorSetting::createNode(float width) {
return ColorSettingNode::create(
std::static_pointer_cast<ColorSetting>(shared_from_this()),
width
);
}
// SettingNode* ColorAlphaSetting::createNode(float width) {
// return ColorAlphaSettingNode::create(
// std::static_pointer_cast<ColorAlphaSetting>(shared_from_this()),
// width
// );
// }
SettingNode* ColorAlphaSetting::createNode(float width) {
return ColorAlphaSettingNode::create(
std::static_pointer_cast<ColorAlphaSetting>(shared_from_this()),
width
);
}
SettingChangedEvent::SettingChangedEvent(
std::string const& modID,