Config: Implement Get and Set

This commit is contained in:
MerryMage
2017-05-13 16:22:53 +01:00
parent 6151bc1714
commit 1548a15c68
3 changed files with 76 additions and 16 deletions

View File

@ -38,22 +38,6 @@ void InvokeConfigChangedCallbacks();
void Load();
void Save();
// Often used functions for getting or setting configuration on the base layer for the main system
template <typename T>
T Get(const std::string& section_name, const std::string& key, const T& default_value)
{
auto base_layer = GetLayer(Config::LayerType::Base);
return base_layer->GetOrCreateSection(Config::System::Main, section_name)
->Get(key, default_value);
}
template <typename T>
void Set(const std::string& section_name, const std::string& key, const T& value)
{
auto base_layer = GetLayer(Config::LayerType::Base);
base_layer->GetOrCreateSection(Config::System::Main, section_name)->Set(key, value);
}
void Init();
void Shutdown();