|
| | ConfigParser (std::ifstream &configFile) |
| |
|
template<typename T > |
| T | aConfig (std::string section, std::string name, size_t pos=0) |
| |
|
template<typename T > |
| std::vector< T > | aConfigVec (std::string section, std::string name) |
| |
| template<> |
| bool | aConfig (std::string section, std::string configName, size_t pos) |
| |
| template<> |
| std::vector< bool > | aConfigVec (std::string section, std::string configName) |
| |
|
template<> |
| bool | aConfig (std::string section, std::string name, size_t pos) |
| |
|
template<> |
| std::vector< bool > | aConfigVec (std::string section, std::string name) |
| |
◆ ConfigParser()
| ConfigParser::ConfigParser |
( |
std::ifstream & |
configFile | ) |
|
Constructor for ConfigParser.
This function reads and parses a configuration file. It processes lines to strip whitespace, ignores comments, and splits key-value pairs using the = symbol. If the key is within a section (indicated by [...]), the key is prefixed with the section name. Multiple values for a key are stored in a vector. Parsed configurations are stored in a map with section and key names combined as the key.
- Parameters
-
| configFile | A reference to an ifstream representing the open configuration file. |
- Exceptions
-
| std::runtime_error | if a parsing error occurs in the configuration file. |
◆ aConfig()
template<>
| bool ConfigParser::aConfig |
( |
std::string |
section, |
|
|
std::string |
configName, |
|
|
size_t |
pos |
|
) |
| |
Template specialization for retrieving boolean configuration values.
This function retrieves a specific boolean configuration value from a section and configuration name. The value is parsed as either true (for "true", "TRUE", or "1") or false (for "false", "FALSE", or "0"). If the value does not match any of these, the function defaults to false.
- Parameters
-
| section | The section name in the configuration file. |
| configName | The key within the section. |
| pos | The position of the value in the vector (if there are multiple values). |
- Returns
true if the configuration value is recognized as true, otherwise false.
◆ aConfigVec()
template<>
| std::vector< bool > ConfigParser::aConfigVec |
( |
std::string |
section, |
|
|
std::string |
configName |
|
) |
| |
Template specialization for retrieving a vector of boolean configuration values.
This function retrieves a vector of boolean values associated with a configuration key in a section. Each value is parsed as either true (for "true", "TRUE", or "1") or false (for "false", "FALSE", or "0"). If a value does not match any of these, it defaults to false.
- Parameters
-
| section | The section name in the configuration file. |
| configName | The key within the section. |
- Returns
- A vector of boolean values parsed from the configuration.
The documentation for this class was generated from the following files: