66 iConstraints{ aConstraints },
68 iEnabled{ !aConstraints.initially_disabled() },
69 iDefaultValue{ aDefaultValue },
74 iManager{ aOther.iManager },
76 iConstraints{ aOther.iConstraints },
77 iFormat{ aOther.iFormat },
78 iEnabled{ !aOther.iConstraints.initially_disabled() },
79 iDefaultValue{ aOther.iDefaultValue },
80 iValue{ aOther.iValue }
85 iKey{ aSetting.
key() },
87 iFormat{ aSetting.
format() },
88 iEnabled{ !aSetting.
constraints().initially_disabled() },
90 iValue{ aSetting.
value() }
97 string const&
key()
const override
111 return iFormat.
empty();
119 if (iEnabled != aEnabled)
130 return !iValue.is_set();
134 return iNewValue != std::nullopt;
138 return iDefaultValue;
163 aValue = to_string(
value(aUnappliedNew).
template get<T>());
170 iDefaultValue = aDefaultValue;
181 if (
value() != aNewValue)
185 iNewValue = aNewValue;
192 iNewValue = std::nullopt;
208 iNewValue = std::nullopt;
226 bool apply_change()
override
230 bool changed = (iValue != *iNewValue);
232 iNewValue = std::nullopt;
247 bool discard_change()
override
251 iNewValue = std::nullopt;
259 void clone(i_ref_ptr<i_setting>& aResult)
const override
261 aResult = make_ref<setting<T>>(*this);
264 i_settings& iManager;
266 setting_constraints<T> iConstraints;
271 std::optional<setting_value_type> iNewValue;
bool empty() const noexcept
virtual bool is_set() const =0
virtual i_setting_value const & modified_value() const =0
virtual void value_as_string(i_string &aValue, bool aUnappliedNew=false) const =0
virtual void set_value(i_setting_value const &aNewValue)=0
virtual i_setting_value const & value(bool aUnappliedNew=false) const =0
virtual void set_default_value(i_setting_value const &aDefaultValue)=0
virtual void changed_setting(i_setting const &aSetting)=0
virtual void changing_setting(i_setting const &aSetting)=0
bool is_enabled() const override
void set_enabled(bool aEnabled) override
i_setting_value & temp_setting_value() override
void set_value_from_string(i_string const &aNewValue) override
setting_value< T > setting_value_type
string const & key() const override
i_settings & manager() const override
setting_constraints< T > const & constraints() const override
void set_default_value(i_setting_value const &aDefaultValue) override
setting(i_settings &aManager, i_string const &aKey, T const &aDefaultValue, i_setting_constraints const &aConstraints=setting_constraints< T >{}, i_string const &aFormat=string{})
void value_as_string(i_string &aValue, bool aUnappliedNew=false) const override
i_setting_value const & modified_value() const override
setting(const i_setting &aSetting)
define_declared_event(Changing, changing) define_declared_event(Changed
i_setting_value const & default_value() const override
string const & format() const override
bool is_default(bool aUnappliedNew=false) const override
bool hidden() const override
i_setting_value const & value(bool aUnappliedNew=false) const override
void set_value(i_setting_value const &aNewValue) override
setting(const self_type &aOther)
bool modified() const override
#define define_declared_event(name, declName,...)