#ifndef WANDA_setting_HPP #define WANDA_setting_HPP #include #include #include #include #include #include "type_wrapper.hpp" #include "variant.hpp" #include namespace wanda { struct setting; using schema = type_wrapper; using key = type_wrapper; namespace literals { key operator""_key(char const * str, std::size_t len); std::optional operator""_setting(char const * str, std::size_t len); } struct setting { ~setting(); setting(setting const & other); template std::optional get(key key) const { auto value = variant{g_settings_get_value(m_value, key.get().c_str())}; return value.get(); } private: explicit setting(schema schema); GSettings * m_value; friend std::optional literals::operator""_setting(char const *, std::size_t); }; } #endif