![]() |
CRM64Pro GDK
v0.94
A free cross-platform game development kit built on top of SDL 2.0
|
Classes | |
class | CRM64Pro::XMLObj |
class | CRM64Pro::XMLMgr |
Functions | |
Sint32 | CRM64Pro::XMLObj::info (Sint32 iMode=0) |
Sint32 | CRM64Pro::XMLObj::getName (string &sName) |
Uint32 | CRM64Pro::XMLObj::getID () |
Sint32 | CRM64Pro::XMLObj::nodePointTo (Sint32 iParam, char *szNodes,...) |
Sint32 | CRM64Pro::XMLObj::nodeFirst () |
Sint32 | CRM64Pro::XMLObj::nodeNext () |
Sint32 | CRM64Pro::XMLObj::nodePrev () |
Sint32 | CRM64Pro::XMLObj::nodeParent () |
Sint32 | CRM64Pro::XMLObj::nodeChild () |
Sint32 | CRM64Pro::XMLObj::nodeStore () |
Sint32 | CRM64Pro::XMLObj::nodeRestore () |
Sint32 | CRM64Pro::XMLObj::nodeRemove () |
Sint32 | CRM64Pro::XMLObj::nodeCreate (const string &sNode) |
Sint32 | CRM64Pro::XMLObj::nodeRename (const string &sNode) |
Sint32 | CRM64Pro::XMLObj::nodeGetName (string &sNode) |
Sint32 | CRM64Pro::XMLObj::setAttribute (const string &sAttr, const string &sValue) |
Sint32 | CRM64Pro::XMLObj::setAttribute (const string &sAttr, const Sint32 &iValue) |
Sint32 | CRM64Pro::XMLObj::setAttribute (const string &sAttr, const double &dValue) |
Sint32 | CRM64Pro::XMLObj::getAttribute (const string &sAttr, string &sValue) |
Sint32 | CRM64Pro::XMLObj::getAttribute (const string &sAttr, Sint32 &iValue) |
Sint32 | CRM64Pro::XMLObj::getAttribute (const string &sAttr, double &dValue) |
Sint32 | CRM64Pro::XMLObj::removeAttribute (const string &sAttr) |
Sint32 | CRM64Pro::XMLObj::setText (const string &sText) |
Sint32 | CRM64Pro::XMLObj::getText (string &sText) |
Sint32 | CRM64Pro::XMLObj::removeText () |
Sint32 | CRM64Pro::XMLObj::setComment (const string &sComment) |
Sint32 | CRM64Pro::XMLObj::getComment (string &sComment) |
Sint32 | CRM64Pro::XMLObj::removeComment () |
Sint32 | CRM64Pro::XMLObj::saveToFile (const string &sFile) |
Sint32 | CRM64Pro::XMLObj::save (const string &sFileCDC) |
Sint32 | CRM64Pro::XMLObj::save (Sint32 idCDC) |
Sint32 | CRM64Pro::XMLMgr::info (Sint32 idXML=0) |
Sint32 | CRM64Pro::XMLMgr::create (const string &sMainNode, Uint32 iUnused=0) |
Sint32 | CRM64Pro::XMLMgr::close (Sint32 idXML) |
Sint32 | CRM64Pro::XMLMgr::getNum () |
Sint32 | CRM64Pro::XMLMgr::setName (Sint32 idXML, const string &sName) |
XMLObj * | CRM64Pro::XMLMgr::get (Sint32 idXML=0) |
Sint32 | CRM64Pro::XMLMgr::loadFromFile (const string &sFile, const string &sName="") |
Sint32 | CRM64Pro::XMLMgr::load (const string &sFileCDC, const string &sName) |
Sint32 | CRM64Pro::XMLMgr::load (Sint32 idCDC, const string &sName) |
Sint32 | CRM64Pro::XMLMgr::remove (Sint32 idCDC, const string &sName) |
Each object loaded(a XML file) or created (a XML created on the fly) owns an internal state containing very important variables as the current node pointer and others.
In case you access to the same object from different functions or threads, you must keep in mind this internal state or unexpected results may happen. A workaround for it is to load an object, change its name and load the same object, this will allow you to have read-only concurrency from two different threads to the same but duplicated object.
This is a standard manager: objects are not shared and must be unique using its name as the key, in other words, you can not create an object with the same name of another one already created.
Only a single instance of the XML Manager exists which is created once Main is instantiated.
You can get a reference to this manager using Main::IXMLMgr() method.
Sint32 CRM64Pro::XMLObj::info | ( | Sint32 | iMode = 0 | ) |
Request XML object information.
For displaying the information, it uses the default log.
iMode | unused for the time being. |
Sint32 CRM64Pro::XMLObj::getName | ( | string & | sName | ) |
Get the name.
sName | a string containing the XML object name. |
Uint32 CRM64Pro::XMLObj::getID | ( | ) |
Get the ID.
Sint32 CRM64Pro::XMLObj::nodePointTo | ( | Sint32 | iParam, |
char * | szNodes, | ||
... | |||
) |
Search and point to the given node or subnode at any level.
It only changes the pointer when all node+[subnodes] are valid.
iParam | number node+[subnodes] in 'szNodes'. |
szNodes | string zero pointer with the node+[subnodes]. |
Sint32 CRM64Pro::XMLObj::nodeFirst | ( | ) |
Point to the first XML node (the root node).
It only changes the pointer when it finds a valid node.
Sint32 CRM64Pro::XMLObj::nodeNext | ( | ) |
Point to the next node (from current pointed node).
It only changes the pointer when it finds a valid node.
Sint32 CRM64Pro::XMLObj::nodePrev | ( | ) |
Point to the previous node (from current pointed node).
It only changes the pointer when it finds a valid node.
Sint32 CRM64Pro::XMLObj::nodeParent | ( | ) |
Point to the parent node (from current pointed node).
It only changes the pointer when it finds a valid node.
Sint32 CRM64Pro::XMLObj::nodeChild | ( | ) |
Point to the first child node (from current pointed node).
It only changes the pointer when it finds a valid node.
Sint32 CRM64Pro::XMLObj::nodeStore | ( | ) |
Store node pointer position.
There is only one slot per each XML so it only keeps the position of the last time this method is called.
Sint32 CRM64Pro::XMLObj::nodeRestore | ( | ) |
Restore node pointer position.
There is only one slot per each XML so it restores the position of the last time nodeStore() method was called.
Sint32 CRM64Pro::XMLObj::nodeRemove | ( | ) |
Remove pointed node and all its subnodes and attributes.
Sint32 CRM64Pro::XMLObj::nodeCreate | ( | const string & | sNode | ) |
Create a new node inside the pointed node and point to it.
sNode | string containing the node name. |
Sint32 CRM64Pro::XMLObj::nodeRename | ( | const string & | sNode | ) |
Rename pointed node.
sNode | string containing the node name. |
Sint32 CRM64Pro::XMLObj::nodeGetName | ( | string & | sNode | ) |
Get the name of pointed node.
sNode | a string variable. Will not be modified when there is not a valid pointed node. |
Sint32 CRM64Pro::XMLObj::setAttribute | ( | const string & | sAttr, |
const string & | sValue | ||
) |
Set an attribute inside pointed node with a string value.
If the attribute does not exist, it will be created.
sAttr | attribute name string. |
sValue | string value. |
Sint32 CRM64Pro::XMLObj::setAttribute | ( | const string & | sAttr, |
const Sint32 & | iValue | ||
) |
Set an attribute inside pointed node with an integer value.
If the attribute does not exist, it will be created.
sAttr | attribute name string. |
iValue | integer value. |
Sint32 CRM64Pro::XMLObj::setAttribute | ( | const string & | sAttr, |
const double & | dValue | ||
) |
Set an attribute inside pointed node with an integer value.
If the attribute does not exist, it will be created.
sAttr | attribute name string. |
dValue | integer value. |
Sint32 CRM64Pro::XMLObj::getAttribute | ( | const string & | sAttr, |
string & | sValue | ||
) |
Get the string value of an attribute inside the pointed node.
sAttr | attribute name string. |
sValue | a string variable. Will not be modified when the attribute does not exist. |
Sint32 CRM64Pro::XMLObj::getAttribute | ( | const string & | sAttr, |
Sint32 & | iValue | ||
) |
Get the integer value of an attribute inside the pointed node.
sAttr | attribute name string. |
iValue | an integer variable. Will not be modified when the attribute does not exist. |
Sint32 CRM64Pro::XMLObj::getAttribute | ( | const string & | sAttr, |
double & | dValue | ||
) |
Get the double value of an attribute inside the pointed node.
sAttr | attribute name string. |
dValue | a double variable. Will not be modified when the attribute does not exist. |
Sint32 CRM64Pro::XMLObj::removeAttribute | ( | const string & | sAttr | ) |
Remove an attribute and its value inside the pointed node.
sAttr | attribute name string. |
Sint32 CRM64Pro::XMLObj::setText | ( | const string & | sText | ) |
Set a text inside the pointed node.
If there is not any text, it will be created. Otherwise, the text will be appended to the exiting one.
sText | text string. |
<mynode>
Text1 -> First text block
Text2 -> First text block
Text3 -> First text block
<subnode>
Text1 of Subnode
</subnode>
Text4 -> Second text block due to be stored after a subnode
</mynode>
Sint32 CRM64Pro::XMLObj::getText | ( | string & | sText | ) |
Get the text contained in the pointed node.
sText | a string variable. Will not be modified when the text does not exist. |
Sint32 CRM64Pro::XMLObj::removeText | ( | ) |
Remove the text inside the pointed node.
Sint32 CRM64Pro::XMLObj::setComment | ( | const string & | sComment | ) |
Set a comment inside the pointed node.
If a comment already exists, it will be pushed down and the new comment will be the first one.
sComment | comment string. |
Sint32 CRM64Pro::XMLObj::getComment | ( | string & | sComment | ) |
Get the comment contained in the pointed node.
sComment | a string variable. Will not be modified when the comment does not exist. |
Sint32 CRM64Pro::XMLObj::removeComment | ( | ) |
Remove the comment inside the pointed node.
Sint32 CRM64Pro::XMLObj::saveToFile | ( | const string & | sFile | ) |
Export the XML to an external file.
sFile | string containing the [directory]+filename+[extension]. Ideally, it should have the .xml extension. If the XML file already exists, it will be overwritten. Directory separators '\' and '/' are supported. |
Sint32 CRM64Pro::XMLObj::save | ( | const string & | sFileCDC | ) |
Save the XML in to a CDC file.
If the XML already exists on the CDC, it will be overwritten.
sFileCDC | string containing the [directory]+filename+[extension]. Directory separators '\' and '/' are supported. |
Sint32 CRM64Pro::XMLObj::save | ( | Sint32 | idCDC | ) |
Save the XML in to a CDC file.
If the XML already exists on the CDC, it will be overwritten.
idCDC | CDC id. |
Sint32 CRM64Pro::XMLMgr::info | ( | Sint32 | iMode = 0 | ) |
Request XML Manager information.
For displaying the information, it uses the default log.
iMode | -1 for displaying only Manager information. 0 for displaying Manager and all Objects information. This is the default value. idXML for displaying Manager and given XML id information. |
Sint32 CRM64Pro::XMLMgr::create | ( | const string & | sMainNode, |
Uint32 | iUnused = 0 |
||
) |
Create a new XML.
sMainNode | The name to give to the the main node (e.g. 'myRootNode'). It is also used to set the XML object name. The object name must be unique and with a maximum size of 64 characters or will be truncated. |
iUnused | unused for the time being. |
Sint32 CRM64Pro::XMLMgr::close | ( | Sint32 | idXML | ) |
Close and destroy a XML.
idXML | 0 for closing all XML files or the XML id. |
Sint32 CRM64Pro::XMLMgr::getNum | ( | ) |
Get number of loaded objects.
Sint32 CRM64Pro::XMLMgr::setName | ( | Sint32 | idXML, |
const string & | sName | ||
) |
Change the object name.
idXML | XML id. |
sName | The name to give to the XML object (e.g. 'myXML'). The object name must be unique and with a maximum size of 64 characters or will be truncated. |
XMLObj * CRM64Pro::XMLMgr::get | ( | Sint32 | idXML = 0 | ) |
Get a pointer to the XML using its handler.
By default it returns the first XML.
Sint32 CRM64Pro::XMLMgr::loadFromFile | ( | const string & | sFile, |
const string & | sName = "" |
||
) |
Load a XML file.
sFile | string containing the [directory]+filename+[extension]. Directory separators '\' and '/' are supported. |
sName | the XML object name. By default, it is set to empty to use the filename (without extension) for setting the XML object name. The object name must be unique and with a maximum size of 64 characters or will be truncated. |
Sint32 CRM64Pro::XMLMgr::load | ( | const string & | sFileCDC, |
const string & | sName | ||
) |
Load a XML file stored in a CDC file.
sFileCDC | string containing the [directory]+filename+[extension]. Directory separators '\' and '/' are supported. |
sName | string containing the XML object name. The object name must be unique and with a maximum size of 64 characters or will be truncated. |
Sint32 CRM64Pro::XMLMgr::load | ( | Sint32 | idCDC, |
const string & | sName | ||
) |
Load a XML file stored in a CDC file.
idCDC | CDC id |
sName | string containing the XML object name. The object name must be unique and with a maximum size of 64 characters or will be truncated. |
Sint32 CRM64Pro::XMLMgr::remove | ( | Sint32 | idCDC, |
const string & | sName | ||
) |
Remove a XML file stored in a CDC file.
idCDC | CDC id. |
sName | string containing the XML object name (maximum size of 64 characters). |