/* Config.h * * Loads and stores configuration data in an INI-like format. */ #pragma once #include #include #include namespace PlipSdl { class Config { public: const std::string &GetValue(const std::string &key); const std::string &GetValue(const std::string §ion, const std::string &key); bool LoadFile(const std::string &filename); void SetValue(const std::string &key, const std::string &value); void SetValue(const std::string §ion, const std::string &key, const std::string &value); template T GetValue(const std::string &key) { return GetValue(global, key); } template T GetValue(const std::string §ion, const std::string &key) { auto val = GetValue(section, key); T output; std::stringstream conversion(val); conversion >> output; return output; } const std::string global = "\x01"; const std::string empty = "\xff"; private: std::unordered_map> m_section; }; }