From ae01e1d2c3942a741ff061aefb9f8ceb01f8af45 Mon Sep 17 00:00:00 2001 From: Megamouse Date: Sat, 20 Mar 2021 17:06:43 +0100 Subject: [PATCH] cfg: move get_name to _base --- Utilities/Config.cpp | 2 +- Utilities/Config.h | 11 +++-------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/Utilities/Config.cpp b/Utilities/Config.cpp index eee57fd928..d43289a12c 100644 --- a/Utilities/Config.cpp +++ b/Utilities/Config.cpp @@ -20,7 +20,7 @@ namespace cfg } _base::_base(type _type, node* owner, const std::string& name, bool dynamic) - : m_type(_type), m_dynamic(dynamic) + : m_type(_type), m_dynamic(dynamic), m_name(name) { for (const auto& pair : owner->m_nodes) { diff --git a/Utilities/Config.h b/Utilities/Config.h index 7cd384b906..e97ab042dc 100644 --- a/Utilities/Config.h +++ b/Utilities/Config.h @@ -52,6 +52,7 @@ namespace cfg protected: bool m_dynamic = true; + const std::string m_name; // Ownerless entry constructor _base(type _type); @@ -67,6 +68,8 @@ namespace cfg // Get type type get_type() const { return m_type; } + const std::string& get_name() const { return m_name; }; + // Get dynamic property for reloading configs during games bool get_is_dynamic() const { return m_dynamic; }; @@ -391,8 +394,6 @@ namespace cfg // Simple string entry with mutex class string : public _base { - const std::string m_name; - atomic_ptr m_value; public: @@ -400,7 +401,6 @@ namespace cfg string(node* owner, std::string name, std::string def = {}, bool dynamic = false) : _base(type::string, owner, name, dynamic) - , m_name(std::move(name)) , m_value(def) , def(std::move(def)) { @@ -426,11 +426,6 @@ namespace cfg } } - const std::string& get_name() const - { - return m_name; - } - void from_default() override; std::string to_string() const override