Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
easyDomNode Class Reference

#include <easydom.h>

Inheritance diagram for easyDomNode:
configNode tagDomNode missionNode

Public Member Functions

 easyDomNode ()
 
void set (easyDomNode *parent, string name, const XML_Char **atts)
 
void printNode (ostream &out, int recurse_level, int level)
 
void addChild (easyDomNode *child)
 
string Name ()
 
void set_attribute (string name, string value)
 
string attr_value (string attr_name)
 

Public Attributes

vector< easyDomNode * > subnodes
 

Detailed Description

Definition at line 56 of file easydom.h.

Constructor & Destructor Documentation

easyDomNode::easyDomNode ( )

Definition at line 34 of file easydom.cpp.

34 {}

Member Function Documentation

void easyDomNode::addChild ( easyDomNode child)

Definition at line 51 of file easydom.cpp.

References subnodes.

52 {
53  subnodes.push_back( child );
54 }
string easyDomNode::attr_value ( string  attr_name)
string easyDomNode::Name ( )
inline
void easyDomNode::printNode ( ostream &  out,
int  recurse_level,
int  level 
)

Definition at line 61 of file easydom.cpp.

References subnodes.

Referenced by VegaConfig::checkSection().

62 {
63  vsUMap< string, string >::const_iterator iter;
64 
65  out<<"<"<<name;
66  for (iter = attribute_map.begin(); iter != attribute_map.end(); iter++)
67  out<<" "<<(*iter).first<<"=\""<<(*iter).second<<"\"";
68  out<<">"<<endl;
69 
70  vector< easyDomNode* >::const_iterator siter;
71  if (recurse_level > 0)
72  for (siter = subnodes.begin(); siter != subnodes.end(); siter++)
73  (*siter)->printNode( out, recurse_level-1, level+1 );
74  if ( !(recurse_level == 0 && level == 0) )
75  out<<"</"<<name<<">"<<endl;
76 }
void easyDomNode::set ( easyDomNode parent,
string  name,
const XML_Char **  atts 
)

Definition at line 36 of file easydom.cpp.

37 {
38  parent = _parent;
39  if (atts != NULL) {
40  for (; *atts != NULL; atts += 2) {
41 #if 0
42  att_name.push_back( (*iter).name );
43  att_value.push_back( (*iter).value );
44 #endif
45  attribute_map[atts[0]] = atts[1];
46  }
47  }
48  name = _name;
49 }
void easyDomNode::set_attribute ( string  name,
string  value 
)
inline

Definition at line 70 of file easydom.h.

Referenced by VegaConfig::setVariable().

71  {
72  attribute_map[name] = value;
73  }

Member Data Documentation


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