|
|
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 |
[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:
key | the key to add the value by |
value | the 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:
key | the 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:
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.
Throws: Exception
bool
addLine ( const char * line )
throw ( Exception ) | addLine |
[virtual]
Add a line of configuration information.
Parameters:
line | the line to add. |
Returns: true if a new key was added, false otherwise.
Throws: Exception