ATLAS Offline Software
Public Types | Public Member Functions | Public Attributes | List of all members
CoreParser::DOMNode Class Reference

#include <DOMNode.h>

Collaboration diagram for CoreParser::DOMNode:

Public Types

enum  NodeType {
  DOCUMENT_NODE, ELEMENT_NODE, COMMENT_NODE, ENTITY_NODE,
  ENTITY_REFERENCE_NODE
}
 

Public Member Functions

 DOMNode ()
 
 DOMNode (NodeType type, const std::string &name, DOMNode *parent=0)
 
 DOMNode (NodeType type, const std::string &name, const std::string &value, DOMNode *parent=0)
 
 ~DOMNode ()
 
NodeType get_type () const
 
const DOMNamedNodeMapget_attributes () const
 
const std::string & get_name () const
 
const std::string & get_value () const
 
const DOMSiblingsget_siblings () const
 
unsigned int sibling_number () const
 
DOMNodeget_first_child ()
 
DOMNodeget_next_sibling ()
 
void print (const std::string &header="", int depth=0) const
 

Public Attributes

NodeType m_type
 
std::string m_name
 
std::string m_value
 
DOMNamedNodeMap m_attributes
 
DOMSiblings m_siblings
 
DOMSiblings::iterator m_it
 
DOMNodem_parent
 

Detailed Description

Definition at line 20 of file DOMNode.h.

Member Enumeration Documentation

◆ NodeType

Enumerator
DOCUMENT_NODE 
ELEMENT_NODE 
COMMENT_NODE 
ENTITY_NODE 
ENTITY_REFERENCE_NODE 

Definition at line 23 of file DOMNode.h.

Constructor & Destructor Documentation

◆ DOMNode() [1/3]

CoreParser::DOMNode::DOMNode ( )

Definition at line 18 of file DOMNode.cxx.

19 {
20 }

◆ DOMNode() [2/3]

CoreParser::DOMNode::DOMNode ( NodeType  type,
const std::string &  name,
DOMNode parent = 0 
)

Definition at line 22 of file DOMNode.cxx.

22  :
24 {
25  if (parent != 0)
26  {
27  parent->m_siblings.push_back (this);
28  }
29 
30  if (type == COMMENT_NODE)
31  {
32  m_value = name;
33  m_name = "";
34  }
35 }

◆ DOMNode() [3/3]

CoreParser::DOMNode::DOMNode ( NodeType  type,
const std::string &  name,
const std::string &  value,
DOMNode parent = 0 
)

Definition at line 37 of file DOMNode.cxx.

37  :
39 {
40  if (parent != 0)
41  {
42  parent->m_siblings.push_back (this);
43  }
44 
45  if (type == COMMENT_NODE)
46  {
47  m_value = name;
48  m_name = "";
49  }
50 }

◆ ~DOMNode()

CoreParser::DOMNode::~DOMNode ( )

Definition at line 52 of file DOMNode.cxx.

53 {
55 
56  for (sit = m_siblings.begin (); sit != m_siblings.end (); ++sit)
57  {
58  const DOMNode* n = *sit;
59 
60  delete n;
61  }
62 }

Member Function Documentation

◆ get_attributes()

const CoreParser::DOMNamedNodeMap & CoreParser::DOMNode::get_attributes ( ) const

Definition at line 69 of file DOMNode.cxx.

70 {
71  return (m_attributes);
72 }

◆ get_first_child()

CoreParser::DOMNode * CoreParser::DOMNode::get_first_child ( )

Definition at line 94 of file DOMNode.cxx.

95 {
96  m_it = m_siblings.begin ();
97  if (m_it == m_siblings.end ()) return (0);
98  return (*m_it);
99 }

◆ get_name()

const std::string & CoreParser::DOMNode::get_name ( ) const

Definition at line 74 of file DOMNode.cxx.

75 {
76  return (m_name);
77 }

◆ get_next_sibling()

CoreParser::DOMNode * CoreParser::DOMNode::get_next_sibling ( )

Definition at line 101 of file DOMNode.cxx.

102 {
103  if (m_it == m_siblings.end ()) return (0);
104  ++m_it;
105  if (m_it == m_siblings.end ()) return (0);
106  return (*m_it);
107 }

◆ get_siblings()

const CoreParser::DOMSiblings & CoreParser::DOMNode::get_siblings ( ) const

Definition at line 84 of file DOMNode.cxx.

85 {
86  return (m_siblings);
87 }

◆ get_type()

CoreParser::DOMNode::NodeType CoreParser::DOMNode::get_type ( ) const

Definition at line 64 of file DOMNode.cxx.

65 {
66  return (m_type);
67 }

◆ get_value()

const std::string & CoreParser::DOMNode::get_value ( ) const

Definition at line 79 of file DOMNode.cxx.

80 {
81  return (m_value);
82 }

◆ print()

void CoreParser::DOMNode::print ( const std::string &  header = "",
int  depth = 0 
) const

Definition at line 109 of file DOMNode.cxx.

111 {
112  if (header != "")
113  {
114  std::cout << header << std::endl;
115  }
116 
117  int i;
118 
119  if (m_type == COMMENT_NODE)
120  {
121  for (i = 0; i < depth; i++) std::cout << " ";
122  std::cout << "<!--" << m_value << "-->" << std::endl;
123  }
124  /*
125  else if (m_type == DOCUMENT_NODE)
126  {
127  }
128  */
129  else
130  {
131  for (i = 0; i < depth; i++) std::cout << " ";
132  std::cout << "<" << m_name;
133 
134  std::map <std::string, std::string>::const_iterator ait;
135 
136  for (ait = m_attributes.begin (); ait != m_attributes.end (); ++ait)
137  {
138  const std::string& n = (*ait).first;
139  const std::string& v = (*ait).second;
140 
141  std::cout << " " << n << "='" << v << "'";
142  }
143 
144  std::cout << ">" << std::endl;
145 
146  DOMSiblings::const_iterator sit;
147 
148  for (sit = m_siblings.begin (); sit != m_siblings.end (); ++sit)
149  {
150  const DOMNode* n = *sit;
151 
152  n->print ("", depth+1);
153  }
154 
155  for (i = 0; i < depth; i++) std::cout << " ";
156  std::cout << "</" << m_name << ">" << std::endl;
157  }
158 }

◆ sibling_number()

unsigned int CoreParser::DOMNode::sibling_number ( ) const

Definition at line 89 of file DOMNode.cxx.

90 {
91  return (m_siblings.size ());
92 }

Member Data Documentation

◆ m_attributes

DOMNamedNodeMap CoreParser::DOMNode::m_attributes

Definition at line 49 of file DOMNode.h.

◆ m_it

DOMSiblings::iterator CoreParser::DOMNode::m_it

Definition at line 51 of file DOMNode.h.

◆ m_name

std::string CoreParser::DOMNode::m_name

Definition at line 47 of file DOMNode.h.

◆ m_parent

DOMNode* CoreParser::DOMNode::m_parent

Definition at line 52 of file DOMNode.h.

◆ m_siblings

DOMSiblings CoreParser::DOMNode::m_siblings

Definition at line 50 of file DOMNode.h.

◆ m_type

NodeType CoreParser::DOMNode::m_type

Definition at line 46 of file DOMNode.h.

◆ m_value

std::string CoreParser::DOMNode::m_value

Definition at line 48 of file DOMNode.h.


The documentation for this class was generated from the following files:
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
egammaParameters::depth
@ depth
pointing depth of the shower as calculated in egammaqgcld
Definition: egammaParamDefs.h:276
header
Definition: hcg.cxx:526
CoreParser::DOMNode::m_type
NodeType m_type
Definition: DOMNode.h:46
CoreParser::DOMNode::m_it
DOMSiblings::iterator m_it
Definition: DOMNode.h:51
athena.value
value
Definition: athena.py:122
CoreParser::DOMNode::DOMNode
DOMNode()
Definition: DOMNode.cxx:18
CoreParser::DOMNode::ENTITY_NODE
@ ENTITY_NODE
Definition: DOMNode.h:28
CoreParser::DOMNode::DOCUMENT_NODE
@ DOCUMENT_NODE
Definition: DOMNode.h:25
CoreParser::DOMNode::COMMENT_NODE
@ COMMENT_NODE
Definition: DOMNode.h:27
lumiFormat.i
int i
Definition: lumiFormat.py:92
beamspotman.n
n
Definition: beamspotman.py:731
CoreParser::DOMNode::ELEMENT_NODE
@ ELEMENT_NODE
Definition: DOMNode.h:26
test_pyathena.parent
parent
Definition: test_pyathena.py:15
CoreParser::DOMNode::m_value
std::string m_value
Definition: DOMNode.h:48
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
CoreParser::DOMNode::ENTITY_REFERENCE_NODE
@ ENTITY_REFERENCE_NODE
Definition: DOMNode.h:29
CoreParser::DOMNode::m_name
std::string m_name
Definition: DOMNode.h:47
python.PyAthena.v
v
Definition: PyAthena.py:157
CoreParser::DOMNode::m_siblings
DOMSiblings m_siblings
Definition: DOMNode.h:50
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
CoreParser::DOMNode::NodeType
NodeType
Definition: DOMNode.h:24
CoreParser::DOMNode::m_attributes
DOMNamedNodeMap m_attributes
Definition: DOMNode.h:49
CoreParser::DOMNode::m_parent
DOMNode * m_parent
Definition: DOMNode.h:52