public:
DSConfigFile();
Create an empty ConfigFile.
public:
void close();
Purge all the data from the ConfigFile, but keep the ConfigFile itself available for subsequent uses.
public:
void delValue(const char * section, const char * key);
Delete a value from the ConfigFile
Name Description section Specify the section the value is located in. key Specify the key corresponding to the value.
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.
Name Description 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.
public:
char * getValue(const char * section, const char * key, char * def=NULL);
Retrieve a pointer to the data inside the ConfigFile.
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.
Name Description 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.
public:
unsigned int getValueInt(const char * section, const char * key, unsigned int def=0);
Retrieve the data inside the ConfigFile.
Result: The numeric data, or def.
Name Description 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.
public:
int isValue(const char * section, const char * key);
Determine if a value is in the ConfigFile.
Result: Returns the number of instances of the value in the ConfigFile.
Name Description section Specify the section the value is located in. key Specify the key corresponding to the value.
public:
int loadFile(const char * filename);
Load data from a file into this ConfigFile.
Result: Returns nonzero to indicate success, zero indicates failure.
Name Description filename Path to a file in which the data is located.
public:
int saveFile(const char * filename);
Save data from this ConfigFile into a file.
Result: Returns nonzero to indicate success, zero indicates failure.
Name Description filename Path to a file in which the data is to be stored.
public:
void setValue(const char * section, char * key, char * value);
Set a value in the ConfigFile.
Name Description 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.
public:
~DSConfigFile();
Destroy a ConfigFile.
Generated with HeaderDoc - © 2000 Apple Computer, Inc. (Last Updated 9/29/2003)