Parses and manages an INI-style configuration file. More...
#include <mxvk/include/mxvk/mxvk_cfg.hpp>
Public Member Functions | |
| VK_ConfigItem | itemAtKey (const std::string §ion, const std::string &key, const std::string &default_value="") const |
| Retrieve a configuration item by section and key. | |
| void | loadFile (const std::string &f) |
| Load (or reload) a configuration file from disk. | |
| VK_Config & | operator= (const VK_Config &)=delete |
| VK_Config & | operator= (VK_Config &&)=delete |
| void | saveFile (const std::string &f2) |
| Save the current configuration to a file. | |
| void | setItem (const std::string §ion, const std::string &key, const std::string &value) |
| Insert or update a configuration item. | |
| std::vector< std::string > | splitByComma (const std::string &str) const |
| Split a string on comma delimiters. | |
| VK_Config ()=default | |
| Default constructor — no file loaded. | |
| VK_Config (const std::string &filePath) | |
| Open and parse a configuration file. | |
| VK_Config (const VK_Config &)=delete | |
| VK_Config (VK_Config &&)=delete | |
| ~VK_Config () | |
| Destructor — closes any open file resources. | |
Parses and manages an INI-style configuration file.
Sections are denoted by [SectionName] headers. Items within a section are stored as key=value pairs. The file can be loaded, queried, modified in memory, and saved back to disk.
Definition at line 36 of file mxvk_cfg.hpp.
|
default |
Default constructor — no file loaded.
|
explicit |
Open and parse a configuration file.
| filePath | Path to the configuration file. |
Definition at line 115 of file mxvk_cfg.cpp.
| mxvk::VK_Config::~VK_Config | ( | ) |
Destructor — closes any open file resources.
Definition at line 119 of file mxvk_cfg.cpp.
|
delete |
|
delete |
| VK_ConfigItem mxvk::VK_Config::itemAtKey | ( | const std::string & | section, |
| const std::string & | key, | ||
| const std::string & | default_value = "" ) const |
Retrieve a configuration item by section and key.
| section | Section name (text inside [] brackets). |
| key | Key name within that section. |
| default_value | Value returned when the key is not present. |
Definition at line 85 of file mxvk_cfg.cpp.
| void mxvk::VK_Config::loadFile | ( | const std::string & | f | ) |
Load (or reload) a configuration file from disk.
If the file does not exist, an empty file is created first.
| f | Path to the file. |
Definition at line 14 of file mxvk_cfg.cpp.
| void mxvk::VK_Config::saveFile | ( | const std::string & | f2 | ) |
Save the current configuration to a file.
| f2 | Destination file path. |
Definition at line 54 of file mxvk_cfg.cpp.
| void mxvk::VK_Config::setItem | ( | const std::string & | section, |
| const std::string & | key, | ||
| const std::string & | value ) |
Insert or update a configuration item.
| section | Section name. |
| key | Key name. |
| value | New value string. |
Definition at line 97 of file mxvk_cfg.cpp.
| std::vector< std::string > mxvk::VK_Config::splitByComma | ( | const std::string & | str | ) | const |
Split a string on comma delimiters.
| str | Source string. |
Definition at line 101 of file mxvk_cfg.cpp.