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. | |
virtual | ~ksConfig () |
Saves config content on the device filesystem. In case there is no modification, nothing should actually happen. | |
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. | |
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. Upon destruction, if the file has been modified, it is saved to the filesystem.
ksf::misc::ksConfig::ksConfig | ( | const std::string & | fileName | ) |
Constructor tha opens or creates configuration file.
fileName | Config filename. |
References configParams, and configPath.
const std::string & ksf::misc::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::misc::ksConfig::operator bool | ( | ) | const |
Operator bool override. Returns true if configFilename is not empty.
void ksf::misc::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.