Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

XFuConfiguration Class Reference

Configuration container. More...

#include <XFuConfiguration.h>

Inheritance diagram for XFuConfiguration:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 XFuConfiguration ()
 Constructor.

virtual ~XFuConfiguration ()
 Destructor.

virtual CHAR * get (const CHAR *aKey)
 Returns the value of the property (NULL if none).

virtual INT32 getINT32 (const CHAR *aKey)
 Returns the value of a property as an INT32, or 0 if not found.

virtual FLOAT32 getFLOAT32 (const CHAR *aKey)
 Returns the value of a property as a FLOAT32, or 0 if not found.

virtual void put (const CHAR *aKey, const CHAR *aValue)
 Sets the value of a property.

virtual void clear ()
 Clears the current properties.

virtual INT load (const CHAR *aFilename)
 Loads new configuration file and merges its data to the current set.

virtual INT load (XFcFile *aFile)
 Loads new configuration file and merges its data to the current set.


Static Public Member Functions

XFuConfiguration * create ()
 Static constructor.

XFuConfiguration * create (const CHAR *aFilename)
 Static constructor.

XFuConfiguration * create (XFcFile *aFile)
 Static constructor.


Protected Member Functions

virtual void processLine (const CHAR *aStr)
 Parses a line of the config file.

CHAR8 * readLine (XFcFile *aFile)
 Reads a line from a file.

CHAR * strDupTrim (const CHAR *aStr)
 Returns a new string where the leading and trailing spaces are removed.


Protected Attributes

XFcHashtable< XFuStringKey,
void * > * 
mProperties
 Properties hashtable.


Detailed Description

Configuration container.

Reads and parses a set of configuration keys from a file. The format of the configuration file is such that there is one property on each row in a text file. Each property is a pair of a key and a value, delimited by a '=' char, for example: fileName=HelloWorld.xff. Leading and trailing spaces are trimmed. Lines starting with character '#' are treated as comment lines and are ignored.

Definition at line 30 of file XFuConfiguration.h.


Constructor & Destructor Documentation

XFuConfiguration::XFuConfiguration  
 

Constructor.

Definition at line 53 of file XFuConfiguration.cpp.

XFuConfiguration::~XFuConfiguration   [virtual]
 

Destructor.

Definition at line 58 of file XFuConfiguration.cpp.

References clear().


Member Function Documentation

void XFuConfiguration::clear   [virtual]
 

Clears the current properties.

Definition at line 106 of file XFuConfiguration.cpp.

References mProperties.

Referenced by ~XFuConfiguration(), and XFuConfigurationData::~XFuConfigurationData().

XFuConfiguration * XFuConfiguration::create XFcFile *    aFile [static]
 

Static constructor.

Parameters:
aFile open file pointing to configuration data to load.
Returns:
new configuration data object if successful, or NULL if unsuccessful.
Note:
Configuration data is assumed to continue to end of the file.

Reimplemented in XFuConfigurationData.

Definition at line 38 of file XFuConfiguration.cpp.

References load().

XFuConfiguration * XFuConfiguration::create const CHAR *    aFilename [static]
 

Static constructor.

Parameters:
aFilename filename of configuration data to load.
Returns:
new configuration data object if successful, or NULL if unsuccessful.

Reimplemented in XFuConfigurationData.

Definition at line 23 of file XFuConfiguration.cpp.

References load().

XFuConfiguration * XFuConfiguration::create   [static]
 

Static constructor.

Returns:
new configuration data object if successful, or NULL if unsuccessful.

Reimplemented in XFuConfigurationData.

Definition at line 17 of file XFuConfiguration.cpp.

CHAR * XFuConfiguration::get const CHAR *    aKey [virtual]
 

Returns the value of the property (NULL if none).

Reimplemented in XFuConfigurationData.

Definition at line 64 of file XFuConfiguration.cpp.

References mProperties.

Referenced by XFuConfigurationData::get(), getFLOAT32(), getINT32(), and put().

FLOAT32 XFuConfiguration::getFLOAT32 const CHAR *    aKey [virtual]
 

Returns the value of a property as a FLOAT32, or 0 if not found.

Definition at line 82 of file XFuConfiguration.cpp.

References get().

INT32 XFuConfiguration::getINT32 const CHAR *    aKey [virtual]
 

Returns the value of a property as an INT32, or 0 if not found.

Definition at line 72 of file XFuConfiguration.cpp.

References get().

INT XFuConfiguration::load XFcFile *    aFile [virtual]
 

Loads new configuration file and merges its data to the current set.

Parameters:
aFile open file pointing to the configuration data to load.
Returns:
1 if successful, 0 if unsuccessful (e.g. file not found).
Note:
Configuration data is assumed to continue to end of the file.

Reimplemented in XFuConfigurationData.

Definition at line 119 of file XFuConfiguration.cpp.

References mProperties, processLine(), readLine(), and strDupTrim().

INT XFuConfiguration::load const CHAR *    aFilename [virtual]
 

Loads new configuration file and merges its data to the current set.

Parameters:
aFilename filename of the configuration data file to load.
Returns:
1 if successful, 0 if unsuccessful (e.g. file not found).

Reimplemented in XFuConfigurationData.

Definition at line 155 of file XFuConfiguration.cpp.

Referenced by create(), and XFuConfigurationData::load().

void XFuConfiguration::processLine const CHAR *    aStr [protected, virtual]
 

Parses a line of the config file.

Extracts the property key and value from it and adds these to the property hashtable.

Definition at line 169 of file XFuConfiguration.cpp.

References put().

Referenced by load().

void XFuConfiguration::put const CHAR *    aKey,
const CHAR *    aValue
[virtual]
 

Sets the value of a property.

Reimplemented in XFuConfigurationData.

Definition at line 92 of file XFuConfiguration.cpp.

References get(), and mProperties.

Referenced by processLine(), and XFuConfigurationData::put().

CHAR8 * XFuConfiguration::readLine XFcFile *    aFile [protected]
 

Reads a line from a file.

Definition at line 247 of file XFuConfiguration.cpp.

Referenced by load().

CHAR * XFuConfiguration::strDupTrim const CHAR *    aStr [protected]
 

Returns a new string where the leading and trailing spaces are removed.

Definition at line 213 of file XFuConfiguration.cpp.

Referenced by load().


Member Data Documentation

XFcHashtable<XFuStringKey, void *>* XFuConfiguration::mProperties [protected]
 

Properties hashtable.

Definition at line 101 of file XFuConfiguration.h.

Referenced by clear(), get(), load(), and put().


The documentation for this class was generated from the following files:
   
X-Forge Documentation
Confidential
Copyright © 2002-2003 Fathammer
   
Documentation generated
with doxygen
by Dimitri van Heesch