#include <ZE_ZConfigFile.h>
Inherits ZE::ZObject.
Public Methods | |
ZConfigFile () | |
Default constructor. | |
ZConfigFile (string filename) | |
Constructor which takes filename. | |
~ZConfigFile () | |
Destructor, flushes file. | |
void | Process (string filename) |
Parse a file. | |
int | GetInt (string section, string var, int defVal) const |
Get value in integer format from file. | |
bool | GetBool (string section, string var, bool defVal) const |
Get value in boolean format from file. | |
string | GetString (string section, string var, string defVal) const |
Get value in string format from file. | |
void | SetInt (string section, string var, int val) |
Set value in integer format in file. | |
void | SetBool (string section, string var, bool val) |
Set value in boolean format in file. | |
void | SetString (string section, string var, string val) |
Set value in string format in file. | |
void | Flush () |
Write all values to file. | |
void | Close () |
Close the file. | |
Private Methods | |
string | CleanString (string str) const |
Reformat a string in a form more suitable to parsing. | |
bool | Exists (string sec) const |
Check if a section exists. | |
bool | Exists (string sec, string var) const |
Check if a variable exists. | |
void | SetVariable (string sec, string var, string val) |
Internal function to set variables. | |
string | GetVariable (string sec, string var, string defVal) const |
Internal function to get value of a variable. | |
Private Attributes | |
list< ZCF_Section > | mFileLayout |
List of sections of internal type. | |
string | mFilename |
Filename of file currently open. |
|
A no-op default constructor. |
|
Constructor takes filename, and calls process on it.
|
|
Flushes the file, ensures a flush if the file is left open. |
|
Removes whitespace from a string and makes all characters lowercase.
|
|
Find out if a section currently exists.
|
|
Find out if a variable currently exists.
|
|
Set variable to value, called internally only.
|
|
Get value of variable, called internally only.
|
|
Parses the file, reading the contents into the fileLayout map.
|
|
Get the current value of a variable in the file, or defVal if not found in file.
|
|
Get the current value of a variable in the file, or defVal if not found in file. (Valid values are "0","1","true" and "false")
|
|
Get the current value of a variable in the file, or defVal if not found in file.
|
|
Set the new value of a variable in the file to val, creating the section and variable if not already found in file.
|
|
Set the new value of a variable in the file to val, creating the section and variable if not already found in file.
|
|
Set the new value of a variable in the file to val, creating the section and variable if not already found in file.
|
|
Writes all values and sections to file. |
|
Flush the file and clear the filename. |