Library: Util
Package: Configuration
Header: Poco/Util/ConfigurationMapper.h
This configuration maps a property hierarchy into another hierarchy.
For example, given a configuration with the following properties:
config.value1 config.value2 config.sub.value1 config.sub.value2
and a ConfigurationView with fromPrefix == "config" and toPrefix == "root.conf", then the above properties will be available via the mapper as
root.conf.value1 root.conf.value2 root.conf.sub.value1 root.conf.sub.value2
FromPrefix can be empty, in which case, and given toPrefix == "root", the properties will be available as
root.config.value1 root.config.value2 root.config.sub.value1 root.config.sub.value2
This is equivalent to the functionality of the ConfigurationView class.
Similarly, toPrefix can also be empty. Given fromPrefix == "config" and toPrefix == "", the properties will be available as
value1 value2 sub.value1 sub.value2
If both fromPrefix and toPrefix are empty, no mapping is performed.
A ConfigurationMapper is most useful in combination with a LayeredConfiguration.
Direct Base Classes: AbstractConfiguration
All Base Classes: Poco::RefCountedObject, AbstractConfiguration
Member Functions: enumerate, getRaw, removeRaw, setRaw, translateKey
Inherited Functions: createView, duplicate, enumerate, expand, getBool, getDouble, getInt, getRaw, getRawString, getString, has, hasOption, hasProperty, keys, parseBool, parseInt, referenceCount, release, remove, removeRaw, setBool, setDouble, setInt, setRaw, setRawWithEvent, setString
ConfigurationMapper(
const std::string & fromPrefix,
const std::string & toPrefix,
AbstractConfiguration * pConfig
);
Creates the ConfigurationMapper. The ConfigurationMapper does not take ownership of the passed configuration.
void enumerate(
const std::string & key,
Keys & range
) const;
bool getRaw(
const std::string & key,
std::string & value
) const;
void removeRaw(
const std::string & key
);
void setRaw(
const std::string & key,
const std::string & value
);
std::string translateKey(
const std::string & key
) const;