#include <XMLFileOutput.h>
Inheritance diagram for hwdet::XMLElement:
Public Member Functions | |
XMLElement (void) | |
Default constructor. | |
XMLElement (const Char *elem_name) | |
Constructor with node init. | |
XMLElement (const String &elem_name) | |
Constructor with node init. | |
virtual | ~XMLElement (void) |
Virtual destructor. | |
virtual String | GetNodeName (void) const |
Get name of node. | |
void | AddSubNode (XMLElement *new_node) |
Add sub-node to the current node. | |
XMLElement * | GetSubNode (const size_t index) const |
Get sub-node at given position. | |
size_t | GetSubNodeCount (void) const |
Get number of sub-nodes of current node. | |
virtual String | GetNodeValueString (void) |
Get string representing current node. | |
virtual void | AppendToStream (OStream &stream) const |
Append string representing current node to the given stream. | |
Protected Member Functions | |
void | SetNodeDepth (size_t nd) |
Set depth of current node. | |
void | SetNodeParent (XMLElement *e) |
Set parent node of current node. | |
Protected Attributes | |
String | name |
Name of the node. | |
std::vector< XMLElement * > | nodes |
List of child nodes. | |
size_t | depth |
Depth of current node (it is used to align output in stream). | |
XMLElement * | parent |
Parent nodes. |
This class creates XML tree-like file structure of nodes. Each node has a name and a list of child nodes.
hwdet::XMLElement::XMLElement | ( | void | ) | [inline] |
Default constructor.
Create empty node (with no name).
hwdet::XMLElement::XMLElement | ( | const Char * | elem_name | ) | [inline] |
Constructor with node init.
elem_name | Name of current node. |
hwdet::XMLElement::XMLElement | ( | const String & | elem_name | ) | [inline] |
Constructor with node init.
elem_name | Name of current node. |
virtual hwdet::XMLElement::~XMLElement | ( | void | ) | [inline, virtual] |
Virtual destructor.
This destructor will destroy all child nodes. You do not need to freem them by yourself.
void hwdet::XMLElement::AddSubNode | ( | XMLElement * | new_node | ) | [inline] |
Add sub-node to the current node.
Adds new sub-node to the end of the sub-node list.
new_node | Node to add. If this is NULL, nothing is done. |
virtual void hwdet::XMLElement::AppendToStream | ( | OStream & | stream | ) | const [inline, virtual] |
Append string representing current node to the given stream.
stream | Output stream to which current node's data will be appended. |
Reimplemented in hwdet::XMLValueElement< T >, hwdet::XMLValueElement< unsigned long >, hwdet::XMLValueElement< unsigned long long >, and hwdet::XMLValueElement< std::string >.
virtual String hwdet::XMLElement::GetNodeName | ( | void | ) | const [inline, virtual] |
Get name of node.
virtual String hwdet::XMLElement::GetNodeValueString | ( | void | ) | [inline, virtual] |
Get string representing current node.
Converts all data within current node (including sub-nodes) to strings and returns concatenation.
XMLElement* hwdet::XMLElement::GetSubNode | ( | const size_t | index | ) | const [inline] |
Get sub-node at given position.
index | Position of sub-node within list of sub-nodes. First sub-node has index of zero, last has index getSubNodeCount() - 1. |
size_t hwdet::XMLElement::GetSubNodeCount | ( | void | ) | const [inline] |
Get number of sub-nodes of current node.
void hwdet::XMLElement::SetNodeDepth | ( | size_t | nd | ) | [inline, protected] |
Set depth of current node.
This will set depth of current node to given depth and update depths of all nodes in subtree accordingly.
nd | New depth of current node. |
void hwdet::XMLElement::SetNodeParent | ( | XMLElement * | e | ) | [inline, protected] |
Set parent node of current node.
This method will also update depths of surrent subtree.
e | New parent node. |
size_t hwdet::XMLElement::depth [protected] |
Depth of current node (it is used to align output in stream).
String hwdet::XMLElement::name [protected] |
std::vector< XMLElement* > hwdet::XMLElement::nodes [protected] |
List of child nodes.
XMLElement* hwdet::XMLElement::parent [protected] |
Parent nodes.