User configuration.
More...
#include <config.h>
|
static std::string | read (const std::string &key, std::string *msg=nullptr) |
|
static std::string | read (const std::string &key, const std::string &default_val, std::string *msg=nullptr) |
|
static bool | edit (const std::string &key, const std::string &v, std::string *msg=nullptr) |
|
User configuration.
Provide read and write portal.
◆ Config()
Construct a new Config object.
This is a default constructor.
◆ _load()
◆ edit()
bool Config::edit |
( |
const std::string & |
key, |
|
|
const std::string & |
v, |
|
|
std::string * |
msg = nullptr |
|
) |
| |
|
static |
◆ operator[]()
std::string Config::operator[] |
( |
const std::string & |
key | ) |
const |
Read the key.
- Exceptions
-
A | std::runtime_error will be thrown if the key cannot be correctly accessed. |
- Parameters
-
- Returns
- (std::string) The value.
◆ read() [1/2]
std::string Config::read |
( |
const std::string & |
key, |
|
|
const std::string & |
default_val, |
|
|
std::string * |
msg = nullptr |
|
) |
| |
|
static |
◆ read() [2/2]
std::string Config::read |
( |
const std::string & |
key, |
|
|
std::string * |
msg = nullptr |
|
) |
| |
|
static |
◆ set()
bool Config::set |
( |
const std::string & |
key, |
|
|
const std::string & |
v |
|
) |
| |
Set the key value.
It will only set the key value when the key exists. Return false if the key does not exist.
- Exceptions
-
A | std::runtime_error will be thrown if the key exists but the value cannot be set. |
- Parameters
-
- Return values
-
true | Successfully set the key. |
false | Failed to set the key. |
◆ size()
size_t Config::size |
( |
| ) |
const |
|
inlinenoexcept |
◆ write()
bool Config::write |
( |
| ) |
const |
◆ _config
YAML::Node Config::_config |
|
private |
The documentation for this class was generated from the following files: