Chatsync
bbffde5c0c672a526bdc83637acf66dc20a80fbf
|
#include <config.hpp>
Public Member Functions | |
ConfigParser (const std::string &path) | |
const ConfigOption | operator[] (const std::string &&option) const |
const ConfigOption | get (const std::string &&option, const ConfigOption &&defaultValue) const |
Static Private Member Functions | |
static const std::string | openConfig (const std::string &path) |
static std::map< const std::string, const ConfigOption > * | parseConfig (const std::string &data) |
Private Attributes | |
const std::unique_ptr< std::map< const std::string, const ConfigOption > const > | _config |
An object for parsing configuration file
Config file format is just like .ini files
Hub::Hub config: [hub] name = "Hub 1"
Channelling::Channel config: [channel] name = "Channel name" direction = in|out|both
config::ConfigParser::ConfigParser | ( | const std::string & | path | ) |
Creates an object
path | Configuration file name and path |
const ConfigOption config::ConfigParser::get | ( | const std::string && | option, |
const ConfigOption && | defaultValue | ||
) | const |
Get option from storage or return default value
option | Option name to request |
defaultValue | Default value to return if no value found in map |
|
staticprivate |
Opens
path | parsing scheme and returns a single line with configuration |
Possible schemes:
path | path to config |
string | with config lines separated with |
config_error | if file can't be opened |
const ConfigOption config::ConfigParser::operator[] | ( | const std::string && | option | ) | const |
Get option from storage
option_error | if no option found in storage |
|
staticprivate |
|
private |