ConfigurationObject Class Reference

#include <configuration.h>

Inheritance diagram for ConfigurationObject:

Configuration

List of all members.


Detailed Description

Configuration object, mapping values to names and possibly containing lists of further configuration objects.

Definition at line 75 of file configuration.h.


Public Member Functions

virtual ~ConfigurationObject ()
virtual void setValue (const std::string &key, const std::string &value)
 Sets an option using a string value.
std::string getValue (const std::string &key, const std::string &deflt) const
 Gets a value as string.
int getValue (const std::string &key, int deflt) const
unsigned getValue (const std::string &key, unsigned deflt) const
double getValue (const std::string &key, double deflt) const
virtual void clear ()
 Re-sets all data in the configuration.
template<class IT, class T, class CONT>
void setList (const std::string &name, IT begin, IT end, ConfigurationListManager< T, CONT > *manager)
 Serialises a container into a list of configuration options.
template<class T, class CONT>
CONT getList (const std::string &name, CONT empty, ConfigurationListManager< T, CONT > *manager)
 Serialises a container into a list of configuration options.

Protected Types

typedef std::map< std::string,
std::string > 
Options
typedef std::list
< ConfigurationObject * > 
ConfigurationList

Protected Member Functions

virtual void initFromXML (xmlNodePtr node)
virtual void writeToXML (xmlTextWriterPtr writer)
void deleteList (const std::string &name)

Protected Attributes

Options mOptions
std::map< std::string,
ConfigurationList
mContainerOptions

Friends

class Configuration

Member Typedef Documentation

typedef std::map<std::string, std::string> ConfigurationObject::Options [protected]

Definition at line 173 of file configuration.h.

Definition at line 176 of file configuration.h.


Constructor & Destructor Documentation

ConfigurationObject::~ConfigurationObject (  )  [virtual]

Definition at line 94 of file configuration.cpp.


Member Function Documentation

void ConfigurationObject::setValue ( const std::string &  key,
const std::string &  value 
) [virtual]

Sets an option using a string value.

Parameters:
key Option identifier.
value Value.

Reimplemented in Configuration.

Definition at line 29 of file configuration.cpp.

std::string ConfigurationObject::getValue ( const std::string &  key,
const std::string &  deflt 
) const

Gets a value as string.

Parameters:
key Option identifier.
deflt Default option if not there or error.

Definition at line 50 of file configuration.cpp.

int ConfigurationObject::getValue ( const std::string &  key,
int  deflt 
) const

Definition at line 57 of file configuration.cpp.

unsigned ConfigurationObject::getValue ( const std::string &  key,
unsigned  deflt 
) const

Definition at line 63 of file configuration.cpp.

double ConfigurationObject::getValue ( const std::string &  key,
double  deflt 
) const

Definition at line 70 of file configuration.cpp.

void ConfigurationObject::clear (  )  [virtual]

Re-sets all data in the configuration.

Definition at line 86 of file configuration.cpp.

template<class IT, class T, class CONT>
void ConfigurationObject::setList ( const std::string &  name,
IT  begin,
IT  end,
ConfigurationListManager< T, CONT > *  manager 
) [inline]

Serialises a container into a list of configuration options.

Parameters:
IT Iterator type over CONT
T Elements that IT iterates over
CONT The associated container type
name Name of the list the elements should be stored under
begin Iterator start
end Iterator end
manager An object capable of serialising T items

Definition at line 124 of file configuration.h.

template<class T, class CONT>
CONT ConfigurationObject::getList ( const std::string &  name,
CONT  empty,
ConfigurationListManager< T, CONT > *  manager 
) [inline]

Serialises a container into a list of configuration options.

Parameters:
IT Iterator type over CONT
T Elements that IT iterates over
CONT The associated container type
name Name of the list the elements should be read from under
empty Initial (empty) container to write to
manager An object capable of deserialising items into CONT

Definition at line 156 of file configuration.h.

void ConfigurationObject::initFromXML ( xmlNodePtr  node  )  [protected, virtual]

Definition at line 99 of file configuration.cpp.

void ConfigurationObject::writeToXML ( xmlTextWriterPtr  writer  )  [protected, virtual]

Definition at line 164 of file configuration.cpp.

void ConfigurationObject::deleteList ( const std::string &  name  )  [protected]

Definition at line 77 of file configuration.cpp.


Friends And Related Function Documentation

friend class Configuration [friend]

Definition at line 77 of file configuration.h.


Member Data Documentation

Definition at line 174 of file configuration.h.

std::map<std::string, ConfigurationList> ConfigurationObject::mContainerOptions [protected]

Definition at line 177 of file configuration.h.


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

Generated on Sun Apr 26 17:30:43 2009 for The Mana World by  doxygen 1.5.5