From d8c10028d96d49b2c783fe279daa91402e8a91da Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 22 Sep 2021 14:15:35 +0200 Subject: Make setDefault() typed --- src/libutil/config.cc | 5 ----- src/libutil/config.hh | 3 +-- 2 files changed, 1 insertion(+), 7 deletions(-) (limited to 'src/libutil') 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; -- cgit v1.2.3