Configuration Class Reference

#include <configuration.h>

Inheritance diagram for Configuration:

ConfigurationObject

List of all members.


Detailed Description

Configuration handler for reading (and writing).

Definition at line 185 of file configuration.h.


Public Member Functions

virtual ~Configuration ()
void init (const std::string &filename)
 Reads config file and parse all options into memory.
void write ()
 Writes the current settings back to the config file.
void addListener (const std::string &key, ConfigListener *listener)
 Adds a listener to the listen list of the specified config option.
void removeListener (const std::string &key, ConfigListener *listener)
 Removes a listener from the listen list of the specified config option.
void setValue (const std::string &key, const std::string &value)
 Sets an option using a string value.
void setValue (const std::string &key, float value)
void setValue (const std::string &key, double value)
void setValue (const std::string &key, int value)
void setValue (const std::string &key, unsigned value)
void setValue (const std::string &key, bool value)

Private Types

typedef std::list
< ConfigListener * > 
Listeners
typedef Listeners::iterator ListenerIterator
typedef std::map< std::string,
Listeners
ListenerMap
typedef ListenerMap::iterator ListenerMapIterator

Private Attributes

ListenerMap mListenerMap
std::string mConfigPath
 Location of config file.

Member Typedef Documentation

typedef std::list<ConfigListener*> Configuration::Listeners [private]

Definition at line 231 of file configuration.h.

typedef Listeners::iterator Configuration::ListenerIterator [private]

Definition at line 232 of file configuration.h.

typedef std::map<std::string, Listeners> Configuration::ListenerMap [private]

Definition at line 233 of file configuration.h.

typedef ListenerMap::iterator Configuration::ListenerMapIterator [private]

Definition at line 234 of file configuration.h.


Constructor & Destructor Documentation

virtual Configuration::~Configuration (  )  [inline, virtual]

Definition at line 188 of file configuration.h.


Member Function Documentation

void Configuration::init ( const std::string &  filename  ) 

Reads config file and parse all options into memory.

Parameters:
filename path to config file

Definition at line 134 of file configuration.cpp.

void Configuration::write (  ) 

Writes the current settings back to the config file.

Definition at line 197 of file configuration.cpp.

void Configuration::addListener ( const std::string &  key,
ConfigListener listener 
)

Adds a listener to the listen list of the specified config option.

Definition at line 229 of file configuration.cpp.

void Configuration::removeListener ( const std::string &  key,
ConfigListener listener 
)

Removes a listener from the listen list of the specified config option.

Definition at line 235 of file configuration.cpp.

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

Sets an option using a string value.

Parameters:
key Option identifier.
value Value.

Reimplemented from ConfigurationObject.

Definition at line 35 of file configuration.cpp.

void Configuration::setValue ( const std::string &  key,
float  value 
) [inline]

Definition at line 215 of file configuration.h.

void Configuration::setValue ( const std::string &  key,
double  value 
) [inline]

Definition at line 218 of file configuration.h.

void Configuration::setValue ( const std::string &  key,
int  value 
) [inline]

Definition at line 221 of file configuration.h.

void Configuration::setValue ( const std::string &  key,
unsigned  value 
) [inline]

Definition at line 224 of file configuration.h.

void Configuration::setValue ( const std::string &  key,
bool  value 
) [inline]

Definition at line 227 of file configuration.h.


Member Data Documentation

Definition at line 235 of file configuration.h.

std::string Configuration::mConfigPath [private]

Location of config file.

Definition at line 237 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