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

Poco::Util::LayeredConfiguration Class Reference

#include <LayeredConfiguration.h>

Inheritance diagram for Poco::Util::LayeredConfiguration:

Poco::Util::AbstractConfiguration Poco::RefCountedObject

List of all members.

Detailed Description

A LayeredConfiguration consists of a number of AbstractConfigurations.

When reading a configuration property in a LayeredConfiguration, all added configurations are searched, in order of their priority. Configurations with lower priority values have precedence.

When setting a property, the property is always written to the first writeable configuration (see addWriteable()). If no writeable configuration has been added to the LayeredConfiguration, and an attempt is made to set a property, a RuntimeException is thrown.

Every configuration added to the LayeredConfiguration has a priority value. The priority determines the position where the configuration is inserted, with lower priority values coming before higher priority values.

If no priority is specified, a priority of 0 is assumed.

Definition at line 53 of file LayeredConfiguration.h.

Public Types

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

Public Member Functions

void add (AbstractConfiguration *pConfig, int priority, bool writeable, bool shared)
void add (AbstractConfiguration *pConfig, int priority, bool shared)
void add (AbstractConfiguration *pConfig, int priority)
void add (AbstractConfiguration *pConfig, bool shared)
void add (AbstractConfiguration *pConfig)
 Creates the LayeredConfiguration.
void addFront (AbstractConfiguration *pConfig, bool shared)
void addFront (AbstractConfiguration *pConfig)
void addWriteable (AbstractConfiguration *pConfig, int priority, bool shared)
void addWriteable (AbstractConfiguration *pConfig, int priority)
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 Types

typedef Poco::AutoPtr
< AbstractConfiguration

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
int highest () const
void insert (const ConfigItem &item)
int lowest () const
void setRaw (const std::string &key, const std::string &value)

Static Protected Member Functions

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

Private Types

typedef std::list< ConfigItem > ConfigList

Private Member Functions

 LayeredConfiguration (const LayeredConfiguration &)
LayeredConfigurationoperator= (const LayeredConfiguration &)

Private Attributes

ConfigList _configs


struct  ConfigItem

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

Generated by  Doxygen 1.6.0   Back to index