The Gaudi Framework  v32r2 (46d42edc)
Gaudi::Parsers::Node Struct Referencefinal

#include <src/JobOptionsSvc/Node.h>

Collaboration diagram for Gaudi::Parsers::Node:

Public Types

enum  NodeType {
  kRoot, kInclude, kIdentifier, kProperty,
  kOperation, kValue, kAssign, kEqual,
  kPlusEqual, kMinusEqual, kVector, kMap,
  kPair, kSimple, kString, kReal,
  kBool, kUnits, kUnit, kCondition,
  kIfdef, kIfndef, kElse, kPrintOptions,
  kPrintOn, kPrintOff, kShell, kPrintTree,
  kDumpFile, kPropertyRef, number_of_node_types
}
 

Public Member Functions

 Node ()=default
 
std::string name () const
 
std::string ToString (int indent=0) const
 

Public Attributes

NodeType type = kRoot
 
std::string value
 
std::vector< Nodechildren
 
Position position
 

Detailed Description

Definition at line 25 of file Node.h.

Member Enumeration Documentation

◆ NodeType

enum Gaudi::Parsers::Node::NodeType
Enumerator
kRoot 
kInclude 
kIdentifier 
kProperty 
kOperation 
kValue 
kAssign 
kEqual 
kPlusEqual 
kMinusEqual 
kVector 
kMap 
kPair 
kSimple 
kString 
kReal 
kBool 
kUnits 
kUnit 
kCondition 
kIfdef 
kIfndef 
kElse 
kPrintOptions 
kPrintOn 
kPrintOff 
kShell 
kPrintTree 
kDumpFile 
kPropertyRef 
number_of_node_types 

Definition at line 26 of file Node.h.

26  {
27  kRoot,
28  kInclude,
30  kProperty,
31  kOperation,
32  kValue,
33  kAssign,
34  kEqual,
35  kPlusEqual,
37  kVector,
38  kMap,
39  kPair,
40  kSimple,
41  kString,
42  kReal,
43  kBool,
44  kUnits,
45  kUnit,
46  kCondition,
47  kIfdef,
48  kIfndef,
49  kElse,
51  kPrintOn,
52  kPrintOff,
53  kShell,
54  kPrintTree,
55  kDumpFile,
58  };

Constructor & Destructor Documentation

◆ Node()

Gaudi::Parsers::Node::Node ( )
default

Member Function Documentation

◆ name()

std::string Gaudi::Parsers::Node::name ( ) const

Definition at line 47 of file Node.cpp.

47  {
48  static const auto names = init_names();
49  return names[type];
50 }
std::vector< std::string > init_names()
Definition: Node.cpp:11
NodeType type
Definition: Node.h:59

◆ ToString()

std::string Gaudi::Parsers::Node::ToString ( int  indent = 0) const

Definition at line 53 of file Node.cpp.

53  {
54 
55  std::string result( indent, ' ' );
56  result += "<" + name();
57  if ( !value.empty() ) result += " value=\"" + value + "\"";
58  if ( position.line() != 0 ) result += " line=\"" + std::to_string( position.line() ) + "\"";
59  if ( position.column() != 0 ) result += " column=\"" + std::to_string( position.column() ) + "\"";
60  if ( children.empty() ) {
61  result += "/>\n";
62  } else {
63  result = std::accumulate( std::begin( children ), std::end( children ), result + ">\n",
64  [&]( std::string s, const gp::Node& node ) { return s + node.ToString( indent + 2 ); } )
65  .append( ' ', indent ) +
66  "</" + name() + ">\n";
67  }
68  return result;
69 }
T empty(T... args)
T to_string(T... args)
T end(T... args)
unsigned column() const
Definition: Position.h:20
STL class.
std::vector< Node > children
Definition: Node.h:61
std::string name() const
Definition: Node.cpp:47
Position position
Definition: Node.h:62
unsigned line() const
Definition: Position.h:19
T begin(T... args)
string s
Definition: gaudirun.py:318
T accumulate(T... args)
std::string value
Definition: Node.h:60

Member Data Documentation

◆ children

std::vector<Node> Gaudi::Parsers::Node::children

Definition at line 61 of file Node.h.

◆ position

Position Gaudi::Parsers::Node::position

Definition at line 62 of file Node.h.

◆ type

NodeType Gaudi::Parsers::Node::type = kRoot

Definition at line 59 of file Node.h.

◆ value

std::string Gaudi::Parsers::Node::value

Definition at line 60 of file Node.h.


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