Config: Flatten structures

Originally, Layer contained a std::map of Sections, which containted a std::map
containing the (key, value) pairs. Here we flattern this structure so that only
one std::map is required, reducing the number of indirections required and
vastly simplifying the code.
This commit is contained in:
MerryMage
2017-10-29 19:11:15 +00:00
parent f3b52c07d7
commit 4c24629b95
13 changed files with 220 additions and 551 deletions

View File

@ -45,18 +45,15 @@ public:
}
}
void Load(Config::Layer* config_layer) override
void Load(Config::Layer* layer) override
{
for (auto& value : m_values)
{
const Config::ConfigLocation location = std::get<0>(value);
Config::Section* section =
config_layer->GetOrCreateSection(location.system, location.section);
section->Set(location.key, std::get<1>(value));
layer->Set(std::get<0>(value), std::get<1>(value));
}
}
void Save(Config::Layer* config_layer) override
void Save(Config::Layer* layer) override
{
// Save Nothing
}