class ConfigSection

A configuration file representation. More...

Definition#include <ConfigSection.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:


  # this is a whole line comment
  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::map TableType

TableType

[private]

Type of the hash table used in this class.

TableType table

table

[private]

inline  ConfigSection ( void )
throw ( Exception )

ConfigSection

Default constructor.

Throws: Exception

inline  ~ConfigSection ( void )
throw ( Exception )

~ConfigSection

[virtual]

Destructor.

Throws: Exception

bool  add ( const char * key, const char * value )
throw ( Exception )

add

[virtual]

Add a key / value pair to the configuration information.

Parameters:
keythe key to add the value by
valuethe value to add for the key

Returns: true if adding was successful, false otherwise

Throws: Exception

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

get

[const virtual]

Get a value for a key.

Parameters:
keythe key to get the value for

Returns: the value for the key, or NULL if the key doesn't exist.

Throws: Exception

const char *  getForSure ( const char * key, const char * message1 = 0, const char * message2 = 0, int code = 0 )
throw ( Exception )

getForSure

[const virtual]

Get a value for a key, or throw an Exception.

Parameters:
keythe key to get the value for
message1message part 1 of the Exception to be thrown.
message2message part 2 of the Exception to be thrown.
codeerror code of the Exception to be thrown.

Returns: the value for the key. The return value is never NULL.

Throws: Exception

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

addLine

[virtual]

Add a line of configuration information.

Parameters:
linethe line to add.

Returns: true if a new key was added, false otherwise.

Throws: Exception