#include <XML.hpp>
Public Member Functions | |
XMLNode (TiXmlElement *pSource) | |
Constructor to be used when loading an XML node. | |
~XMLNode () | |
Destructor. | |
const std::string | getName () const |
Get the name of the node. | |
const bool | getAttribute (const std::string &name, std::string &value) const |
Get the value of an attribute. | |
bool | setAttribute (const std::string &name, const std::string &value) |
Set the value of an attribute. | |
XMLNode * | getChild (const unsigned int index) const |
Get a child node. | |
const unsigned int | getChildrenCount () const |
Get the number of child nodes. | |
XMLNode * | addChild (const std::string &name) |
Add a child node. | |
const unsigned int | getFileLine () const |
Get the line number related to this node in the XML file. | |
Private Attributes | |
TiXmlElement * | m_pContent |
Content of the node, including attributes and children (TinyXML format). | |
std::vector< XMLNode * > | m_vpChildren |
Children of the node. |
It is used to browse the content of a XML file. Note that an instance of this class must NEVER be manually deleted. Load a XML file by using the XMLFile() class and browse its content by using XMLNode() instances. When done with the XML file, just delete it and it will automatically delete all its XMLNode() children.
syBR::Core::XMLNode::XMLNode | ( | TiXmlElement * | pSource | ) |
Constructor to be used when loading an XML node.
pSource | XML element to use as the source content of this node |
syBR::Core::XMLNode::~XMLNode | ( | ) |
Destructor.
const std::string syBR::Core::XMLNode::getName | ( | ) | const |
Get the name of the node.
const bool syBR::Core::XMLNode::getAttribute | ( | const std::string & | name, | |
std::string & | value | |||
) | const |
Get the value of an attribute.
name | Name of the attribute to retrieve | |
value | Reference to a string who will be replaced the attribute value if the attribute exists |
bool syBR::Core::XMLNode::setAttribute | ( | const std::string & | name, | |
const std::string & | value | |||
) |
Set the value of an attribute.
If the attribute does not exist, it will be created. otherwise, the existing value will be replaced.
name | Name of the attribute | |
value | Value to set to the attribute |
XMLNode * syBR::Core::XMLNode::getChild | ( | const unsigned int | index | ) | const |
Get a child node.
index | Zero-based index of the child to retrieve |
const unsigned int syBR::Core::XMLNode::getChildrenCount | ( | ) | const |
Get the number of child nodes.
XMLNode * syBR::Core::XMLNode::addChild | ( | const std::string & | name | ) |
Add a child node.
name | Name of the child node to add |
const unsigned int syBR::Core::XMLNode::getFileLine | ( | ) | const |
Get the line number related to this node in the XML file.
TiXmlElement* syBR::Core::XMLNode::m_pContent [private] |
Content of the node, including attributes and children (TinyXML format).
std::vector<XMLNode *> syBR::Core::XMLNode::m_vpChildren [private] |
Children of the node.
Copyright © 2008 by Sebastien Frippiat
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License.
Last modified Tue Dec 30 17:57:33 2008