diff options
Diffstat (limited to 'src/libutil/config.hh')
-rw-r--r-- | src/libutil/config.hh | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/libutil/config.hh b/src/libutil/config.hh index 3e6762e54..082119dbe 100644 --- a/src/libutil/config.hh +++ b/src/libutil/config.hh @@ -150,7 +150,7 @@ public: AbstractSetting * setting; }; - typedef std::map<std::string, SettingData> Settings; + using Settings = std::map<std::string, SettingData>; private: @@ -213,7 +213,7 @@ protected: nlohmann::json toJSON(); - virtual std::map<std::string, nlohmann::json> toJSONObject(); + virtual std::map<std::string, nlohmann::json> toJSONObject() const; virtual void convertToArg(Args & args, const std::string & category); @@ -247,7 +247,7 @@ protected: * * @param append Whether to append or overwrite. */ - virtual void appendOrSet(T && newValue, bool append); + virtual void appendOrSet(T newValue, bool append); public: @@ -306,7 +306,7 @@ public: void convertToArg(Args & args, const std::string & category) override; - std::map<std::string, nlohmann::json> toJSONObject() override; + std::map<std::string, nlohmann::json> toJSONObject() const override; }; template<typename T> @@ -316,7 +316,7 @@ std::ostream & operator <<(std::ostream & str, const BaseSetting<T> & opt) } template<typename T> -bool operator ==(const T & v1, const BaseSetting<T> & v2) { return v1 == (const T &) v2; } +bool operator ==(const T & v1, const BaseSetting<T> & v2) { return v1 == static_cast<const T &>(v2); } template<typename T> class Setting : public BaseSetting<T> @@ -329,7 +329,7 @@ public: const std::set<std::string> & aliases = {}, const bool documentDefault = true, std::optional<ExperimentalFeature> experimentalFeature = std::nullopt) - : BaseSetting<T>(def, documentDefault, name, description, aliases, experimentalFeature) + : BaseSetting<T>(def, documentDefault, name, description, aliases, std::move(experimentalFeature)) { options->addSetting(this); } |