Logo Search packages:      
Sourcecode: poco version File versions  Download package

Poco::Util::ConfigurationMapper Class Reference

#include <ConfigurationMapper.h>

Inheritance diagram for Poco::Util::ConfigurationMapper:

Poco::Util::AbstractConfiguration Poco::RefCountedObject

List of all members.


Detailed 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.

Definition at line 51 of file ConfigurationMapper.h.


Public Types

typedef std::vector< std::string > Keys

Public Member Functions

 ConfigurationMapper (const std::string &fromPrefix, const std::string &toPrefix, AbstractConfiguration *pConfig)
AbstractConfigurationcreateView (const std::string &prefix)
 Creates a non-mutable view (see ConfigurationView) into the configuration.
const AbstractConfigurationcreateView (const std::string &prefix) const
void duplicate () const
std::string expand (const std::string &value) const
 Creates a view (see ConfigurationView) into the configuration.
bool getBool (const std::string &key, bool defaultValue) const
bool getBool (const std::string &key) const
double getDouble (const std::string &key, double defaultValue) const
double getDouble (const std::string &key) const
int getInt (const std::string &key, int defaultValue) const
int getInt (const std::string &key) const
std::string getRawString (const std::string &key, const std::string &defaultValue) const
std::string getRawString (const std::string &key) const
std::string getString (const std::string &key, const std::string &defaultValue) const
std::string getString (const std::string &key) const
bool hasOption (const std::string &key) const
 Returns true iff the property with the given key exists.
bool hasProperty (const std::string &key) const
 Creates the AbstractConfiguration.
void keys (const std::string &key, Keys &range) const
 Returns in range the names of all keys at root level.
void keys (Keys &range) const
int referenceCount () const
void release () const
 Increments the object's reference count.
void setBool (const std::string &key, bool value)
void setDouble (const std::string &key, double value)
void setInt (const std::string &key, int value)
void setString (const std::string &key, const std::string &value)

Protected Member Functions

virtual void enumerate (const std::string &key, Keys &range) const =0
void enumerate (const std::string &key, Keys &range) const
bool getRaw (const std::string &key, std::string &value) const
void setRaw (const std::string &key, const std::string &value)
std::string translateKey (const std::string &key) const

Static Protected Member Functions

static bool parseBool (const std::string &value)
static int parseInt (const std::string &value)

Private Member Functions

 ConfigurationMapper (const ConfigurationMapper &)
ConfigurationMapperoperator= (const ConfigurationMapper &)

Private Attributes

std::string _fromPrefix
AbstractConfiguration_pConfig
std::string _toPrefix

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index