PhoenixFileParser
1.7.3
Set of tools to ease file parsing
Toggle main menu visibility
Loading...
Searching...
No Matches
ConfigNodeIter.cpp
Go to the documentation of this file.
1
/***************************************
2
Auteur : Pierre Aubert
3
Mail : pierre.aubert@lapp.in2p3.fr
4
Licence : CeCILL-C
5
****************************************/
6
7
8
#include "
ConfigNodeIter.h
"
9
11
14
ConfigNodeIter::ConfigNodeIter
(
const
ConfigNode
* current, std::ostream * out,
bool
isWriteMode
)
15
:
p_current
((
ConfigNode
*)current),
p_out
(out),
p_isWriteMode
(
isWriteMode
)
16
{
17
initialisationConfigNodeIter
();
18
}
19
21
23
ConfigNodeIter::ConfigNodeIter
(
const
ConfigNodeIter
& other){
24
copyConfigNodeIter
(other);
25
}
26
28
ConfigNodeIter::~ConfigNodeIter
(){
29
30
}
31
33
36
ConfigNodeIter
&
ConfigNodeIter::operator =
(
const
ConfigNodeIter
& other){
37
copyConfigNodeIter
(other);
38
return
*
this
;
39
}
40
42
44
ConfigNode
*
ConfigNodeIter::operator ->
(){
45
return
p_current
;
46
}
47
49
51
std::ostream *
ConfigNodeIter::getOut
(){
52
return
p_out
;
53
}
54
56
void
ConfigNodeIter::up
(){
57
const
ConfigNode
* parent =
p_current
->getParent();
58
if
(parent != NULL){
59
p_current
= (
ConfigNode
*)parent;
60
}
61
}
62
64
67
bool
ConfigNodeIter::down
(
const
PString & childName){
68
const
ConfigNode
* child =
p_current
->getChild(childName);
69
if
(child != NULL){
70
p_current
= (
ConfigNode
*)child;
71
return
true
;
72
}
else
{
73
if
(
p_isWriteMode
){
74
ConfigNode
* child =
p_current
->addChild(childName);
75
p_current
= child;
76
return
true
;
77
}
else
{
78
*
p_out
<<
"ConfigNodeIter::down : no child '"
<<childName<<
"' defined in ConfigNode "
<<
p_current
->getLocation() << std::endl;
79
return
false
;
80
}
81
}
82
}
83
85
87
bool
ConfigNodeIter::isWriteMode
()
const
{
88
return
p_isWriteMode
;
89
}
90
92
94
void
ConfigNodeIter::copyConfigNodeIter
(
const
ConfigNodeIter
& other){
95
p_current
= other.
p_current
;
96
p_out
= other.
p_out
;
97
p_isWriteMode
= other.
p_isWriteMode
;
98
}
99
101
void
ConfigNodeIter::initialisationConfigNodeIter
(){
102
103
}
104
105
106
107
108
ConfigNodeIter.h
ConfigNodeIter::p_isWriteMode
bool p_isWriteMode
True if the ConfigNodeIter is in writing mode.
Definition
ConfigNodeIter.h:50
ConfigNodeIter::down
bool down(const PString &childName)
Move to the child of the current node.
Definition
ConfigNodeIter.cpp:67
ConfigNodeIter::up
void up()
Move to the parent of the current node.
Definition
ConfigNodeIter.cpp:56
ConfigNodeIter::p_current
ConfigNode * p_current
Current ConfigNode.
Definition
ConfigNodeIter.h:46
ConfigNodeIter::operator=
ConfigNodeIter & operator=(const ConfigNodeIter &other)
Definition of equal operator of ConfigNodeIter.
Definition
ConfigNodeIter.cpp:36
ConfigNodeIter::isWriteMode
bool isWriteMode() const
Say if the iterator is in write mode.
Definition
ConfigNodeIter.cpp:87
ConfigNodeIter::ConfigNodeIter
ConfigNodeIter(const ConfigNodeIter &other)
Copy constructor of ConfigNodeIter.
Definition
ConfigNodeIter.cpp:23
ConfigNodeIter::operator->
ConfigNode * operator->()
Get the current ConfigNode.
Definition
ConfigNodeIter.cpp:44
ConfigNodeIter::~ConfigNodeIter
virtual ~ConfigNodeIter()
Destructor of ConfigNodeIter.
Definition
ConfigNodeIter.cpp:28
ConfigNodeIter::p_out
std::ostream * p_out
std::ostream to be used for the error messages
Definition
ConfigNodeIter.h:48
ConfigNodeIter::ConfigNode
friend ConfigNode
Definition
ConfigNodeIter.h:18
ConfigNodeIter::copyConfigNodeIter
void copyConfigNodeIter(const ConfigNodeIter &other)
Copy function of ConfigNodeIter.
Definition
ConfigNodeIter.cpp:94
ConfigNodeIter::getOut
std::ostream * getOut()
Get the pointer of the output stream.
Definition
ConfigNodeIter.cpp:51
ConfigNodeIter::initialisationConfigNodeIter
void initialisationConfigNodeIter()
Initialisation function of the class ConfigNodeIter.
Definition
ConfigNodeIter.cpp:101
src
ConfigNodeIter.cpp
Generated by
1.17.0