#ifndef ConfigFile_h__ #define ConfigFile_h__ #include #include #include #include #include "ResourceManager.h" namespace dd { class ConfigFile : public Resource { friend class ResourceManager; private: ConfigFile(std::string path); public: template T GetValue(std::string key, T defaultValue); template void SetValue(std::string key, T value); void SaveToDisk(); private: boost::filesystem::path m_Path; boost::property_tree::ptree m_PTreeDefaults; boost::property_tree::ptree m_PTreeOverrides; boost::property_tree::ptree m_PTreeMerged; }; template T ConfigFile::GetValue(std::string key, T defaultValue) { return m_PTreeMerged.get(key, defaultValue); } template void ConfigFile::SetValue(std::string key, T value) { m_PTreeOverrides.put(key, value); m_PTreeMerged.put(key, value); } }; #endif // ConfigFile_h__