Configuration Class Reference

#include <configuration.h>

List of all members.


Detailed Description

INI configuration handler for reading (and writing).

Definition at line 58 of file configuration.h.

Public Member Functions

void init (const std::string &filename)
 Reads INI file and parse all options into memory.
void write ()
 Writes the current settings back to an ini-file.
void setValue (const std::string &key, std::string value)
 Sets an option using a string value.
void setValue (const std::string &key, float value)
 Sets an option using a numeric value.
std::string getValue (const std::string &key, std::string deflt)
 Gets a value as string.
float getValue (const std::string &key, float deflt)
 Gets a value as numeric (float).
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.

Private Attributes

std::map< std::string, std::string > options
std::map< std::string, std::list<
ConfigListener * > > 
listeners
std::string configPath
 Location of config file.


Member Function Documentation

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

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

Definition at line 174 of file configuration.cpp.

float Configuration::getValue const std::string &  key,
float  deflt
 

Gets a value as numeric (float).

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

Definition at line 165 of file configuration.cpp.

std::string Configuration::getValue const std::string &  key,
std::string  deflt
 

Gets a value as string.

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

Definition at line 156 of file configuration.cpp.

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

Reads INI file and parse all options into memory.

Parameters:
filename Full path to INI file (~/.manaworld/tmw.ini)

Definition at line 44 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 180 of file configuration.cpp.

void Configuration::setValue const std::string &  key,
float  value
 

Sets an option using a numeric value.

Parameters:
key Option identifier.
value Value.

Definition at line 145 of file configuration.cpp.

void Configuration::setValue const std::string &  key,
std::string  value
 

Sets an option using a string value.

Parameters:
key Option identifier.
value Value.

Definition at line 124 of file configuration.cpp.

void Configuration::write  ) 
 

Writes the current settings back to an ini-file.

Parameters:
filename Full path to INI file (~/.manaworld/tmw.ini)

Definition at line 88 of file configuration.cpp.


Member Data Documentation

std::string Configuration::configPath [private]
 

Location of config file.

Definition at line 116 of file configuration.h.

std::map<std::string, std::list<ConfigListener*> > Configuration::listeners [private]
 

Definition at line 114 of file configuration.h.

std::map<std::string, std::string> Configuration::options [private]
 

Definition at line 113 of file configuration.h.


The documentation for this class was generated from the following files:
Generated on Fri Mar 30 15:39:18 2007 for TMW Server by  doxygen 1.3.9.1