Poco::Util

class ConfigurationMapper

File Information

Library: Util
Package: Configuration
Header: Poco/Util/ConfigurationMapper.h

Description

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.

Inheritance

Direct Base Classes: AbstractConfiguration

All Base Classes: Poco::RefCountedObject, AbstractConfiguration

Member Summary

Member Functions: enumerate, getRaw, removeRaw, setRaw, translateKey

Inherited Functions: createLocalView, createView, duplicate, enableEvents, enumerate, eventsEnabled, expand, getBool, getDouble, getInt, getInt16, getInt32, getInt64, getRaw, getRawString, getString, getUInt, getUInt16, getUInt32, getUInt64, has, hasOption, hasProperty, keys, parseBool, parseInt, parseInt16, parseInt64, parseUInt, parseUInt16, parseUInt64, referenceCount, release, remove, removeRaw, setBool, setDouble, setInt, setInt16, setInt32, setInt64, setRaw, setRawWithEvent, setString, setUInt, setUInt16, setUInt32, setUInt64

Constructors

ConfigurationMapper

ConfigurationMapper(
    const std::string & fromPrefix,
    const std::string & toPrefix,
    AbstractConfiguration::Ptr pConfig
);

Creates the ConfigurationMapper. The ConfigurationMapper retains (shared) ownership of the passed configuration.

Destructor

~ConfigurationMapper protected virtual

~ConfigurationMapper();

Member Functions

enumerate protected virtual

void enumerate(
    const std::string & key,
    Keys & range
) const;

getRaw protected virtual

bool getRaw(
    const std::string & key,
    std::string & value
) const;

removeRaw protected virtual

void removeRaw(
    const std::string & key
);

setRaw protected virtual

void setRaw(
    const std::string & key,
    const std::string & value
);

translateKey protected

std::string translateKey(
    const std::string & key
) const;