ls1-MarDyn
ls1-MarDyn molecular dynamics code
Public Types | Public Member Functions | Friends | List of all members
XMLfile::Node Class Reference

Public Types

enum  NodeType {
  Unknown_Node =-1 , Invalid_Node =0 , ELEMENT_Node =1 , ATTRIBUTE_Node =2 ,
  TEXT_Node =3 , CDATA_SECTION_Node =4 , ENTITY_REFERENCE_Node =5 , ENTITY_Node =6 ,
  PROCESSING_INSTRUCTION_Node =7 , COMMENT_Node =8 , DOCUMENT_Node =9 , DOCUMENT_TYPE_Node =10 ,
  DOCUMENT_FRAGMENT_Node =11 , NOTATION_Node =12
}
 Node types enumeration associates a number to each XML node type. More...
 

Public Member Functions

 Node ()
 XMLfile::Node constructor sets up an invalid node.
 
 Node (const Node &n)
 XMLfile::Node copy constructor duplicate a node. More...
 
const std::string & nodepath () const
 get nodepath returns the full path of the node More...
 
std::string name () const
 get node name returns the name of the node, if node is valid - otherwise an empty string
 
void invalidate ()
 invalidate the node set the internal state to invalid
 
NodeType type () const
 get node type determine the node type (enumeration) More...
 
bool isRootNode () const
 check, if node is root node return true, if node is a valid root node - false otherwise More...
 
bool isLeafNode () const
 check, if node is leaf node return true, if node is a valid leaf node - false otherwise More...
 
template<typename T >
bool getValue (T &value) const
 get the node value returns the node value converted to a given type More...
 
std::string value_string (std::string defaultvalue=std::string()) const
 get the node string value returns the node value as string value or default value, if node is invalid More...
 
int value_int (int defaultvalue=0) const
 get the node int value returns the node value as int value or default value, if node is invalid More...
 
long value_long (long defaultvalue=0) const
 get the node long value returns the node value as long value or default value, if node is invalid More...
 
float value_float (float defaultvalue=0.) const
 get the node float value returns the node value as float value or default value, if node is invalid More...
 
double value_double (double defaultvalue=0.) const
 get the node double value returns the node value as double value or default value, if node is invalid More...
 
bool value_bool (bool defaultvalue=false) const
 get the node bool value returns the node value as bool value or default value, if node is invalid More...
 
Nodeoperator= (const Node &n)
 assignment operator copy/duplicate other node content to node More...
 
template<typename T >
 operator T () const
 template type cast operator return node content (getValue)
 
 operator bool () const
 bool cast operator check if Node is valid
 
void printXML (std::ostream &ostrm=std::cout) const
 print XML data to stream print the node content using XML syntax More...
 
void print (std::ostream &ostrm=std::cout) const
 print data to stream print the node data More...
 
Nodeoperator= (Node &node)
 
template<>
bool getValue (string &value) const
 
template<>
bool getValue (int &value) const
 
template<>
bool getValue (long &value) const
 
template<>
bool getValue (float &value) const
 
template<>
bool getValue (double &value) const
 
template<>
bool getValue (bool &value) const
 

Friends

class Query
 
class XMLfile
 

Member Enumeration Documentation

◆ NodeType

Node types enumeration associates a number to each XML node type.

Note
cmp. http://www.w3schools.com/Dom/dom_nodetype.asp

Constructor & Destructor Documentation

◆ Node()

XMLfile::Node::Node ( const Node n)
inline

XMLfile::Node copy constructor duplicate a node.

Parameters
XMLfile::Node&source node

Member Function Documentation

◆ getValue()

template<typename T >
bool XMLfile::Node::getValue ( T &  value) const

get the node value returns the node value converted to a given type

Parameters
T&Value to return
Returns
bool success?

◆ isLeafNode()

bool XMLfile::Node::isLeafNode ( ) const

check, if node is leaf node return true, if node is a valid leaf node - false otherwise

Returns
bool

◆ isRootNode()

bool XMLfile::Node::isRootNode ( ) const
inline

check, if node is root node return true, if node is a valid root node - false otherwise

Returns
bool

◆ nodepath()

const std::string& XMLfile::Node::nodepath ( ) const
inline

get nodepath returns the full path of the node

Returns
std::string nodepath

◆ operator=()

Node& XMLfile::Node::operator= ( const Node n)
inline

assignment operator copy/duplicate other node content to node

Parameters
XMLfile::Nodesource node
Returns
XMLfile::Node& reference to this node

◆ print()

void XMLfile::Node::print ( std::ostream &  ostrm = std::cout) const

print data to stream print the node data

Parameters
std::ostream&stream to write to (default: std::cout)

◆ printXML()

void XMLfile::Node::printXML ( std::ostream &  ostrm = std::cout) const

print XML data to stream print the node content using XML syntax

Parameters
std::ostream&stream to write to (default: std::cout)

◆ type()

NodeType XMLfile::Node::type ( ) const
inline

get node type determine the node type (enumeration)

Returns
XMLfile::Node::NodeType node type

◆ value_bool()

bool XMLfile::Node::value_bool ( bool  defaultvalue = false) const

get the node bool value returns the node value as bool value or default value, if node is invalid

Parameters
booldefault value (default: false)
Returns
bool return value

◆ value_double()

double XMLfile::Node::value_double ( double  defaultvalue = 0.) const

get the node double value returns the node value as double value or default value, if node is invalid

Parameters
doubledefault value (default: 0.)
Returns
double return value

◆ value_float()

float XMLfile::Node::value_float ( float  defaultvalue = 0.) const

get the node float value returns the node value as float value or default value, if node is invalid

Parameters
floatdefault value (default: 0.)
Returns
float return value

◆ value_int()

int XMLfile::Node::value_int ( int  defaultvalue = 0) const

get the node int value returns the node value as int value or default value, if node is invalid

Parameters
intdefault value (default: 0)
Returns
int return value

◆ value_long()

long XMLfile::Node::value_long ( long  defaultvalue = 0) const

get the node long value returns the node value as long value or default value, if node is invalid

Parameters
longdefault value (default: 0)
Returns
long return value

◆ value_string()

string XMLfile::Node::value_string ( std::string  defaultvalue = std::string()) const

get the node string value returns the node value as string value or default value, if node is invalid

Parameters
std::stringdefault value (default: empty string)
Returns
std:string return value

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