DSConfigFile



Member Functions

DSConfigFile

	public:

DSConfigFile();

Create an empty ConfigFile.


close

	public:

void close();

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);

Delete a value from the ConfigFile

Parameters

NameDescription
sectionSpecify the section the value is located in.
keySpecify the key corresponding to the value.

forEach

	public:

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

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

Parameters

NameDescription
sectionSpecifies the section to be iterated through. This can be NULL, in which case the sections themselves are iterated through.
callbackSpecifies 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
extraA 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);

Retrieve a pointer to the data inside the ConfigFile.

Parameters

NameDescription
sectionSpecifies the section that the data is located in.
keySpecifies the key that is being searched for.
defSpecifies the default value to return, if no match is found.
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);

Retrieve the data inside the ConfigFile.

Parameters

NameDescription
sectionSpecifies the section that the data is located in.
keySpecifies the key that is being searched for.
defSpecifies the default value to return, if no match is found.
Result: The numeric data, or def.

isValue

	public:

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

Determine if a value is in the ConfigFile.

Parameters

NameDescription
sectionSpecify the section the value is located in.
keySpecify the key corresponding to the value.
Result: Returns the number of instances of the value in the ConfigFile.

loadFile

	public:

int loadFile(const char * filename);

Load data from a file into this ConfigFile.

Parameters

NameDescription
filenamePath to a file in which the data is located.
Result: Returns nonzero to indicate success, zero indicates failure.

saveFile

	public:

int saveFile(const char * filename);

Save data from this ConfigFile into a file.

Parameters

NameDescription
filenamePath to a file in which the data is to be stored.
Result: Returns nonzero to indicate success, zero indicates failure.

setValue

	public:

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

Set a value in the ConfigFile.

Parameters

NameDescription
sectionSpecify the section the value is located in.
keySpecify 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.
valueSpecify 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();

Destroy a ConfigFile.


Generated with HeaderDoc - © 2000 Apple Computer, Inc. — (Last Updated 5/10/2004)