Doxygen with github
|
Implements low-level configuration file handling. More...
#include <ksConfig.h>
Public Member Functions | |
ksConfig (const std::string &fileName) | |
Constructor tha opens or creates configuration file. | |
void | setParam (const std::string ¶mName, const std::string paramValue) |
Sets parameter value (creates new parameter if it does not exist). | |
const std::string & | getParam (const std::string ¶mName, const std::string &defaultValue=std::string()) const |
Retrieves parameter value. | |
operator bool () const | |
Operator bool override. Returns true if configFilename is not empty. | |
virtual | ~ksConfig () |
Saves config content on the device filesystem. In case there is no modification, nothing should actually happen. | |
Implements low-level configuration file handling.
Uses std::map to store configuration parameters. When any parameter is modified, the config file is marked as dirty. Then on destruction, the config file is saved if it has been modified (marked as dirty) into the filesystem.
ksf::ksConfig::ksConfig | ( | const std::string & | fileName | ) |
Constructor tha opens or creates configuration file.
fileName | Config filename. |
References configPath, and setParam().
const std::string & ksf::ksConfig::getParam | ( | const std::string & | paramName, |
const std::string & | defaultValue = std::string() ) const |
Retrieves parameter value.
paramName | Name of the parameter to retrieve. |
defaultValue | Default value to return if parameter does not exist. |
References configParams.
Referenced by ksf::comps::ksConfigProvider::addNewParamWithConfigDefault().
ksf::ksConfig::operator bool | ( | ) | const |
Operator bool override. Returns true if configFilename is not empty.
References configPath.
void ksf::ksConfig::setParam | ( | const std::string & | paramName, |
const std::string | paramValue ) |
Sets parameter value (creates new parameter if it does not exist).
paramName | Parameter name. |
paramValue | Parameter value (use std::move when possible). |
References configParams, and isDirty.
Referenced by ksConfig().