diff --git a/include/Engine/Core/ConfigFile.h b/include/Engine/Core/ConfigFile.h index 28c34bd3..54bbbad4 100644 --- a/include/Engine/Core/ConfigFile.h +++ b/include/Engine/Core/ConfigFile.h @@ -5,6 +5,7 @@ #include #include #include +#include #include "../Common.h" #include "ResourceManager.h" @@ -19,12 +20,14 @@ private: public: template T Get(std::string key, T defaultValue); + template + std::vector> GetAll(std::string key); template void Set(std::string key, T value); void SaveToDisk(); - private: +private: boost::filesystem::path m_Path; boost::property_tree::ptree m_PTreeDefaults; boost::property_tree::ptree m_PTreeOverrides; @@ -37,6 +40,21 @@ T ConfigFile::Get(std::string key, T defaultValue) return m_PTreeMerged.get(key, defaultValue); } +template +std::vector> ConfigFile::GetAll(std::string key) +{ + std::vector> out; + auto parent = m_PTreeMerged.find(key); + if (parent == m_PTreeMerged.not_found()) { + return out; + } + for (auto& child : parent->second) { + T value = boost::lexical_cast(child.second.data()); + out.push_back(std::make_pair(child.first, value)); + } + return out; +} + template void ConfigFile::Set(std::string key, T value) {