#include <ConfigMap.hpp>
Inheritance diagram for Ionflux::Tools::ConfigMap:
Public Member Functions | |
ConfigMap () | |
Constructor. | |
virtual | ~ConfigMap () |
Destructor. | |
virtual void | clear () |
Clear all configuration data. | |
virtual void | readConfig (const std::string &configFile) |
Read configuration from a file. | |
virtual void | writeConfig (const std::string &configFile) |
Write configuration to a file. | |
virtual void | writeConfig () |
Write configuration to a file. | |
virtual std::string | get (const std::string &key) |
Get a configuration value. | |
virtual void | set (const std::string &key, const std::string &value) |
Set a configuration value. | |
Static Public Attributes | |
static const std::string | CONFIG_PATTERN = "([a-zA-Z0-9_\\.]+)\\s*=\\s*(.*)" |
Pattern used to match configuration key/value pairs. | |
static const std::string | COMMENT_PATTERN = "^#" |
Pattern used to match comments. | |
Protected Member Functions | |
virtual void | init () |
Initialize configuration object. | |
virtual ConfigOption | parseConfigLine (const std::string &configLine) |
Parse a line of configuration. | |
virtual void | updateInputData () |
Update configuration input data. | |
Protected Attributes | |
std::vector< std::string > | configInput |
Vector to store the input as read from a config file. | |
std::string | inputFile |
Configuration source file. | |
std::map< std::string, std::string > | config |
Configuration map where key/value pairs are stored. | |
std::vector< std::string > | newKeys |
Vector to store option keys that were added at runtime. | |
pcre * | configRE |
Configuration line regexp pattern. | |
pcre * | commentRE |
Comment line regexp pattern. |
Encapsulates configuration data as a set of key/value pairs.
|
Constructor. Construct new ConfigMap object. |
|
Destructor. Destruct ConfigMap object. |
|
Clear all configuration data. Effectively erases all configuration data from the ConfigMap object. Implements Ionflux::Tools::Config. |
|
Get a configuration value. Fetches the value of a configuration option from the configuration table.
Implements Ionflux::Tools::Config. |
|
Initialize configuration object. Sets up the internals, such as patterns that should be compiled in advance. |
|
Parse a line of configuration. Parses a line containing a key/value pair or a comment. Key/Value pairs are added to the configuration map, comments are simply ignored.
|
|
Read configuration from a file. Reads data from a configuration file and stores it in the configuration table.
Implements Ionflux::Tools::Config. |
|
Set a configuration value. Sets the configuration option denoted by key to value.
Implements Ionflux::Tools::Config. |
|
Update configuration input data. Changes the configuration input data so that it represents the actual current settings of the Config object. This may be used to update a configuration file. |
|
Write configuration to a file. Writes configuration data stored in the ConfigMap object to the same file it was read from. Implements Ionflux::Tools::Config. |
|
Write configuration to a file. Writes configuration data stored in the ConfigMap object to a file.
Implements Ionflux::Tools::Config. |
|
Pattern used to match comments.
|
|
Comment line regexp pattern.
|
|
Configuration map where key/value pairs are stored.
|
|
Pattern used to match configuration key/value pairs.
|
|
Vector to store the input as read from a config file.
|
|
Configuration line regexp pattern.
|
|
Configuration source file.
|
|
Vector to store option keys that were added at runtime.
|