#ifndef CLRSYNC_CORE_CONFIG_HPP #define CLRSYNC_CORE_CONFIG_HPP #include "core/common/error.hpp" #include "core/io/file.hpp" #include "core/theme/theme_template.hpp" #include #include #include namespace clrsync::core { class config { public: static config &instance(); Result initialize(std::unique_ptr file); const std::string font() const; const uint32_t font_size() const; const std::string &palettes_path(); const std::string default_theme() const; const std::unordered_map templates(); Result template_by_name(const std::string &name) const; std::filesystem::path get_user_config_dir(); std::filesystem::path get_user_state_dir(); std::filesystem::path get_writable_config_path(); Result set_default_theme(const std::string &theme); Result set_palettes_path(const std::string &path); Result set_font(const std::string &font); Result set_font_size(int font_size); Result update_template(const std::string &key, const clrsync::core::theme_template &theme_template); Result remove_template(const std::string &key); static std::filesystem::path get_data_dir(); private: config() = default; config(const config &) = delete; config &operator=(const config &) = delete; std::string m_palettes_dir{}; std::unique_ptr m_file; std::unique_ptr m_temp_file; std::string m_temp_config_path; std::unordered_map m_themes{}; Result save_config_value(const std::string §ion, const std::string &key, const value_type &value); static void copy_file(const std::filesystem::path &src, const std::filesystem::path &dst); static void copy_dir(const std::filesystem::path &src, const std::filesystem::path &dst); void copy_default_configs(); }; } // namespace clrsync::core #endif