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

Config Class Reference

#include <DarkIceConfig.h>

Inheritance diagram for Config:

Inheritance graph
[legend]
Collaboration diagram for Config:

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

Author:
Author
darkeye
Version:
Revision
1.2

Definition at line 79 of file DarkIceConfig.h.

Public Member Functions

 Config (void) throw ( Exception )
 Default constructor.
 Config (std::istream &is) throw ( Exception )
 Constructor based on an input stream.
virtual ~Config (void) throw ( Exception )
 Destructor.
virtual void reset (void) throw ( Exception )
 Delete the configuration information stored in the object.
virtual bool addLine (const char *line) throw ( Exception )
 Read a line of confiugration information.
virtual void read (std::istream &is) throw ( Exception )
 Read a line of confiugration information.
virtual const ConfigSectionget (const char *key) const throw ( Exception )
 Get a ConfigSection by name.


Constructor & Destructor Documentation

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

Default constructor.

Exceptions:
Exception 

Definition at line 114 of file DarkIceConfig.h.

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

Constructor based on an input stream.

Parameters:
is configuration will be read from this input stream until end of stream is reached.
Exceptions:
Exception 

Definition at line 126 of file DarkIceConfig.h.

References read().

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

Destructor.

Exceptions:
Exception 

Definition at line 137 of file DarkIceConfig.h.


Member Function Documentation

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

Read a line of confiugration information.

Parameters:
line the line to read.
Returns:
true if the line was correct, false otherwise.
Exceptions:
Exception 

Definition at line 94 of file DarkIceConfig.cpp.

References ConfigSection::addLine(), and WHITE_SPACE_STR.

Referenced by read().

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

Get a ConfigSection by name.

Parameters:
key the name of the ConfigSection
Returns:
the ConfigSection requested, or NULL if it doesn't exists.
Exceptions:
Exception 

Definition at line 76 of file DarkIceConfig.cpp.

void Config::read std::istream &  is  )  throw ( Exception ) [virtual]
 

Read a line of confiugration information.

Parameters:
is the input stream to read from
Returns:
true if the line was correct, false otherwise.
Exceptions:
Exception 

Definition at line 149 of file DarkIceConfig.cpp.

References addLine(), and LINE_SIZE.

Referenced by Config().

virtual void Config::reset void   )  throw ( Exception ) [inline, virtual]
 

Delete the configuration information stored in the object.

Resets the object to a clean state.

Exceptions:
Exception 

Definition at line 163 of file DarkIceConfig.h.


The documentation for this class was generated from the following files:
Generated on Thu Apr 14 13:59:13 2005 for DarkIce by  doxygen 1.4.1