#include <nawa/config/Config.h>
|
virtual | ~Config () |
|
| Config () |
|
| Config (Config const &other) |
|
| Config (Config &&other) noexcept |
|
Config & | operator= (const Config &other) |
|
Config & | operator= (Config &&other) noexcept |
|
| Config (std::string const &iniFile) |
|
| Config (std::initializer_list< std::pair< std::pair< std::string, std::string >, std::string > > init) |
|
void | read (std::string const &iniFile) |
|
void | insert (std::initializer_list< std::pair< std::pair< std::string, std::string >, std::string > > init) |
|
void | override (std::vector< std::pair< std::pair< std::string, std::string >, std::string > > const &overrides) |
|
bool | isSet (std::pair< std::string, std::string > const &key) const |
|
std::string | operator[] (std::pair< std::string, std::string > const &key) const |
|
void | set (std::pair< std::string, std::string > key, std::string value) |
|
void | set (std::string section, std::string key, std::string value) |
|
Reader for config files and accessor to config values.
Definition at line 35 of file Config.h.
◆ ~Config()
virtual nawa::Config::~Config |
( |
| ) |
|
|
virtual |
◆ Config() [1/5]
◆ Config() [2/5]
nawa::Config::Config |
( |
Config const & |
other | ) |
|
◆ Config() [3/5]
nawa::Config::Config |
( |
Config && |
other | ) |
|
|
noexcept |
◆ Config() [4/5]
Config::Config |
( |
std::string const & |
iniFile | ) |
|
|
explicit |
Construct Config container and directly parse an ini file. Throws an Exception on failure.
- Parameters
-
iniFile | ini file to parse, values will be added to the Config container. |
Definition at line 54 of file Config.cpp.
◆ Config() [5/5]
Config::Config |
( |
std::initializer_list< std::pair< std::pair< std::string, std::string >, std::string > > |
init | ) |
|
Construct Config container based on values from an initializer list.
- Parameters
-
init | Initializer list containing key-value pairs, wherein the keys are section-key pairs. |
Definition at line 50 of file Config.cpp.
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ read()
void Config::read |
( |
std::string const & |
iniFile | ) |
|
Read an ini file and add the values to the Config container. If a key is already set, the element will be ignored, not overwritten. Throws a SysException on failure.
- Parameters
-
iniFile | ini file to parse and import values from. |
Definition at line 58 of file Config.cpp.
◆ insert()
void Config::insert |
( |
std::initializer_list< std::pair< std::pair< std::string, std::string >, std::string > > |
init | ) |
|
Insert values from an initializer list. If a key is already set, the element will be ignored, not overwritten.
- Parameters
-
init | Initializer list containing key-value pairs, wherein the keys are section-key pairs. |
Definition at line 71 of file Config.cpp.
◆ override()
void Config::override |
( |
std::vector< std::pair< std::pair< std::string, std::string >, std::string > > const & |
overrides | ) |
|
Sets the elements form the vector to the given values (or inserts them, if they did not exist yet).
- Parameters
-
overrides | Vector containing key-value pairs, wherein the keys are section-key pairs. |
Definition at line 75 of file Config.cpp.
◆ isSet()
bool Config::isSet |
( |
std::pair< std::string, std::string > const & |
key | ) |
const |
Check whether a key exists in this Config container.
- Parameters
-
key | Key (pair of section and name of the value) to check for. |
- Returns
- True if the key exists, false if not.
Definition at line 81 of file Config.cpp.
◆ operator[]()
std::string Config::operator[] |
( |
std::pair< std::string, std::string > const & |
key | ) |
const |
Get the value belonging to the specified key from the Config container.
- Parameters
-
key | Key (pair of section and name of the value). |
- Returns
- The value belonging to the key if it exists, an empty string otherwise (for distinguishing between an empty value and a non-existing one, use the isSet() function).
Definition at line 85 of file Config.cpp.
◆ set() [1/2]
void Config::set |
( |
std::pair< std::string, std::string > |
key, |
|
|
std::string |
value |
|
) |
| |
Set a key to a new value or insert a new key with the given value.
- Parameters
-
key | Pair of section and key string identifying the Config value that is to be set. |
value | The value to set. |
Definition at line 94 of file Config.cpp.
◆ set() [2/2]
void Config::set |
( |
std::string |
section, |
|
|
std::string |
key, |
|
|
std::string |
value |
|
) |
| |
Set a key to a new value or insert a new key with the given value.
- Parameters
-
section | The config section in which the key is located. |
key | The key. |
value | The value to set. |
Definition at line 98 of file Config.cpp.
The documentation for this class was generated from the following files: