class Configuration

Configuration file handling. More...

Full nameTelEngine::Configuration
Definition#include <yatengine.h>
InheritsTelEngine::String [public ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods


Detailed Description

A class for parsing and quickly accessing INI style configuration files

 Configuration ()

Configuration

Create an empty configuration

 Configuration (const char* filename)

Configuration

Create a configuration from a file

Parameters:
filenameName of file to initialize from

inline Configuration&  operator= (const String& value)

operator=

Assignment from string operator

Reimplemented from String.

inline unsigned int  sections ()

sections

[const]

Get the number of sections

Returns: Count of sections

NamedList*  getSection (unsigned int index)

getSection

[const]

Retrive an entire section

Parameters:
indexIndex of the section

Returns: The section's content or NULL if no such section

NamedList*  getSection (const String& sect)

getSection

[const]

Retrive an entire section

Parameters:
sectName of the section

Returns: The section's content or NULL if no such section

NamedString*  getKey (const String& sect, const String& key)

getKey

[const]

Locate a key/value pair in the section.

Parameters:
sectName of the section
keyName of the key in section

Returns: A pointer to the key/value pair or NULL.

const char*  getValue (const String& sect, const String& key, const char* defvalue = 0)

getValue

[const]

Retrive the value of a key in a section.

Parameters:
sectName of the section
keyName of the key in section
defvalueDefault value to return if not found

Returns: The string contained in the key or the default

int  getIntValue (const String& sect, const String& key, int defvalue = 0)

getIntValue

[const]

Retrive the numeric value of a key in a section.

Parameters:
sectName of the section
keyName of the key in section
defvalueDefault value to return if not found

Returns: The number contained in the key or the default

int  getIntValue (const String& sect, const String& key, const TokenDict* tokens, int defvalue = 0)

getIntValue

[const]

Retrive the numeric value of a key in a section trying first a table lookup.

Parameters:
sectName of the section
keyName of the key in section
tokensA pointer to an array of tokens to try to lookup
defvalueDefault value to return if not found

Returns: The number contained in the key or the default

double  getDoubleValue (const String& sect, const String& key, double defvalue = 0.0)

getDoubleValue

[const]

Retrive the floating point value of a key in a section.

Parameters:
sectName of the section
keyName of the key in section
defvalueDefault value to return if not found

Returns: The numeric value contained in the key or the default

bool  getBoolValue (const String& sect, const String& key, bool defvalue = false)

getBoolValue

[const]

Retrive the boolean value of a key in a section.

Parameters:
sectName of the section
keyName of the key in section
defvalueDefault value to return if not found

Returns: The boolean value contained in the key or the default

void  clearSection (const char* sect = 0)

clearSection

Deletes an entire section

Parameters:
sectName of section to delete, NULL to delete all

inline void  createSection (const String& sect)

createSection

Makes sure a section with a given name exists, creates if required

Parameters:
sectName of section to check or create

void  clearKey (const String& sect, const String& key)

clearKey

Deletes a key/value pair

Parameters:
sectName of section
keyName of the key to delete

void  addValue (const String& sect, const char* key, const char* value = 0)

addValue

Add the value of a key in a section.

Parameters:
sectName of the section, will be created if missing
keyName of the key to add in the section
valueValue to set in the key

void  setValue (const String& sect, const char* key, const char* value = 0)

setValue

Set the value of a key in a section.

Parameters:
sectName of the section, will be created if missing
keyName of the key in section, will be created if missing
valueValue to set in the key

void  setValue (const String& sect, const char* key, int value)

setValue

Set the numeric value of a key in a section.

Parameters:
sectName of the section, will be created if missing
keyName of the key in section, will be created if missing
valueValue to set in the key

void  setValue (const String& sect, const char* key, bool value)

setValue

Set the boolean value of a key in a section.

Parameters:
sectName of the section, will be created if missing
keyName of the key in section, will be created if missing
valueValue to set in the key

bool  load ()

load

Load the configuration from file

Returns: True if successfull, false for failure

bool  save ()

save

[const]

Save the configuration to file

Returns: True if successfull, false for failure


Generated by: root on dragoshel on Sat Apr 14 01:50:50 2007, using kdoc 2.0a54.