class Config

A configuration file representation. More...

Definition#include <Config.h>
InheritsReferable [public virtual ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods

Private Types

Private Members


Detailed Description

A configuration file representation. The file is of the syntax:


  [section1]
  # this is a whole line comment
  key = value
  an ugly key name = long value    # this end is a comment too

  [section2]
  # this is a whole line comment in section 2
  key = value
  an ugly key name = long value    # this end is a comment too

also empty lines are ignored and all white space is removed from the front and end of keys / values

Knwon problem: you can't use '#' in any part of a key / value pair

typedef std::mapConfigSection> TableType

TableType

[private]

Type declaration of the hash table type.

TableType table

table

[private]

std::string currentSection

currentSection

[private]

inline  Config ( void )
throw ( Exception )

Config

Default constructor.

Throws: Exception

inline  Config ( std::istream & is )
throw ( Exception )

Config

Constructor based on an input stream.

Parameters:
isconfiguration will be read from this input stream until end of stream is reached.

Throws: Exception

inline  ~Config ( void )
throw ( Exception )

~Config

[virtual]

Destructor.

Throws: Exception

inline void  reset ( void )
throw ( Exception )

reset

[virtual]

Delete the configuration information stored in the object. Resets the object to a clean state.

Throws: Exception

bool  addLine ( const char * line )
throw ( Exception )

addLine

[virtual]

Read a line of confiugration information.

Parameters:
linethe line to read.

Returns: true if the line was correct, false otherwise.

Throws: Exception

void  read ( std::istream & is )
throw ( Exception )

read

[virtual]

Read a line of confiugration information.

Parameters:
linethe line to read.

Returns: true if the line was correct, false otherwise.

Throws: Exception

const ConfigSection *  get ( const char * key )
throw ( Exception )

get

[const virtual]

Get a ConfigSection by name.

Parameters:
keythe name of the ConfigSection

Returns: the ConfigSection requested, or NULL if it doesn't exists.

Throws: Exception