![]() |
CRM64Pro GDK v0.13.0
A free cross-platform game development kit built on top of SDL 3.0
|
XML Manager and XML objects providing a full parsing system [25.11.0].
The XML module provides a complete XML parsing system through the XML Manager and XML objects. Objects can be loaded from external XML files or created programmatically on the fly.
Each XML object maintains an internal state containing important variables such as the current node pointer. This state is modified during navigation and query operations.
| Single-threaded | Safe to use without restrictions |
|---|---|
| Multi-threaded | Concurrent access to the same object may cause unexpected results due to shared internal state |
For read-only concurrent access from multiple threads, duplicate the object:
This creates two independent objects with separate internal states, allowing safe read-only concurrency.
This is a standard manager: objects are not shared and must be unique using its name as the key. You cannot create an object with the same name as another one already created.
Classes | |
| class | CRM64Pro::XML |
| XML Object class. More... | |
| class | CRM64Pro::XMLMgr |
| XML Manager class. More... | |
Functions | |
| Sint32 | CRM64Pro::XML::info (Sint32 iMode=0) |
| Request XML object information. | |
| Sint32 | CRM64Pro::XML::getName (string &sName) |
| Get the name. | |
| Uint32 | CRM64Pro::XML::getID () |
| Get the ID. | |
| Sint32 | CRM64Pro::XML::nodePointTo (Sint32 iParam, char *szNodes,...) |
| Search and point to the given node or subnode at any level. | |
| Sint32 | CRM64Pro::XML::nodeFirst () |
| Point to the first XML node (the root node). | |
| Sint32 | CRM64Pro::XML::nodeNext () |
| Point to the next node (from current pointed node). | |
| Sint32 | CRM64Pro::XML::nodePrev () |
| Point to the previous node (from current pointed node). | |
| Sint32 | CRM64Pro::XML::nodeParent () |
| Point to the parent node (from current pointed node). | |
| Sint32 | CRM64Pro::XML::nodeChild () |
| Point to the first child node (from current pointed node). | |
| Sint32 | CRM64Pro::XML::nodeStore () |
| Store node pointer position. | |
| Sint32 | CRM64Pro::XML::nodeRestore () |
| Restore node pointer position. | |
| Sint32 | CRM64Pro::XML::nodeRemove () |
| Remove pointed node and all its subnodes and attributes. | |
| Sint32 | CRM64Pro::XML::nodeCreate (const string &sNode) |
| Create a new node inside the pointed node and point to it. | |
| Sint32 | CRM64Pro::XML::nodeRename (const string &sNode) |
| Rename pointed node. | |
| Sint32 | CRM64Pro::XML::nodeGetName (string &sNode) |
| Get the name of pointed node. | |
| Sint32 | CRM64Pro::XML::setAttribute (const string &sAttr, const string &sValue) |
| Set an attribute inside pointed node with a string value. | |
| Sint32 | CRM64Pro::XML::setAttribute (const string &sAttr, const Sint32 &iValue) |
| Set an attribute inside pointed node with an integer value. | |
| Sint32 | CRM64Pro::XML::setAttribute (const string &sAttr, const float &fValue) |
| Set an attribute inside pointed node with a float value. | |
| Sint32 | CRM64Pro::XML::getAttribute (const string &sAttr, string &sValue) |
| Get the string value of an attribute inside the pointed node. | |
| Sint32 | CRM64Pro::XML::getAttribute (const string &sAttr, Sint32 &iValue) |
| Get the integer value of an attribute inside the pointed node. | |
| Sint32 | CRM64Pro::XML::getAttribute (const string &sAttr, float &fValue) |
| Get the float value of an attribute inside the pointed node. | |
| Sint32 | CRM64Pro::XML::removeAttribute (const string &sAttr) |
| Remove an attribute and its value inside the pointed node. | |
| Sint32 | CRM64Pro::XML::setText (const string &sText) |
| Set a text inside the pointed node. | |
| Sint32 | CRM64Pro::XML::getText (string &sText) |
| Get the text contained in the pointed node. | |
| Sint32 | CRM64Pro::XML::removeText () |
| Remove the text inside the pointed node. | |
| Sint32 | CRM64Pro::XML::setComment (const string &sComment) |
| Set a comment text inside the pointed node. | |
| Sint32 | CRM64Pro::XML::getComment (string &sComment) |
| Get the comment text contained in the pointed node. | |
| Sint32 | CRM64Pro::XML::removeComment () |
| Remove the comment text inside the pointed node. | |
| Sint32 | CRM64Pro::XML::saveToFile (const string &sFile) |
| Export the XML to an external file. | |
| Sint32 | CRM64Pro::XML::save (const string &sFileCDC) |
| Save the XML into a CDC file. | |
| Sint32 | CRM64Pro::XML::save (Sint32 idCDC) |
| Save the XML in to a CDC file. | |
| Sint32 | CRM64Pro::XMLMgr::info (Sint32 iMode=0) |
| Request XML Manager information. | |
| Sint32 | CRM64Pro::XMLMgr::create (const string &sMainNode, Uint32 iUnused=0) |
| Create a new XML. | |
| Sint32 | CRM64Pro::XMLMgr::close (Sint32 idXML) |
| Close and destroy a XML. | |
| Sint32 | CRM64Pro::XMLMgr::getNum () const |
| Get number of loaded objects. | |
| Sint32 | CRM64Pro::XMLMgr::setName (Sint32 idXML, const string &sName) |
| Change the object name. | |
| XML * | CRM64Pro::XMLMgr::get (Sint32 idXML=0) |
| Get a pointer to the XML using its handler. | |
| Sint32 | CRM64Pro::XMLMgr::loadFromFile (const string &sFile, const string &sName="") |
| Load a XML file. | |
| Sint32 | CRM64Pro::XMLMgr::loadFromBuffer (const unsigned char *szData, const Sint32 iSize, const string &sName) |
| Load a XML from a buffer. | |
| Sint32 | CRM64Pro::XMLMgr::load (const string &sFileCDC, const string &sName) |
| Load a XML file stored in a CDC file. | |
| Sint32 | CRM64Pro::XMLMgr::load (Sint32 idCDC, const string &sName) |
| Load a XML file stored in a CDC file. | |
| Sint32 | CRM64Pro::XMLMgr::remove (Sint32 idCDC, const string &sName) |
| Remove a XML file stored in a CDC file. | |
| Sint32 CRM64Pro::XML::info | ( | Sint32 | iMode = 0 | ) |
Request XML object information.
Writes information to the default log.
| iMode | unused for the time being. |
| Sint32 CRM64Pro::XML::getName | ( | string & | sName | ) |
Get the name.
| sName | a string containing the XML object name. |
| Uint32 CRM64Pro::XML::getID | ( | ) |
Get the ID.
| Sint32 CRM64Pro::XML::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::XML::nodeFirst | ( | ) |
Point to the first XML node (the root node).
Updates the pointer only when a valid node is found.
| Sint32 CRM64Pro::XML::nodeNext | ( | ) |
Point to the next node (from current pointed node).
Updates the pointer only when a valid node is found.
| Sint32 CRM64Pro::XML::nodePrev | ( | ) |
Point to the previous node (from current pointed node).
Updates the pointer only when a valid node is found.
| Sint32 CRM64Pro::XML::nodeParent | ( | ) |
Point to the parent node (from current pointed node).
Updates the pointer only when a valid node is found.
| Sint32 CRM64Pro::XML::nodeChild | ( | ) |
Point to the first child node (from current pointed node).
Updates the pointer only when a valid node is found.
| Sint32 CRM64Pro::XML::nodeStore | ( | ) |
Store node pointer position.
Each XML has a single slot, so it keeps only the most recently stored position.
| Sint32 CRM64Pro::XML::nodeRestore | ( | ) |
Restore node pointer position.
Each XML has a single slot, so it restores the position saved by the last nodeStore() call.
| Sint32 CRM64Pro::XML::nodeRemove | ( | ) |
Remove pointed node and all its subnodes and attributes.
| Sint32 CRM64Pro::XML::nodeCreate | ( | const string & | sNode | ) |
Create a new node inside the pointed node and point to it.
| sNode | string containing the node name. |
| Sint32 CRM64Pro::XML::nodeRename | ( | const string & | sNode | ) |
Rename pointed node.
| sNode | string containing the node name. |
| Sint32 CRM64Pro::XML::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::XML::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::XML::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::XML::setAttribute | ( | const string & | sAttr, |
| const float & | fValue ) |
Set an attribute inside pointed node with a float value.
If the attribute does not exist, it will be created.
| sAttr | attribute name string. |
| fValue | float value. |
| Sint32 CRM64Pro::XML::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. Not modified if the attribute does not exist. |
| Sint32 CRM64Pro::XML::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. Not modified if the attribute does not exist. |
| Sint32 CRM64Pro::XML::getAttribute | ( | const string & | sAttr, |
| float & | fValue ) |
Get the float value of an attribute inside the pointed node.
| sAttr | attribute name string. |
| fValue | a float variable. Not modified if the attribute does not exist. |
| Sint32 CRM64Pro::XML::removeAttribute | ( | const string & | sAttr | ) |
Remove an attribute and its value inside the pointed node.
| sAttr | attribute name string. |
| Sint32 CRM64Pro::XML::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. |
| Sint32 CRM64Pro::XML::getText | ( | string & | sText | ) |
Get the text contained in the pointed node.
| sText | a string variable. Not modified if no text exists. |
| Sint32 CRM64Pro::XML::removeText | ( | ) |
Remove the text inside the pointed node.
| Sint32 CRM64Pro::XML::setComment | ( | const string & | sComment | ) |
Set a comment text 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 text string. |
| Sint32 CRM64Pro::XML::getComment | ( | string & | sComment | ) |
Get the comment text contained in the pointed node.
| sComment | a string variable. Not modified if no comment exists. |
| Sint32 CRM64Pro::XML::removeComment | ( | ) |
Remove the comment text inside the pointed node.
| Sint32 CRM64Pro::XML::saveToFile | ( | const string & | sFile | ) |
Export the XML to an external file.
| sFile | string containing [directory]+filename+[extension]. Ideally should have the .xml extension. If the file exists, it will be overwritten. Directory separators '\' and '/' are supported. |
| Sint32 CRM64Pro::XML::save | ( | const string & | sFileCDC | ) |
Save the XML into a CDC file.
If the XML already exists on the CDC, it will be overwritten.
| sFileCDC | string containing [directory]+filename+[extension]. Directory separators '\' and '/' are supported. |
| Sint32 CRM64Pro::XML::save | ( | Sint32 | idCDC | ) |
| Sint32 CRM64Pro::XMLMgr::info | ( | Sint32 | iMode = 0 | ) |
Request XML Manager information.
Writes information to the default log.
| iMode | -1 for displaying only Manager information. 0 (default) for displaying Manager and all Objects information. A positive XML id for displaying Manager and that specific XML information. |
| Sint32 CRM64Pro::XMLMgr::create | ( | const string & | sMainNode, |
| Uint32 | iUnused = 0 ) |
| Sint32 CRM64Pro::XMLMgr::close | ( | Sint32 | idXML | ) |
| Sint32 CRM64Pro::XMLMgr::getNum | ( | ) | const |
Get number of loaded objects.
| Sint32 CRM64Pro::XMLMgr::setName | ( | Sint32 | idXML, |
| const string & | sName ) |
| XML * CRM64Pro::XMLMgr::get | ( | Sint32 | idXML = 0 | ) |
| Sint32 CRM64Pro::XMLMgr::loadFromFile | ( | const string & | sFile, |
| const string & | sName = "" ) |
Load a XML file.
| sFile | string containing [directory]+filename+[extension]. Directory separators '\' and '/' are supported. |
| sName | the XML object name. If empty (default), uses the filename without extension. Must be unique, max 64 characters (truncated if longer). |
| Sint32 CRM64Pro::XMLMgr::loadFromBuffer | ( | const unsigned char * | szData, |
| const Sint32 | iSize, | ||
| const string & | sName ) |
Load a XML from a buffer.
| szData | pointer to buffer data containing the XML to be loaded. |
| iSize | size in bytes of the buffer data. |
| sName | the XML object name. Must be unique, max 64 characters (truncated if longer). |
| Sint32 CRM64Pro::XMLMgr::load | ( | const string & | sFileCDC, |
| const string & | sName ) |
Load a XML file stored in a CDC file.
| sFileCDC | string containing [directory]+filename+[extension]. Directory separators '\' and '/' are supported. |
| sName | string containing the XML object name. Must be unique, max 64 characters (truncated if longer). |
| Sint32 CRM64Pro::XMLMgr::load | ( | Sint32 | idCDC, |
| const string & | sName ) |
| Sint32 CRM64Pro::XMLMgr::remove | ( | Sint32 | idCDC, |
| const string & | sName ) |