Getting Started
Migrating to UNIGINE 2.0
C++ API Migration
UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
High-Level Systems
Samples
Usage Examples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins

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.
Warning
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 getNumChilds () const =0

Returns the number of Xml children.
Warning
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