XMLNode Class Reference

This is a wrapper-class for IrrXMLReader-objects. More...

#include <XMLNode.h>

List of all members.


Public Member Functions

 XMLNode (irr::io::IrrXMLReader *xml)
const char * getNodeName ()
const char * getAttributeValue (const char *name)
float getAttributeValueAsFloat (const char *name, float fail)
bool readNextSubNode ()

Private Attributes

irr::io::IrrXMLReader * xml

Detailed Description

This is a wrapper-class for IrrXMLReader-objects.

The class XMLNode is a wrapper for an IrrXMLReader -object. This wrapper allows only retrieving the attributes of the actual node and its sub-nodes, which are in focus of the wrapped IrrXMLReader -object.

This is used for passing xml-nodes to widgets, which are so unable to harm the 3dMenu by selecting other nodes in the xml-file.

Date:
23rd of March 2007
Author:
Thomas Weberndorfer
Updates:

  • Widgets are allowed to access also sub-nodes. (3rd of April 2007)
  • NULL will be returned instead of XMLNode::Error. (25th of April 2007)
  • getAttributeValueAsFloat returns a preselectable return-value on failure. (25th of April 2007)
  • Retrieving the node-type is possible. (6th May 2007)

Constructor & Destructor Documentation

XMLNode::XMLNode ( irr::io::IrrXMLReader *  xml  ) 

The constructor defines, which IrrXMLReader-object should be wrapped.

Parameters:
xml The IrrXMLReader -object, which will be wrapped.


Member Function Documentation

const char * XMLNode::getAttributeValue ( const char *  name  ) 

This method returns the attribute-value of an attribute from the current xml-node.

Parameters:
name This is the name of the attribute from which the value is needed.
Returns:
This method returns the value of an attribute, or NULL in case that no attribute with the given name exists.

float XMLNode::getAttributeValueAsFloat ( const char *  name,
float  fail 
)

This method returns the attribute-value, converted into a float, of an attribute from the current xml-node.

Parameters:
name This is the name of the attribute from which the value is needed.
fail This value will be returned in case of an error.
Returns:
This method returns the value of an attribute, converted into a float, or the value of the parameter fail in case of an error.

const char * XMLNode::getNodeName (  ) 

This method returns the node-name.

bool XMLNode::readNextSubNode (  ) 

This method changes the focus of the wrapped IrrXMLReader -object to the next sub-node and returns true or, if no sub-node could be found, false.

If this method has been used and sub-nodes have been found, the other methods of this class can be used to access the attributes of the sub-nodes. It is not possible to return to the root-node. So read everything you need from the root-node first!

This method is state-full, because it has to count the start- and end-tags in the XML-file. Once, this method has been called, you have the call it repetitively until it returns false. Then, the internal state has been reseted.

Returns:
true if a sub-node has been found; false in all other cases.


Member Data Documentation

irr::io::IrrXMLReader* XMLNode::xml [private]


The documentation for this class was generated from the following files:

Generated on Wed Oct 20 16:12:03 2010 for inVRs by doxygen 1.5.8