mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-06 15:01:28 +12:00
Replace remained old ini-manager calls
This commit is contained in:
parent
7dfe9415c4
commit
fd13a495de
18 changed files with 194 additions and 119 deletions
|
@ -27,6 +27,31 @@ protected:
|
|||
std::string name() const;
|
||||
std::string full_name() const;
|
||||
|
||||
template<typename T>
|
||||
void add_entry(const std::string& name, const T& def_value)
|
||||
{
|
||||
new entry<T>(this, name, def_value);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T get_entry_value(const std::string& name, const T& def_value)
|
||||
{
|
||||
if (!entries[name])
|
||||
add_entry(name, def_value);
|
||||
|
||||
return convert::to<T>(entries[name]->string_value());
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void set_entry_value(const std::string& name, const T& value)
|
||||
{
|
||||
if (entries[name])
|
||||
entries[name]->string_value(convert::to<std::string>(value));
|
||||
|
||||
else
|
||||
add_entry(name, value);
|
||||
}
|
||||
|
||||
friend config_context_t;
|
||||
};
|
||||
|
||||
|
@ -56,7 +81,8 @@ public:
|
|||
, m_default_value(default_value)
|
||||
, m_value(default_value)
|
||||
{
|
||||
parent->entries[name] = this;
|
||||
if(!parent->entries[name])
|
||||
parent->entries[name] = this;
|
||||
}
|
||||
|
||||
T default_value() const
|
||||
|
@ -132,4 +158,7 @@ public:
|
|||
void set_defaults();
|
||||
|
||||
std::string to_string() const;
|
||||
|
||||
void add_group(const std::string& name);
|
||||
group& get_group(const std::string& name);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue