Interface to the application config files.
This class allows client code to generate, modify and query configuration files. Config files will be automatically created when needed. They will be located in the [APPLICATION]/bin/config folder or an explicitely specified folder depending on the constructor used.
Definition at line 63 of file fbconfigfile.h.
#include <fbconfigfile.h>
Public Member Functions |
|
FBConfigFile (const char *pConfigFileName, bool pVirtualMode=false) | |
Constructor. |
|
FBConfigFile (const char *pConfigFileName, const char *pConfigFilePath) | |
Constructor. |
|
~FBConfigFile () | |
Destructor. |
|
bool | Set (const char *pSectionName, const char *pItemName, const char *pValue, const char *pComment=0) |
Set an item's value. |
|
const char * | Get (const char *pSectionName, const char *pItemName, const char *pDefaultValue=0) |
Get an item's value. |
|
bool | GetOrSet (const char *pSectionName, const char *pItemName, const char *&pValue, const char *pComment=0) |
Get a value from the config file and set it
if it was not found. |
|
void | ClearFile () |
Remove all content from the config file.
|
FBConfigFile | ( | const char * | pConfigFileName, |
bool | pVirtualMode =
false |
||
) |
Constructor.
This will open the desired config file from the [APPLICATION]/bin/config folder. The file will be created if it does not exists. By prefixing the character '@' to the file name, this will automatically prepend the current machine name to the config file, the way it is done for the other config files of the application.
pConfigFileName | Name the config file to use. |
pVirtualMode | Enable this to limit disk access, file will only be read at construction and written at destruction. |
FBConfigFile | ( | const char * | pConfigFileName, |
const char * | pConfigFilePath | ||
) |
Constructor.
This will open the desired config file in the designed folder. The file will be created if it does not exists. By prefixing the character '@' to the file name, this will automatically prepend the current machine name to the config file, the way it is done for the other config files of the application.
pConfigFileName | Name the config file to use. |
pConfigFilePath | Location where the file should reside. Missing directories will not be created. |
~FBConfigFile | ( | ) |
Destructor.
bool Set | ( | const char * | pSectionName, |
const char * | pItemName, | ||
const char * | pValue, | ||
const char * | pComment = 0 |
||
) |
Set an item's value.
Assign a value to an item in the config file. If the item does not exist, it will be created.
pSectionName | Name of the section. |
pItemName | Name of the item. |
pValue | Value assigned to the item. |
pComment | Optional parameter that can be used to add a comment. |
const char* Get | ( | const char * | pSectionName, |
const char * | pItemName, | ||
const char * | pDefaultValue =
0 |
||
) |
Get an item's value.
Get an item's value by looking inside a specific section of the config file.
pSectionName | Name of the section. |
pItemName | Name of the item. |
pDefaultValue | Default value that will be returned if the item is not found. |
bool GetOrSet | ( | const char * | pSectionName, |
const char * | pItemName, | ||
const char *& | pValue, | ||
const char * | pComment = 0 |
||
) |
Get a value from the config file and set it if it was not found.
pSectionName | Name of the section. |
pItemName | Name of the item. |
pValue | Reference the the string that will contain the value of the item. If the item is not found in the file, it will be added with the initial value in this string. |
pComment | Optional parameter that can be used to add a comment. |
void ClearFile | ( | ) |
Remove all content from the config file.