#ifndef CLIENT_SETTINGS_HH_ #define CLIENT_SETTINGS_HH_ #include #include #include #include #include #include #include "client/shared.hh" #include "shared/shared.hh" // This settings file just provides functionality for persistent variables, // it has nothing to do with rendering or our window manager. namespace client { namespace settings { void set_setting_str( const std::pair loc, const std::string& value) noexcept; std::string get_setting_str(const std::pair loc, const std::string default_value) noexcept; // Attempts to read the setting in the file, returning it if it exists. // If either name or category does not exist, writes the default value in // the file under the expected headings. template T get(const std::pair& loc, const T& default_value) noexcept { const std::string value = get_setting_str(loc, boost::lexical_cast(default_value)); return boost::lexical_cast(value); } // Attempts to set the setting in the file, overwriting the pre-existing // value or writing a new entry. template void set(const std::pair& loc, const T& value) noexcept { set_setting_str(loc, boost::lexical_cast(value)); } void save() noexcept; } // namespace settings } // namespace client #endif