|
MetaImGUI 1.0.0
ImGui Application Template for C++20
|
Configuration manager for persistent application settings. More...
#include <ConfigManager.h>
Classes | |
| struct | Impl |
Public Member Functions | |
| ConfigManager () | |
| ~ConfigManager () | |
| ConfigManager (const ConfigManager &)=delete | |
| ConfigManager & | operator= (const ConfigManager &)=delete |
| ConfigManager (ConfigManager &&)=default | |
| ConfigManager & | operator= (ConfigManager &&)=default |
| bool | Load () |
| Load configuration from disk. | |
| bool | Save () |
| Save configuration to disk. | |
| void | Reset () |
| Reset configuration to defaults. | |
| bool | ConfigFileExists () const |
| Check if configuration file exists. | |
| std::filesystem::path | GetConfigPath () const |
| Get configuration file path. | |
| void | SetWindowPosition (int x, int y) |
| void | SetWindowSize (int width, int height) |
| std::optional< std::pair< int, int > > | GetWindowPosition () const |
| std::optional< std::pair< int, int > > | GetWindowSize () const |
| void | SetWindowMaximized (bool maximized) |
| bool | GetWindowMaximized () const |
| void | SetTheme (const std::string &theme) |
| std::string | GetTheme () const |
| void | AddRecentFile (const std::string &filepath) |
| std::vector< std::string > | GetRecentFiles () const |
| void | ClearRecentFiles () |
| void | SetMaxRecentFiles (size_t max) |
| void | SetString (const std::string &key, const std::string &value) |
| std::optional< std::string > | GetString (const std::string &key) const |
| void | SetInt (const std::string &key, int value) |
| std::optional< int > | GetInt (const std::string &key) const |
| void | SetBool (const std::string &key, bool value) |
| std::optional< bool > | GetBool (const std::string &key) const |
| void | SetFloat (const std::string &key, float value) |
| std::optional< float > | GetFloat (const std::string &key) const |
| bool | HasKey (const std::string &key) const |
| void | RemoveKey (const std::string &key) |
| std::vector< std::string > | GetAllKeys () const |
Configuration manager for persistent application settings.
ConfigManager handles loading, saving, and accessing application configuration using JSON format. Settings are stored in the user's config directory.
Supported platforms:
Definition at line 41 of file ConfigManager.h.
| MetaImGUI::ConfigManager::ConfigManager | ( | ) |
Definition at line 53 of file ConfigManager.cpp.
References GetConfigPath(), and Reset().
|
default |
|
delete |
|
default |
| void MetaImGUI::ConfigManager::AddRecentFile | ( | const std::string & | filepath | ) |
Definition at line 199 of file ConfigManager.cpp.
| void MetaImGUI::ConfigManager::ClearRecentFiles | ( | ) |
Definition at line 237 of file ConfigManager.cpp.
| bool MetaImGUI::ConfigManager::ConfigFileExists | ( | ) | const |
Check if configuration file exists.
Definition at line 120 of file ConfigManager.cpp.
Referenced by Load().
| std::vector< std::string > MetaImGUI::ConfigManager::GetAllKeys | ( | ) | const |
Definition at line 329 of file ConfigManager.cpp.
References LOG_WARNING.
| std::optional< bool > MetaImGUI::ConfigManager::GetBool | ( | const std::string & | key | ) | const |
Definition at line 290 of file ConfigManager.cpp.
References LOG_WARNING.
| std::filesystem::path MetaImGUI::ConfigManager::GetConfigPath | ( | ) | const |
Get configuration file path.
Definition at line 124 of file ConfigManager.cpp.
Referenced by ConfigManager().
| std::optional< float > MetaImGUI::ConfigManager::GetFloat | ( | const std::string & | key | ) | const |
Definition at line 308 of file ConfigManager.cpp.
References LOG_WARNING.
| std::optional< int > MetaImGUI::ConfigManager::GetInt | ( | const std::string & | key | ) | const |
Definition at line 272 of file ConfigManager.cpp.
References LOG_WARNING.
| std::vector< std::string > MetaImGUI::ConfigManager::GetRecentFiles | ( | ) | const |
Definition at line 223 of file ConfigManager.cpp.
References LOG_WARNING.
| std::optional< std::string > MetaImGUI::ConfigManager::GetString | ( | const std::string & | key | ) | const |
Definition at line 254 of file ConfigManager.cpp.
References LOG_WARNING.
| std::string MetaImGUI::ConfigManager::GetTheme | ( | ) | const |
Definition at line 186 of file ConfigManager.cpp.
References MetaImGUI::ConfigManager::Impl::DEFAULT_THEME, and LOG_WARNING.
| bool MetaImGUI::ConfigManager::GetWindowMaximized | ( | ) | const |
Definition at line 169 of file ConfigManager.cpp.
References LOG_WARNING.
| std::optional< std::pair< int, int > > MetaImGUI::ConfigManager::GetWindowPosition | ( | ) | const |
Definition at line 140 of file ConfigManager.cpp.
References LOG_WARNING.
| std::optional< std::pair< int, int > > MetaImGUI::ConfigManager::GetWindowSize | ( | ) | const |
Definition at line 152 of file ConfigManager.cpp.
References LOG_WARNING.
| bool MetaImGUI::ConfigManager::HasKey | ( | const std::string & | key | ) | const |
Definition at line 319 of file ConfigManager.cpp.
| bool MetaImGUI::ConfigManager::Load | ( | ) |
Load configuration from disk.
Definition at line 60 of file ConfigManager.cpp.
References ConfigFileExists(), LOG_ERROR, LOG_INFO, and Reset().
|
default |
|
delete |
| void MetaImGUI::ConfigManager::RemoveKey | ( | const std::string & | key | ) |
Definition at line 323 of file ConfigManager.cpp.
| void MetaImGUI::ConfigManager::Reset | ( | ) |
Reset configuration to defaults.
Definition at line 108 of file ConfigManager.cpp.
References MetaImGUI::ConfigManager::Impl::DEFAULT_THEME, MetaImGUI::ConfigManager::Impl::DEFAULT_WINDOW_HEIGHT, and MetaImGUI::ConfigManager::Impl::DEFAULT_WINDOW_WIDTH.
Referenced by ConfigManager(), and Load().
| bool MetaImGUI::ConfigManager::Save | ( | ) |
Save configuration to disk.
Definition at line 86 of file ConfigManager.cpp.
| void MetaImGUI::ConfigManager::SetBool | ( | const std::string & | key, |
| bool | value | ||
| ) |
Definition at line 283 of file ConfigManager.cpp.
| void MetaImGUI::ConfigManager::SetFloat | ( | const std::string & | key, |
| float | value | ||
| ) |
Definition at line 301 of file ConfigManager.cpp.
| void MetaImGUI::ConfigManager::SetInt | ( | const std::string & | key, |
| int | value | ||
| ) |
Definition at line 265 of file ConfigManager.cpp.
| void MetaImGUI::ConfigManager::SetMaxRecentFiles | ( | size_t | max | ) |
Definition at line 241 of file ConfigManager.cpp.
| void MetaImGUI::ConfigManager::SetString | ( | const std::string & | key, |
| const std::string & | value | ||
| ) |
Definition at line 247 of file ConfigManager.cpp.
| void MetaImGUI::ConfigManager::SetTheme | ( | const std::string & | theme | ) |
Definition at line 182 of file ConfigManager.cpp.
| void MetaImGUI::ConfigManager::SetWindowMaximized | ( | bool | maximized | ) |
Definition at line 165 of file ConfigManager.cpp.
| void MetaImGUI::ConfigManager::SetWindowPosition | ( | int | x, |
| int | y | ||
| ) |
Definition at line 130 of file ConfigManager.cpp.
| void MetaImGUI::ConfigManager::SetWindowSize | ( | int | width, |
| int | height | ||
| ) |
Definition at line 135 of file ConfigManager.cpp.