#include <tinycfg.h>
Inheritance diagram for Config:


This object saves and restores variables or arrays of basic types to XML file. There are possibilities to write all primitive data types:
You can write all these data types as ordinary variable or as an array of of one. I.e. you can write entire array of doubles within one line!
config->WriteDoubleArray("an_array", array_of_doubles, sizeof(array_of_doubles)/sizeof(double) );
One big plus of this implementation is that uses 'namespaces' or 'domain' to save one variable name from other to colide:
bool foo = true; config->WriteBool("foo", foo); foo = false; config->WriteBool("foo", foo, "foo.bar"); generated file: <?xml version="1.0" standalone="no" ?> <tinycfg> <bool name="foo" val="true" /> <foo> <bar> <bool name="foo" val="false" /> </bar> </foo> </tinycfg>
Public Member Functions | |
| Config (bool write=true) | |
| Config (char *, bool write=true) | |
| virtual | ~Config () |
| bool | IsValid (void) |
| virtual bool | Load (char *fname) |
| virtual bool | Save (void) |
| virtual bool | ReadBool (char *name, bool &data, const char *domain=0) |
| virtual bool | ReadInt (char *name, int &data, const char *domain=0) |
| virtual bool | ReadString (char *name, char *data, int max, const char *domain=0) |
| virtual bool | ReadDouble (char *name, double &data, const char *domain=0) |
| virtual bool | ReadHex (char *name, char *data, int length_of_item, const char *domain=0) |
| virtual bool | ReadBoolArray (char *name, bool data[], int range, const char *domain=0) |
| virtual bool | ReadIntArray (char *name, int data[], int range, const char *domain=0) |
| virtual bool | ReadStringArray (char *name, char *data[], int max, int range, const char *domain=0) |
| virtual bool | ReadDoubleArray (char *name, double data[], int range, const char *domain=0) |
| virtual bool | ReadHexArray (char *name, char *data[], int length_of_item, int range, const char *domain=0) |
| virtual void | WriteBool (char *name, bool data, const char *domain=0) |
| virtual void | WriteInt (char *name, int data, const char *domain=0) |
| virtual void | WriteString (char *name, char *data, const char *domain=0) |
| virtual void | WriteDouble (char *name, double data, const char *domain=0) |
| virtual void | WriteHex (char *name, char *data, int length_of_item, const char *domain=0) |
| virtual void | WriteBoolArray (char *name, bool data[], int range, const char *domain=0) |
| virtual void | WriteIntArray (char *name, int data[], int range, const char *domain=0) |
| virtual void | WriteStringArray (char *name, char *data[], int range, const char *domain=0) |
| virtual void | WriteDoubleArray (char *name, double data[], int range, const char *domain=0) |
| virtual void | WriteHexArray (char *name, char *data[], int length_of_item, int range, const char *domain=0) |
|
|
Creates the new and empty config object.
|
|
||||||||||||
|
Creates and loads the config object from the file.
|
|
|
Destruct object. The object will be saved if is 'writable' and state is 'changed'. |
|
|
|
|
|
Loads object from the file.
Implements ConfigInterface. |
|
||||||||||||||||
|
Reads an boolean variable from the config file.
Implements ConfigInterface. |
|
||||||||||||||||||||
|
Reads an array of boolean from the config file.
Implements ConfigInterface. |
|
||||||||||||||||
|
Reads a double variable from the config file.
Implements ConfigInterface. |
|
||||||||||||||||||||
|
Reads an array of double from the config file.
Implements ConfigInterface. |
|
||||||||||||||||||||
|
Reads a block of binary data from the config file.
Implements ConfigInterface. |
|
||||||||||||||||||||||||
|
Reads an array of binary items from the config file.
Implements ConfigInterface. |
|
||||||||||||||||
|
Reads an integer variable from the config file.
Implements ConfigInterface. |
|
||||||||||||||||||||
|
Reads an array of integer from the config file.
Implements ConfigInterface. |
|
||||||||||||||||||||
|
Reads a string variable from the config file.
Implements ConfigInterface. |
|
||||||||||||||||||||||||
|
Reads an array of char* from the config file.
Implements ConfigInterface. |
|
|
Saves the object if is 'writable' and state is 'changed'.
Implements ConfigInterface. |
|
||||||||||||||||
|
Writes an item of type boolean with the 'name' to the config object (to save to the file use Config::Save() )
Implements ConfigInterface. |
|
||||||||||||||||||||
|
Writes an array of boolean type with name and range.
Implements ConfigInterface. |
|
||||||||||||||||
|
Writes an item of type 'double' with the 'name' to the config object (to save to the file use Config::Save() )
Implements ConfigInterface. |
|
||||||||||||||||||||
|
Writes an array of double type with name and range.
Implements ConfigInterface. |
|
||||||||||||||||||||
|
Writes an item of type 'char *' with the 'name' to the config object (to save to the file use Config::Save() ). This saves memory contents as HEXADECIMAL string. Bytes 00ff00 will be writed as "00FF00" ascii string.
Implements ConfigInterface. |
|
||||||||||||||||||||||||
|
Writes an array of char* as binary data type with name and range.
Implements ConfigInterface. |
|
||||||||||||||||
|
Writes an item of type 'int' with the 'name' to the config object (to save to the file use Config::Save() )
Implements ConfigInterface. |
|
||||||||||||||||||||
|
Writes an array of integer type with name and range.
Implements ConfigInterface. |
|
||||||||||||||||
|
Writes an item of type 'char *' with the 'name' to the config object (to save to the file use Config::Save() )
Implements ConfigInterface. |
|
||||||||||||||||||||
|
Writes an array of char* type with name and range.
Implements ConfigInterface. |
1.4.0