hwdet::XMLElement Class Reference

Basic class for all nodes in XML file. More...

#include <XMLFileOutput.h>

Inheritance diagram for hwdet::XMLElement:

hwdet::AdvancedFeatures hwdet::BasicFeatures hwdet::BeenDisk hwdet::DiskDrive hwdet::DiskPartition hwdet::Memory hwdet::NetworkAdapter hwdet::OperatingSystem hwdet::Processor hwdet::Product hwdet::XMLValueElement< T >

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.
XMLElementGetSubNode (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).
XMLElementparent
 Parent nodes.

Detailed Description

Basic class for all nodes in XML file.

This class creates XML tree-like file structure of nodes. Each node has a name and a list of child nodes.


Constructor & Destructor Documentation

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.

Parameters:
elem_name Name of current node.

hwdet::XMLElement::XMLElement ( const String elem_name  )  [inline]

Constructor with node init.

Parameters:
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.


Member Function Documentation

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.

Parameters:
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.

Parameters:
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.

Returns:
Name of current 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.

Returns:
String containing all node's data.

XMLElement* hwdet::XMLElement::GetSubNode ( const size_t  index  )  const [inline]

Get sub-node at given position.

Parameters:
index Position of sub-node within list of sub-nodes. First sub-node has index of zero, last has index getSubNodeCount() - 1.
Returns:
Requested node of NULL if index is too large.

size_t hwdet::XMLElement::GetSubNodeCount ( void   )  const [inline]

Get number of sub-nodes of current node.

Returns:
Number of current node's sub-nodes.

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.

Parameters:
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.

Parameters:
e New parent node.


Field Documentation

size_t hwdet::XMLElement::depth [protected]

Depth of current node (it is used to align output in stream).

String hwdet::XMLElement::name [protected]

Name of the node.

Reimplemented in hwdet::BasicFeatures, and hwdet::DiskPartition.

std::vector< XMLElement* > hwdet::XMLElement::nodes [protected]

List of child nodes.

XMLElement* hwdet::XMLElement::parent [protected]

Parent nodes.


The documentation for this class was generated from the following file:
Generated on Tue Dec 19 17:43:51 2006 for Detector for Linux by  doxygen 1.4.7