cfg: move get_name to _base

This commit is contained in:
Megamouse 2021-03-20 17:06:43 +01:00 committed by Ivan
parent 2766e5ca6f
commit ae01e1d2c3
2 changed files with 4 additions and 9 deletions

View File

@ -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)
{

View File

@ -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<std::string> 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