aboutsummaryrefslogtreecommitdiff
path: root/src/libutil
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2021-09-22 14:15:35 +0200
committerEelco Dolstra <edolstra@gmail.com>2021-09-22 14:15:35 +0200
commitd8c10028d96d49b2c783fe279daa91402e8a91da (patch)
tree3747fc06a677a6a8cb2d1ba1486a34a0f26bf868 /src/libutil
parent8fdb1d057ac72d07b9e8c6e522d4d7f0a8bdf352 (diff)
Make setDefault() typed
Diffstat (limited to 'src/libutil')
-rw-r--r--src/libutil/config.cc5
-rw-r--r--src/libutil/config.hh3
2 files changed, 1 insertions, 7 deletions
diff --git a/src/libutil/config.cc b/src/libutil/config.cc
index 2a5f913e6..c247c7dae 100644
--- a/src/libutil/config.cc
+++ b/src/libutil/config.cc
@@ -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());
diff --git a/src/libutil/config.hh b/src/libutil/config.hh
index df5c2226f..736810bf3 100644
--- a/src/libutil/config.hh
+++ b/src/libutil/config.hh
@@ -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;