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

Poco::Util::PropertyFileConfiguration Class Reference

#include <PropertyFileConfiguration.h>

Inheritance diagram for Poco::Util::PropertyFileConfiguration:

Poco::Util::MapConfiguration Poco::Util::AbstractConfiguration Poco::RefCountedObject

List of all members.

Detailed Description

This implementation of a Configuration reads properties from a Java-style properties file.

The file syntax is implemented as follows.

or <key> :

Keys and values may contain special characters represented by the following escape sequences:

For every other sequence that starts with a backslash, the backslash is removed. Therefore, the sequence would just yield an 'a'.

A value can spread across multiple lines if the last character in a line (the character immediately before the carriage return or line feed character) is a single backslash.

Property names are case sensitive. Leading and trailing whitespace is removed from both keys and values. A property name can neither contain a colon ':' nor an equal sign '=' character.

Definition at line 53 of file PropertyFileConfiguration.h.

Public Types

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

Public Member Functions

void clear ()
 Creates an empty MapConfiguration.
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
void load (const std::string &path)
void load (std::istream &istr)
 PropertyFileConfiguration (const std::string &path)
 PropertyFileConfiguration (std::istream &istr)
 Creates an empty PropertyFileConfiguration.
int referenceCount () const
void release () const
 Increments the object's reference count.
void save (const std::string &path) const
void save (std::ostream &ostr) const
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 StringMap::const_iterator iterator
typedef std::map< std::string,
std::string > 
 Clears the configuration.

Protected Member Functions

iterator begin () const
iterator end () const
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)
 ~PropertyFileConfiguration ()
 Writes the configuration data to the given file.

Static Protected Member Functions

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

Private Member Functions

void parseLine (std::istream &istr)

Static Private Member Functions

static int readChar (std::istream &istr)

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

Generated by  Doxygen 1.6.0   Back to index