Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

ConfigSection Class Reference

#include <ConfigSection.h>

Inheritance diagram for ConfigSection:

Inheritance graph
[legend]
Collaboration diagram for ConfigSection:

Collaboration graph
[legend]
List of all 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

Author:
Author
darkeye
Version:
Revision
1.4

Definition at line 70 of file ConfigSection.h.

Public Member Functions

 ConfigSection (void) throw ( Exception )
 Default constructor.
virtual ~ConfigSection (void) throw ( Exception )
 Destructor.
virtual bool add (const char *key, const char *value) throw ( Exception )
 Add a key / value pair to the configuration information.
virtual const char * get (const char *key) const throw ( Exception )
 Get a value for a key.
virtual const char * getForSure (const char *key, const char *message1=0, const char *message2=0, int code=0) const throw ( Exception )
 Get a value for a key, or throw an Exception.
virtual bool addLine (const char *line) throw ( Exception )
 Add a line of configuration information.


Constructor & Destructor Documentation

ConfigSection::ConfigSection void   )  throw ( Exception ) [inline]
 

Default constructor.

Exceptions:
Exception 

Definition at line 96 of file ConfigSection.h.

virtual ConfigSection::~ConfigSection void   )  throw ( Exception ) [inline, virtual]
 

Destructor.

Exceptions:
Exception 

Definition at line 106 of file ConfigSection.h.


Member Function Documentation

bool ConfigSection::add const char *  key,
const char *  value
throw ( Exception ) [virtual]
 

Add a key / value pair to the configuration information.

Parameters:
key the key to add the value by
value the value to add for the key
Returns:
true if adding was successful, false otherwise
Exceptions:
Exception 

Definition at line 70 of file ConfigSection.cpp.

bool ConfigSection::addLine const char *  line  )  throw ( Exception ) [virtual]
 

Add a line of configuration information.

Parameters:
line the line to add.
Returns:
true if a new key was added, false otherwise.
Exceptions:
Exception 

Definition at line 128 of file ConfigSection.cpp.

References WHITE_SPACE_STR.

const char * ConfigSection::get const char *  key  )  const throw ( Exception ) [virtual]
 

Get a value for a key.

Parameters:
key the key to get the value for
Returns:
the value for the key, or NULL if the key doesn't exist.
Exceptions:
Exception 

Definition at line 90 of file ConfigSection.cpp.

const char * ConfigSection::getForSure const char *  key,
const char *  message1 = 0,
const char *  message2 = 0,
int  code = 0
const throw ( Exception ) [virtual]
 

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

Parameters:
key the key to get the value for
message1 message part 1 of the Exception to be thrown.
message2 message part 2 of the Exception to be thrown.
code error code of the Exception to be thrown.
Returns:
the value for the key. The return value is never NULL.
Exceptions:
Exception 

Definition at line 108 of file ConfigSection.cpp.


The documentation for this class was generated from the following files:
Generated on Fri May 19 15:36:49 2006 for DarkIce by  doxygen 1.4.4