Functions



DSConfigFile


public:

DSConfigFile (void);
Discussion

Create an empty ConfigFile.


close


public:

void close (void);
Discussion

Purge all the data from the ConfigFile, but keep the ConfigFile itself available for subsequent uses.


delValue


public:

void delValue (     const char * section,     const char * key );
Discussion

Delete a value from the ConfigFile

Parameter Descriptions
section
Specify the section the value is located in.
key
Specify the key corresponding to the value.

forEach


public:

void forEach (     char * section,     void (*callback ) (     char *,     char *,     void *),     void * extra );
Discussion

Iterate through a section on the ConfigFile, and call a function for each entry found.

Parameter Descriptions
section
Specifies the section to be iterated through. This can be NULL, in which case the sections themselves are iterated through.
callback
Specifies the function to be called when an entry is found. This function will be passed the key and value, plus any extra data, described below
extra
A pointer to additional data which will be passed to the function specified above for each time an item is found.

getValue


public:

char * getValue (     const char * section,     const char * key,     char * def=NULL );
Discussion

Retrieve a pointer to the data inside the ConfigFile.

Parameter Descriptions
section
Specifies the section that the data is located in.
key
Specifies the key that is being searched for.
def
Specifies the default value to return, if no match is found.
function result
A pointer to the data, or def. Remember, this is a pointer, and can be used to tamper with the internals of the ConfigFile. Please be careful.

getValueInt


public:

unsigned int getValueInt (     const char * section,     const char * key,     unsigned int def=0 );
Discussion

Retrieve the data inside the ConfigFile.

Parameter Descriptions
section
Specifies the section that the data is located in.
key
Specifies the key that is being searched for.
def
Specifies the default value to return, if no match is found.
function result
The numeric data, or def.

isValue


public:

int isValue (     const char * section,     const char * key );
Discussion

Determine if a value is in the ConfigFile.

Parameter Descriptions
section
Specify the section the value is located in.
key
Specify the key corresponding to the value.
function result
Returns the number of instances of the value in the ConfigFile.

loadFile


public:

int loadFile (     const char * filename );
Discussion

Load data from a file into this ConfigFile.

Parameter Descriptions
filename
Path to a file in which the data is located.
function result
Returns nonzero to indicate success, zero indicates failure.

saveFile


public:

int saveFile (     const char * filename );
Discussion

Save data from this ConfigFile into a file.

Parameter Descriptions
filename
Path to a file in which the data is to be stored.
function result
Returns nonzero to indicate success, zero indicates failure.

setValue


public:

void setValue (     const char * section,     char * key,     char * value );
Discussion

Set a value in the ConfigFile.

Parameter Descriptions
section
Specify the section the value is located in.
key
Specify the key corresponding to the value. This parameter is used directly in the ConfigFile, not copied. It will be deleted when the ConfigFile is closed or destroyed. You should copy the data yourself prior to calling this function.
value
Specify the new value. This parameter is used directly in the ConfigFile, not copied. It will be deleted when the ConfigFile is closed or destroyed. You should copy the data yourself prior to calling this function.

~DSConfigFile


public:

~DSConfigFile (void);
Discussion

Destroy a ConfigFile.

(Last Updated 9/24/2004)