22 #ifndef SAYONARA_SETTING_H_ 23 #define SAYONARA_SETTING_H_ 25 #include "Utils/Settings/SettingConverter.h" 26 #include "Utils/Settings/SettingKey.h" 27 #include "Utils/Pimpl.h" 54 SettingKey get_key()
const;
55 QString db_key()
const;
56 bool is_db_setting()
const;
58 void assign_value(
const QString& value);
61 virtual bool load_value_from_string(
const QString& str)=0;
62 virtual QString value_to_string()
const=0;
63 virtual void assign_default_value()=0;
67 template<
typename KeyClass>
79 typename KeyClass::Data mValue;
80 typename KeyClass::Data mDefaultValue;
85 Setting(
const char* db_key,
const typename KeyClass::Data& def) :
92 Setting(
const typename KeyClass::Data& def) :
102 void assign_default_value()
override 104 mValue = mDefaultValue;
107 QString value_to_string()
const override 109 return SettingConverter::to_string(mValue);
112 bool load_value_from_string(
const QString& str)
override 114 return SettingConverter::from_string(str, mValue);
118 const typename KeyClass::Data& value()
const 124 const typename KeyClass::Data& default_value()
const 126 return mDefaultValue;
130 bool assign_value(
const typename KeyClass::Data& val)
141 #endif // SAYONARA_SETTING_H_ The Setting class T is the pure value type e.g. QString.
Definition: Setting.h:73
The Settings class.
Definition: Settings.h:42
The AbstrSetting class Every setting needs a key and a value The SettingKey is only used inside the s...
Definition: Setting.h:37