The Xml-Parser class.
More...
#include <XmlParser.h>
|
static bool | getBoolAttribute (XmlNode &xmlNode, const char *name, bool &val) |
| Will try to get a bool attribute value. More...
|
|
static bool | getDoubleAttribute (XmlNode &xmlNode, const char *name, double &val) |
| Will try to get a double attribute value. More...
|
|
static bool | getFloatAttribute (XmlNode &xmlNode, const char *name, float &val) |
| Will try to get a float attribute value. More...
|
|
static bool | getIntAttribute (XmlNode &xmlNode, const char *name, int &val) |
| Will try to get an int attribute value. More...
|
|
static bool | getRealAttribute (XmlNode &xmlNode, const char *name, ai_real &val) |
| Will try to get a real attribute value. More...
|
|
static bool | getStdStrAttribute (XmlNode &xmlNode, const char *name, std::string &val) |
| Will try to get a std::string attribute value. More...
|
|
static bool | getUIntAttribute (XmlNode &xmlNode, const char *name, unsigned int &val) |
| Will try to get an unsigned int attribute value. More...
|
|
static bool | getValueAsBool (XmlNode &node, bool &v) |
| Will try to get the value of the node as an bool. More...
|
|
static bool | getValueAsFloat (XmlNode &node, ai_real &v) |
| Will try to get the value of the node as a float. More...
|
|
static bool | getValueAsInt (XmlNode &node, int &v) |
| Will try to get the value of the node as an integer. More...
|
|
static bool | getValueAsString (XmlNode &node, std::string &text) |
| Will try to get the value of the node as a string. More...
|
|
static bool | hasAttribute (XmlNode &xmlNode, const char *name) |
| Will check if an attribute is part of the XmlNode. More...
|
|
static bool | hasNode (XmlNode &node, const char *name) |
| Will check if a node with the given name is in. More...
|
|
template<class TNodeType>
class Assimp::TXmlParser< TNodeType >
The Xml-Parser class.
Use this parser if you have to import any kind of xml-format.
An example:
if (theParser.
parse(fileStream)) {
for ( auto currentNode : node.children()) {
}
}
The Xml-Parser class.
Definition: XmlParser.h:99
const TNodeType getRootNode() const
Will return the root node, const version.
Definition: XmlParser.h:321
bool parse(IOStream *stream)
Will parse an xml-file from a given stream.
Definition: XmlParser.h:284
- Template Parameters
-
◆ TXmlParser()
template<class TNodeType >
The default class constructor.
◆ ~TXmlParser()
template<class TNodeType >
◆ clear()
template<class TNodeType >
Will clear the parsed xml-file.
◆ findNode()
template<class TNodeType >
Will search for a child-node by its name.
- Parameters
-
name | [in] The name of the child-node. |
- Returns
- The node instance or nullptr, if nothing was found.
◆ getBoolAttribute()
template<class TNodeType >
Will try to get a bool attribute value.
- Parameters
-
xmlNode | [in] The node to search in. |
name | [in] The attribute name to look for. |
val | [out] The bool value from the attribute. |
- Returns
- true, if the node contains an attribute with the given name and if the value is a bool.
◆ getDocument()
template<class TNodeType >
Will return the document pointer, is nullptr if no xml-file was parsed.
- Returns
- The pointer showing to the document.
◆ getDoubleAttribute()
template<class TNodeType >
Will try to get a double attribute value.
- Parameters
-
xmlNode | [in] The node to search in. |
name | [in] The attribute name to look for. |
val | [out] The double value from the attribute. |
- Returns
- true, if the node contains an attribute with the given name and if the value is a double.
◆ getFloatAttribute()
template<class TNodeType >
Will try to get a float attribute value.
- Parameters
-
xmlNode | [in] The node to search in. |
name | [in] The attribute name to look for. |
val | [out] The float value from the attribute. |
- Returns
- true, if the node contains an attribute with the given name and if the value is a float.
◆ getIntAttribute()
template<class TNodeType >
Will try to get an int attribute value.
- Parameters
-
xmlNode | [in] The node to search in. |
name | [in] The attribute name to look for. |
val | [out] The int value from the attribute. |
- Returns
- true, if the node contains an attribute with the given name and if the value is an int.
◆ getRealAttribute()
template<class TNodeType >
Will try to get a real attribute value.
- Parameters
-
xmlNode | [in] The node to search in. |
name | [in] The attribute name to look for. |
val | [out] The real value from the attribute. |
- Returns
- true, if the node contains an attribute with the given name and if the value is a real.
◆ getRootNode() [1/2]
template<class TNodeType >
Will return the root node, non-const version.
- Returns
- The root node.
◆ getRootNode() [2/2]
template<class TNodeType >
Will return the root node, const version.
- Returns
- The root node.
◆ getStdStrAttribute()
template<class TNodeType >
Will try to get a std::string attribute value.
- Parameters
-
xmlNode | [in] The node to search in. |
name | [in] The attribute name to look for. |
val | [out] The std::string value from the attribute. |
- Returns
- true, if the node contains an attribute with the given name and if the value is a std::string.
◆ getUIntAttribute()
template<class TNodeType >
Will try to get an unsigned int attribute value.
- Parameters
-
xmlNode | [in] The node to search in. |
name | [in] The attribute name to look for. |
val | [out] The unsigned int value from the attribute. |
- Returns
- true, if the node contains an attribute with the given name and if the value is an unsigned int.
◆ getValueAsBool()
template<class TNodeType >
Will try to get the value of the node as an bool.
- Parameters
-
node | [in] The node to search in. |
text | [out] The value as a bool. |
- Returns
- true, if the value can be read out.
◆ getValueAsFloat()
template<class TNodeType >
Will try to get the value of the node as a float.
- Parameters
-
node | [in] The node to search in. |
text | [out] The value as a float. |
- Returns
- true, if the value can be read out.
◆ getValueAsInt()
template<class TNodeType >
Will try to get the value of the node as an integer.
- Parameters
-
node | [in] The node to search in. |
text | [out] The value as a int. |
- Returns
- true, if the value can be read out.
◆ getValueAsString()
template<class TNodeType >
Will try to get the value of the node as a string.
- Parameters
-
node | [in] The node to search in. |
text | [out] The value as a text. |
- Returns
- true, if the value can be read out.
◆ hasAttribute()
template<class TNodeType >
Will check if an attribute is part of the XmlNode.
- Parameters
-
xmlNode | [in] The node to search in. |
name | [in} The attribute name to look for. |
- Returns
- true, if the was found, false if not.
◆ hasNode() [1/2]
template<class TNodeType >
Will return true, if the node is a child-node.
- Parameters
-
name | [in] The name of the child node to look for. |
- Returns
- true, if the node is a child-node or false if not.
◆ hasNode() [2/2]
template<class TNodeType >
Will check if a node with the given name is in.
- Parameters
-
node | [in] The node to look in. |
name | [in] The name of the child-node. |
- Returns
- true, if node was found, false if not.
◆ hasRoot()
template<class TNodeType >
Will return true if a root node is there.
- Returns
- true in case of an existing root.
◆ parse()
template<class TNodeType >
Will parse an xml-file from a given stream.
- Parameters
-
- Returns
- true, if the parsing was successful, false if not.
The documentation for this class was generated from the following file: