mirror of
https://github.com/NixOS/nix.git
synced 2025-11-12 21:46:01 +01:00
Make setDefault() typed
This commit is contained in:
parent
8fdb1d057a
commit
d8c10028d9
5 changed files with 7 additions and 13 deletions
|
|
@ -177,11 +177,6 @@ AbstractSetting::AbstractSetting(
|
|||
{
|
||||
}
|
||||
|
||||
void AbstractSetting::setDefault(const std::string & str)
|
||||
{
|
||||
if (!overridden) set(str);
|
||||
}
|
||||
|
||||
nlohmann::json AbstractSetting::toJSON()
|
||||
{
|
||||
return nlohmann::json(toJSONObject());
|
||||
|
|
|
|||
|
|
@ -194,8 +194,6 @@ public:
|
|||
|
||||
bool overridden = false;
|
||||
|
||||
void setDefault(const std::string & str);
|
||||
|
||||
protected:
|
||||
|
||||
AbstractSetting(
|
||||
|
|
@ -253,6 +251,7 @@ public:
|
|||
bool operator !=(const T & v2) const { return value != v2; }
|
||||
void operator =(const T & v) { assign(v); }
|
||||
virtual void assign(const T & v) { value = v; }
|
||||
void setDefault(const T & v) { if (!overridden) value = v; }
|
||||
|
||||
void set(const std::string & str, bool append = false) override;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue