Gaudi Framework, version v23r9
Home
Generated: Thu Jul 18 2013
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
GaudiCoreSvc
src
JobOptionsSvc
Node.cpp
Go to the documentation of this file.
1
// $Id:$
2
// ============================================================================
3
// Includes:
4
// ============================================================================
5
#include "
Node.h
"
6
// ============================================================================
7
// Boost:
8
// ============================================================================
9
#include <boost/foreach.hpp>
10
#include <boost/format.hpp>
11
// ============================================================================
12
namespace
gp = Gaudi::Parsers;
13
// ============================================================================
14
void
tab
(
std::string
* str,
int
indent) {
15
for
(
int
i
= 0;
i
< indent; ++
i
)
16
*str +=
' '
;
17
}
18
19
std::string
names
[100];
20
// ============================================================================
21
std::string
gp::Node::name()
const
{
22
static
bool
init =
false
;
23
if
(!init) {
// lazy init
24
names
[kRoot] =
"root"
;
25
names
[kInclude] =
"include"
;
26
names
[kIdentifier] =
"identifier"
;
27
names
[kProperty] =
"property"
;
28
names
[kOperation] =
"operation"
;
29
names
[kValue] =
"value"
;
30
names
[kAssign] =
"assign"
;
31
names
[kEqual] =
"equal"
;
32
names
[kPlusEqual] =
"plus_equal"
;
33
names
[kMinusEqual] =
"minus_equal"
;
34
names
[kVector] =
"vector"
;
35
names
[kMap] =
"map"
;
36
names
[kPair] =
"pair"
;
37
names
[kSimple] =
"simple"
;
38
names
[kString] =
"string"
;
39
names
[kReal] =
"real"
;
40
names
[kBool] =
"bool"
;
41
names
[kUnits] =
"units"
;
42
names
[kUnit] =
"unit"
;
43
names
[kCondition] =
"condition"
;
44
names
[kIfdef] =
"ifdef"
;
45
names
[kIfndef] =
"ifndef"
;
46
names
[kElse] =
"else"
;
47
names
[kPrintOptions] =
"print_options"
;
48
names
[kPrintOn] =
"print_on"
;
49
names
[kPrintOff] =
"print_off"
;
50
names
[kShell] =
"shell"
;
51
names
[kPrintTree] =
"print_tree"
;
52
names
[kDumpFile] =
"dump_file"
;
53
names
[kPropertyRef] =
"property_ref"
;
54
}
55
return
names
[
type
];
56
}
57
58
// ============================================================================
59
std::string
gp::Node::ToString()
const
{
60
return
ToString(0);
61
}
62
// ============================================================================
63
std::string
gp::Node::ToString(
int
indent)
const
{
64
65
std::string
result =
""
;
66
tab
(&result, indent);
67
result +=
"<"
+ name();
68
if
(value !=
""
)
69
result +=
" value=\""
+ value +
"\""
;
70
if
(position.line() != 0)
71
result +=
" line=\""
+ str(
boost::format
(
"%1%"
) % position.line())
72
+
"\""
;
73
if
(position.column() != 0)
74
result +=
" column=\""
+ str(
boost::format
(
"%1%"
) % position.column())
75
+
"\""
;
76
77
if
(children.size() == 0) {
78
result +=
"/>\n"
;
79
}
else
{
80
result +=
">\n"
;
81
BOOST_FOREACH(
Node
const
& node, children)
82
{
83
result += node.
ToString
(indent + 2);
84
}
85
tab
(&result, indent);
86
result += str(
boost::format
(
"</%1%>\n"
) % name());
87
}
88
return
result;
89
}
90
// ============================================================================
Generated at Thu Jul 18 2013 12:18:02 for Gaudi Framework, version v23r9 by
Doxygen
version 1.8.2 written by
Dimitri van Heesch
, © 1997-2004