Unigine::Xml Class
Interface for xml manipulation.
To use this class, include the UnigineXml.h file.
Unigine::Xml Class
Members
virtual ~Xml ()
Virtual destructor.static Ptr< xml > create ()
Xml constructor.Return value
Pointer to the created xml.static Ptr< xml > create (const char * name, const char * args)
Xml constructor.Arguments
- const char * name - Xml name.
- const char * args - Xml arguments.
Return value
Pointer to the created xml with specified name.static Ptr< xml > create (const Ptr< xml > & xml)
Xml constructor.Arguments
- const Ptr< xml > & xml - Xml smart pointer.
Return value
Pointer to the created xml.static String symbols (const char * Data)
Replaces ampersand characters with character entity references.Arguments
- const char * Data - to encode.
Return value
String which contains replaced ampersand characters with character entity references.static String encode (const char * Xml)
Encodes special xml characters (less-than, greater-than, ampersand, double-quote and apostrophe) to their character entity reference.Arguments
- const char * Xml - Data to encode.
Return value
Encoded string.static String decode (const char * str)
Decodes special xml characters (less-than, greater-than, ampersand, double-quote and apostrophe) and numeric character references.Arguments
- const char * str - Data to decode.
Return value
Decoded string.virtual void grab () =0
Grabs Xml. The xml should not be handled by the engine after this function is called.virtual void release () =0
Releases Xml. The xml should be handled by the engine after this function is called.virtual int isOwner () const =0
Returns the "owner" flag.Return value
Returns the "owner" flag.virtual int parse (const char * src) const =0
Parses string and creates the xml tree.Arguments
- const char * src - String pointer.
Return value
Returns 1 if the operation was a success; otherwise, 0 is returned.virtual int load (const char * name) const =0
Loads the xml tree from the specified file.Arguments
- const char * name - File name.
Return value
Returns 1 if the operation was a success; otherwise, 0 is returned.virtual int save (const char * name, int binary) const =0
Saves the xml tree into the specified file.Arguments
- const char * name - File name.
- int binary - Binary xml format.
Return value
Returns 1 if the operation was a success; otherwise, 0 is returned.virtual void clear () const =0
Clears the xml tree.virtual void setName (const char * name) const =0
Sets the xml node name.Arguments
- const char * name - Name of the xml node.
virtual const char * getName () const =0
Returns the xml node name.Return value
The result.virtual Ptr< xml > getParent () const =0
Returns the parent xml tree.virtual void clearChilds () const =0
Clears all children of the current xml node.The function is deprecated. It is provided to keep your code working until the next release. Please, replace it with clearChildren().
virtual void clearChildren () const =0
Clears all children of the current xml node.virtual int isChild (const char * name) const =0
Checks if the xml has specified child.Arguments
- const char * name - Name of the xml child.
Return value
The result.virtual int findChild (const char * name) const =0
Returns the number of the Xml node child by its name.Arguments
- const char * name - Name of the Xml node child.
Return value
The number of the Xml node child if it is exists; otherwise, -1.virtual int getNumChilds () const =0
Returns the number of xml children.The function is deprecated. It is provided to keep your code working until the next release. Please, replace it with getNumChildren().
Return value
The result.virtual int getNumChildren () const =0
Returns the number of xml children.Return value
The result.virtual Ptr< xml > getChild (int num) const =0
Returns the child of the xml tree.Arguments
- int num - The child number.
Return value
The result.virtual Ptr< xml > getChild (const char * name) const =0
Returns the child of the xml tree.Arguments
- const char * name - Name of the child.
Return value
The result.virtual const char * getChildData (const char * name) const =0
Allows to get the data from the xml child node.Arguments
- const char * name - Name of the child node.
Return value
The value of the child node.virtual Ptr< xml > addChild (const Ptr< xml > & xml) const =0
Appends a new xml child.Arguments
- const Ptr< xml > & xml - Xml sub-tree smart pointer.
Return value
Created xml node.virtual Ptr< xml > addChild (const char * name, const char * args) const =0
Appends a new xml child.Arguments
- const char * name - Name of the xml node.
- const char * args - Arguments of the xml node.
Return value
Created xml node.virtual Ptr< xml > removeChild (const Ptr< xml > & xml) const =0
Removes an xml sub-tree.Arguments
- const Ptr< xml > & xml - Xml sub-tree smart pointer.
Return value
Removed xml sub-tree.virtual Ptr< xml > find (const char * path) const =0
Finds an xml sub-tree.Arguments
- const char * path - Path to the xml sub-tree.
Return value
The result.virtual String getSubTree (const char * path) const =0
Converts an xml tree into the string.Arguments
- const char * path - Path to xml sub-tree.
Return value
The result.virtual String getFormattedSubTree (const char * path) const =0
Converts an xml tree into the formatted string.Arguments
- const char * path - Path to xml sub-tree.
Return value
The result.virtual void printUnusedData (const char * name) const =0
Prints the unused nodes and arguments.Arguments
- const char * name - Name of the xml file.
virtual void clearUnusedData () const =0
Clears the unused nodes and arguments.virtual int isArg (const char * name) const =0
Checks if the xml has specified argument.Arguments
- const char * name - Name of xml argument.
Return value
The result.virtual int getNumArgs () const =0
Returns the number of xml arguments.Return value
The result.virtual int findArg (const char * name) const =0
Finds a xml argument by its name.Arguments
- const char * name - Xml argument name.
Return value
Xml argument number.virtual void setArgName (int num, const char * name) const =0
Sets the xml argument name.Arguments
- int num - The argument number.
- const char * name - The argument name.
virtual const char * getArgName (int num) const =0
Returns the xml argument name.Arguments
- int num - The argument number.
Return value
The result.virtual void setArgValue (int num, const char * value) const =0
Sets the xml argument value.Arguments
- int num - The argument number.
- const char * value - The argument value.
virtual const char * getArgValue (int num) const =0
Returns the xml argument value.Arguments
- int num - The argument number.
Return value
The result.virtual int setArg (const char * name, const char * value) const =0
Sets an xml argument.Arguments
- const char * name - The xml argument name.
- const char * value - The xml argument value.
Return value
Returns 1 if the argument is set successfully; otherwise, 0.virtual const char * getArg (const char * name) const =0
Gets an xml argument.Arguments
- const char * name - The xml argument name.
Return value
Value of the argument, if it is found; otherwise, NULL.virtual int removeArg (const char * name) const =0
Deletes an xml argument.Arguments
- const char * name - The xml argument name.
Return value
1 if the argument is deleted successfully; otherwise, 0.virtual int setBoolArg (const char * name, int value) const =0
Sets a boolean as xml argument.Arguments
- const char * name - The xml argument name.
- int value - The xml argument value.
Return value
Returns 1 if the operation was a success; otherwise, 0 is returned.virtual int getBoolArg (const char * name) const =0
Gets a boolean xml argument.Arguments
- const char * name - The xml argument name.
Return value
The result.virtual int setIntArg (const char * name, int value, int radix = 10) const =0
Sets an integer as xml argument in a given number notation. By default, the decimal number notation is used.Arguments
- const char * name - The xml argument name.
- int value - The xml argument value.
- int radix - Radix to use when setting a value.
Return value
1 if the value is set successfully; otherwise, 0.virtual int getIntArg (const char * name) const =0
Gets an integer xml argument.Arguments
- const char * name - The xml argument name.
Return value
The result.virtual int setIntArrayArg (const char * name, const int * src, int size, int radix = 10) const =0
Sets an array of integers as xml argument in a given number notation. By default, the decimal number notation is used.Arguments
- const char * name - The xml argument name.
- const int * src - The pointer to the array of integers.
- int size - The size of the array of integers.
- int radix - Radix to use when setting an array.
Return value
1 if the array is set successfully; otherwise, 0.virtual int getIntArrayArg (const char * name, int * dest, int size) const =0
Gets an array of integers from xml argument.Arguments
- const char * name - The xml argument name.
- int * dest - The pointer to the array of integers.
- int size - The size of the array of integers.
Return value
Returns 1 if the operation was a success; otherwise, 0 is returned.virtual int setData (const char * data) const =0
Sets a xml data.Arguments
- const char * data - The xml data.
Return value
Returns 1 if the operation was a success; otherwise, 0 is returned.virtual int setRawData (const char * data) const =0
Sets a xml raw data.Arguments
- const char * data - The xml raw data.
Return value
Returns 1 if the operation was a success; otherwise, 0 is returned.virtual int setXmlData (const char * data) const =0
Sets a xml xml data.Arguments
- const char * data - The xml xml data.
Return value
Returns 1 if the operation was a success; otherwise, 0 is returned.virtual const char * getData () const =0
Gets a xml data.Return value
The result.virtual int setBoolData (int value) const =0
Sets a boolean as xml data.Arguments
- int value - The xml argument value.
Return value
Returns 1 if the operation was a success; otherwise, 0 is returned.virtual int getBoolData () const =0
Gets a boolean xml data.Return value
The result.virtual int setIntData (int value, int radix = 10) const =0
Sets an integer as xml data in a given number notation. By default, the decimal number notation is used.Arguments
- int value - The xml argument value.
- int radix - Radix to use when setting a value.
Return value
1 if the value is set successfully; otherwise, 0.virtual int getIntData () const =0
Gets an integer xml data.Return value
The result.virtual int setIntArrayData (const int * src, int size, int radix = 10) const =0
Sets an array of integers as xml data in a given number notation. By default, the decimal number notation is used.Arguments
- const int * src - The pointer to the array of integers.
- int size - The size of the array of integers.
- int radix - Radix to use when setting an array.
Return value
1 if the array is set successfully; otherwise, 0.virtual int getIntArrayData (int * dest, int size) const =0
Gets an array of integers from xml data.Arguments
- int * dest - The pointer to the array of integers.
- int size - The size of the array of integers.
Return value
Returns 1 if the operation was a success; otherwise, 0 is returned.Last update: 2017-07-03
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)