PhoenixFileParser  1.5.1
Set of tools to ease file parsing
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
14ConfigNodeIter::ConfigNodeIter(const ConfigNode * current, std::ostream * out, bool isWriteMode)
16{
18}
19
21
26
31
33
37 copyConfigNodeIter(other);
38 return *this;
39}
40
42
47
49
51std::ostream * ConfigNodeIter::getOut(){
52 return p_out;
53}
54
57 const ConfigNode * parent = p_current->getParent();
58 if(parent != NULL){
59 p_current = (ConfigNode *)parent;
60 }
61}
62
64
67bool 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
88 return p_isWriteMode;
89}
90
92
99
104
105
106
107
108
bool p_isWriteMode
True if the ConfigNodeIter is in writing mode.
bool down(const PString &childName)
Move to the child of the current node.
void up()
Move to the parent of the current node.
ConfigNode * p_current
Current ConfigNode.
ConfigNodeIter & operator=(const ConfigNodeIter &other)
Definition of equal operator of ConfigNodeIter.
bool isWriteMode() const
Say if the iterator is in write mode.
ConfigNodeIter(const ConfigNodeIter &other)
Copy constructor of ConfigNodeIter.
ConfigNode * operator->()
Get the current ConfigNode.
virtual ~ConfigNodeIter()
Destructor of ConfigNodeIter.
std::ostream * p_out
std::ostream to be used for the error messages
void copyConfigNodeIter(const ConfigNodeIter &other)
Copy function of ConfigNodeIter.
std::ostream * getOut()
Get the pointer of the output stream.
void initialisationConfigNodeIter()
Initialisation function of the class ConfigNodeIter.