incron
0.5.10
|
Configuration class. More...
#include <incroncfg.h>
Static Public Member Functions | |
static void | Init () |
Initializes default configuration values. | |
static void | Load (const std::string &rPath) |
Loads configuration values. | |
static bool | GetValue (const std::string &rKey, std::string &rVal) |
Retrieves a configuration value. | |
static bool | GetValue (const std::string &rKey, int &rVal) |
Retrieves a configuration value. | |
static bool | GetValue (const std::string &rKey, unsigned &rVal) |
Retrieves a configuration value. | |
static bool | GetValue (const std::string &rKey, bool &rVal) |
Retrieves a configuration value. | |
static std::string | BuildPath (const std::string &rPath, const std::string &rName) |
Builds a file path. | |
Static Protected Member Functions | |
static bool | ParseLine (const char *s, std::string &rKey, std::string &rVal) |
Parses a line a attempts to get a key and a value. | |
static bool | IsComment (const char *s) |
Checks whether a line is a comment. |
Configuration class.
This class provides access to values loaded from a configuration file (either a explicitly specified one or the default one).
std::string IncronCfg::BuildPath | ( | const std::string & | rPath, |
const std::string & | rName | ||
) | [static] |
Builds a file path.
This function composes a path from a base path and a file name.
[in] | rPath | base path |
[in] | rName | file name |
bool IncronCfg::GetValue | ( | const std::string & | rKey, |
std::string & | rVal | ||
) | [static] |
Retrieves a configuration value.
This method attempts to find the appropriate configuration value for the given key and stores it into the given variable.
[in] | rKey | value key |
[out] | rVal | retrieved value |
bool IncronCfg::GetValue | ( | const std::string & | rKey, |
int & | rVal | ||
) | [static] |
Retrieves a configuration value.
This method attempts to find the appropriate configuration value for the given key and stores it into the given variable.
[in] | rKey | value key |
[out] | rVal | retrieved value |
bool IncronCfg::GetValue | ( | const std::string & | rKey, |
unsigned & | rVal | ||
) | [static] |
Retrieves a configuration value.
This method attempts to find the appropriate configuration value for the given key and stores it into the given variable.
[in] | rKey | value key |
[out] | rVal | retrieved value |
bool IncronCfg::GetValue | ( | const std::string & | rKey, |
bool & | rVal | ||
) | [static] |
Retrieves a configuration value.
This method attempts to find the appropriate configuration value for the given key and stores it into the given variable.
[in] | rKey | value key |
[out] | rVal | retrieved value |
void IncronCfg::Init | ( | ) | [static] |
Initializes default configuration values.
bool IncronCfg::IsComment | ( | const char * | s | ) | [static, protected] |
Checks whether a line is a comment.
[in] | s | text line |
void IncronCfg::Load | ( | const std::string & | rPath | ) | [static] |
Loads configuration values.
This method attempts to load configuration values from the specified file. If it fails (e.g. the file doesn't exist) the default file is read. As the last resort (for the case the default file can't be loaded) the hard-wired values are used.
[in] | rPath | configuration file path |
bool IncronCfg::ParseLine | ( | const char * | s, |
std::string & | rKey, | ||
std::string & | rVal | ||
) | [static, protected] |
Parses a line a attempts to get a key and a value.
[in] | s | text line |
[out] | rKey | key |
[out] | rVal | value |