#include <config_manager.hpp>
|
bool | load_config (const std::filesystem::path &file_path) |
|
std::set< std::string > | get_sections () const |
|
std::optional< std::string > | get_value (const std::string_view &key) const |
|
std::optional< int32_t > | get_int_value (const std::string_view &key) const |
|
std::optional< real_t > | get_real_value (const std::string_view &key) const |
|
std::optional< bool > | get_bool_value (const std::string_view &key) const |
|
Manages the configuration of the application. The configuration is read from a file and stored in memory.
◆ get_bool_value()
std::optional< bool > kn::ConfigManager::get_bool_value |
( |
const std::string_view & |
key | ) |
const |
Returns a value by key as boolean.
- Parameters
-
key | The key to search for. |
- Returns
- The value associated with the key, if it exists.
◆ get_int_value()
std::optional< int32_t > kn::ConfigManager::get_int_value |
( |
const std::string_view & |
key | ) |
const |
Returns a value by key as integer.
- Parameters
-
key | The key to search for. |
- Returns
- The value associated with the key, if it exists.
◆ get_real_value()
std::optional< real_t > kn::ConfigManager::get_real_value |
( |
const std::string_view & |
key | ) |
const |
Returns a value by key as real_t.
- Parameters
-
key | The key to search for. |
- Returns
- The value associated with the key, if it exists.
◆ get_sections()
std::set< std::string > kn::ConfigManager::get_sections |
( |
| ) |
const |
Return a set of all the registered sections.
◆ get_value()
std::optional< std::string > kn::ConfigManager::get_value |
( |
const std::string_view & |
key | ) |
const |
Returns a value by key.
- Parameters
-
key | The key to search for. |
- Returns
- The value associated with the key, if it exists.
◆ load_config()
bool kn::ConfigManager::load_config |
( |
const std::filesystem::path & |
file_path | ) |
|
Loads the configuration from a file and append it to the current configuration.
- Parameters
-
file_path | The path to the file to load. |
- Returns
- True if the file was successfully loaded, false otherwise.
◆ parse_blank()
void kn::ConfigManager::parse_blank |
( |
const std::string_view & |
line | ) |
|
|
protectedvirtual |
Parses a blank line from a line.
- Parameters
-
◆ parse_comment()
void kn::ConfigManager::parse_comment |
( |
const std::string_view & |
line | ) |
|
|
protectedvirtual |
Parses a comment from a line.
- Parameters
-
◆ parse_key_value()
void kn::ConfigManager::parse_key_value |
( |
const std::string_view & |
line | ) |
|
|
protectedvirtual |
Parses a key-value pair from a line.
- Parameters
-
◆ parse_line()
void kn::ConfigManager::parse_line |
( |
const std::string_view & |
line | ) |
|
|
protectedvirtual |
Parses a line from the configuration file.
- Parameters
-
◆ parse_section()
void kn::ConfigManager::parse_section |
( |
const std::string_view & |
line | ) |
|
|
protectedvirtual |
Parses a section from a line.
- Parameters
-
The documentation for this class was generated from the following files: