1 |
|
|
/*************************************** |
2 |
|
|
Auteur : Pierre Aubert |
3 |
|
|
Mail : pierre.aubert@lapp.in2p3.fr |
4 |
|
|
Licence : CeCILL-C |
5 |
|
|
****************************************/ |
6 |
|
|
|
7 |
|
|
|
8 |
|
|
|
9 |
|
|
//You should not modify this file |
10 |
|
|
|
11 |
|
|
// You can print the configuration of the data format on saved files with : |
12 |
|
|
// sed '/ENDOFCONFIG/q' fileName |
13 |
|
|
|
14 |
|
|
#include "PXml.h" |
15 |
|
|
|
16 |
|
|
|
17 |
|
|
/*********************************************************************** |
18 |
|
|
* * |
19 |
|
|
* Public functions of class PXmlAttr * |
20 |
|
|
* * |
21 |
|
|
************************************************************************/ |
22 |
|
|
|
23 |
|
|
|
24 |
|
|
///Constructor of the class PXmlAttr |
25 |
|
29 |
PXmlAttr::PXmlAttr(){ |
26 |
✓ |
29 |
initialisationPXmlAttr(); |
27 |
|
29 |
} |
28 |
|
|
|
29 |
|
|
///Copy constructor of the class PXmlAttr |
30 |
|
|
/** @param other : other variable |
31 |
|
|
*/ |
32 |
|
48 |
PXmlAttr::PXmlAttr(const PXmlAttr & other){ |
33 |
✓ |
48 |
initialisationPXmlAttr(); |
34 |
✓ |
48 |
copyPXmlAttr(other); |
35 |
|
48 |
} |
36 |
|
|
|
37 |
|
|
///Destructor of the class PXmlAttr |
38 |
|
154 |
PXmlAttr::~PXmlAttr(){ |
39 |
|
|
|
40 |
|
|
} |
41 |
|
|
|
42 |
|
|
///Equal operator of the class PXmlAttr |
43 |
|
|
/** @param other : other variable |
44 |
|
|
* @return copied Attribute from xml |
45 |
|
|
*/ |
46 |
|
6 |
PXmlAttr & PXmlAttr::operator =(const PXmlAttr & other){ |
47 |
|
6 |
copyPXmlAttr(other); |
48 |
|
6 |
return *this; |
49 |
|
|
} |
50 |
|
|
|
51 |
|
|
///Set the variable p_name, of type 'std ::string' |
52 |
|
|
/** @param name : Name of the attribute |
53 |
|
|
*/ |
54 |
|
11 |
void PXmlAttr::setName(const std ::string & name){ |
55 |
|
11 |
p_name = name; |
56 |
|
11 |
} |
57 |
|
|
|
58 |
|
|
///Set the variable p_value, of type 'std ::string' |
59 |
|
|
/** @param value : Value of the attribute |
60 |
|
|
*/ |
61 |
|
10 |
void PXmlAttr::setValue(const std ::string & value){ |
62 |
|
10 |
p_value = value; |
63 |
|
10 |
} |
64 |
|
|
|
65 |
|
|
///Get the variable p_name |
66 |
|
|
/** @return Name of the attribute |
67 |
|
|
*/ |
68 |
|
15 |
const std ::string & PXmlAttr::getName() const{ |
69 |
|
15 |
return p_name; |
70 |
|
|
} |
71 |
|
|
|
72 |
|
|
///Get the variable p_name |
73 |
|
|
/** @return Name of the attribute |
74 |
|
|
*/ |
75 |
|
2 |
std ::string & PXmlAttr::getName(){ |
76 |
|
2 |
return p_name; |
77 |
|
|
} |
78 |
|
|
|
79 |
|
|
///Get the variable p_value |
80 |
|
|
/** @return Value of the attribute |
81 |
|
|
*/ |
82 |
|
10 |
const std ::string & PXmlAttr::getValue() const{ |
83 |
|
10 |
return p_value; |
84 |
|
|
} |
85 |
|
|
|
86 |
|
|
///Get the variable p_value |
87 |
|
|
/** @return Value of the attribute |
88 |
|
|
*/ |
89 |
|
7 |
std ::string & PXmlAttr::getValue(){ |
90 |
|
7 |
return p_value; |
91 |
|
|
} |
92 |
|
|
|
93 |
|
|
/*********************************************************************** |
94 |
|
|
* * |
95 |
|
|
* Private functions of class PXmlAttr * |
96 |
|
|
* * |
97 |
|
|
************************************************************************/ |
98 |
|
|
|
99 |
|
|
|
100 |
|
|
///Initialisation function of the class PXmlAttr |
101 |
|
77 |
void PXmlAttr::initialisationPXmlAttr(){ |
102 |
|
77 |
p_flag = 0lu; |
103 |
|
|
|
104 |
|
77 |
} |
105 |
|
|
|
106 |
|
|
///Copy function of the class PXmlAttr |
107 |
|
|
/** @param other : other variable |
108 |
|
|
*/ |
109 |
|
54 |
void PXmlAttr::copyPXmlAttr(const PXmlAttr & other){ |
110 |
|
54 |
p_name = other.p_name; |
111 |
|
54 |
p_value = other.p_value; |
112 |
|
|
|
113 |
|
54 |
} |
114 |
|
|
|
115 |
|
|
/*********************************************************************** |
116 |
|
|
* * |
117 |
|
|
* Public functions of class PXml * |
118 |
|
|
* * |
119 |
|
|
************************************************************************/ |
120 |
|
|
|
121 |
|
|
|
122 |
|
|
///Constructor of the class PXml |
123 |
|
207 |
PXml::PXml(){ |
124 |
✓ |
207 |
initialisationPXml(); |
125 |
|
207 |
} |
126 |
|
|
|
127 |
|
|
///Copy constructor of the class PXml |
128 |
|
|
/** @param other : other variable |
129 |
|
|
*/ |
130 |
|
755 |
PXml::PXml(const PXml & other){ |
131 |
✓ |
755 |
initialisationPXml(); |
132 |
✓ |
755 |
copyPXml(other); |
133 |
|
755 |
} |
134 |
|
|
|
135 |
|
|
///Destructor of the class PXml |
136 |
|
1924 |
PXml::~PXml(){ |
137 |
|
|
|
138 |
|
|
} |
139 |
|
|
|
140 |
|
|
///Equal operator of the class PXml |
141 |
|
|
/** @param other : other variable |
142 |
|
|
* @return copied @brief Class used to parse xml |
143 |
|
|
*/ |
144 |
|
3 |
PXml & PXml::operator =(const PXml & other){ |
145 |
|
3 |
copyPXml(other); |
146 |
|
3 |
return *this; |
147 |
|
|
} |
148 |
|
|
|
149 |
|
|
///Set the variable p_name, of type 'std ::string' |
150 |
|
|
/** @param name : Name of the class |
151 |
|
|
*/ |
152 |
|
99 |
void PXml::setName(const std ::string & name){ |
153 |
|
99 |
p_name = name; |
154 |
|
99 |
} |
155 |
|
|
|
156 |
|
|
///Set the variable p_isCompact, of type 'bool' |
157 |
|
|
/** @param isCompact : Say if the balise is compact or not |
158 |
|
|
*/ |
159 |
|
73 |
void PXml::setIsCompact(bool isCompact){ |
160 |
|
73 |
p_isCompact = isCompact; |
161 |
|
73 |
} |
162 |
|
|
|
163 |
|
|
///Set the variable p_value, of type 'std ::string' |
164 |
|
|
/** @param value : Value between the <b>chevron</b> |
165 |
|
|
*/ |
166 |
|
118 |
void PXml::setValue(const std ::string & value){ |
167 |
|
118 |
p_value = value; |
168 |
|
118 |
} |
169 |
|
|
|
170 |
|
|
///Set the variable p_isText, of type 'bool' |
171 |
|
|
/** @param isText : Say if the balise contains text only |
172 |
|
|
*/ |
173 |
|
93 |
void PXml::setIsText(bool isText){ |
174 |
|
93 |
p_isText = isText; |
175 |
|
93 |
} |
176 |
|
|
|
177 |
|
|
///Set the variable p_vecAttr, of type 'std ::vector<PXmlAttr>' |
178 |
|
|
/** @param vecAttr : Vector of attribute |
179 |
|
|
*/ |
180 |
|
3 |
void PXml::setVecAttr(const std ::vector<PXmlAttr> & vecAttr){ |
181 |
|
3 |
p_vecAttr = vecAttr; |
182 |
|
3 |
} |
183 |
|
|
|
184 |
|
|
///Set the variable p_vecChild, of type 'std ::vector<PXml>' |
185 |
|
|
/** @param vecChild : Child of the current PXml |
186 |
|
|
*/ |
187 |
|
1 |
void PXml::setVecChild(const std ::vector<PXml> & vecChild){ |
188 |
|
1 |
p_vecChild = vecChild; |
189 |
|
1 |
} |
190 |
|
|
|
191 |
|
|
///Get the variable p_name |
192 |
|
|
/** @return Name of the class |
193 |
|
|
*/ |
194 |
|
230 |
const std ::string & PXml::getName() const{ |
195 |
|
230 |
return p_name; |
196 |
|
|
} |
197 |
|
|
|
198 |
|
|
///Get the variable p_name |
199 |
|
|
/** @return Name of the class |
200 |
|
|
*/ |
201 |
|
154 |
std ::string & PXml::getName(){ |
202 |
|
154 |
return p_name; |
203 |
|
|
} |
204 |
|
|
|
205 |
|
|
///Get the variable p_isCompact |
206 |
|
|
/** @return Say if the balise is compact or not |
207 |
|
|
*/ |
208 |
|
84 |
bool PXml::getIsCompact() const{ |
209 |
|
84 |
return p_isCompact; |
210 |
|
|
} |
211 |
|
|
|
212 |
|
|
///Get the variable p_isCompact |
213 |
|
|
/** @return Say if the balise is compact or not |
214 |
|
|
*/ |
215 |
|
73 |
bool & PXml::getIsCompact(){ |
216 |
|
73 |
return p_isCompact; |
217 |
|
|
} |
218 |
|
|
|
219 |
|
|
///Get the variable p_value |
220 |
|
|
/** @return Value between the <b>chevron</b> |
221 |
|
|
*/ |
222 |
|
204 |
const std ::string & PXml::getValue() const{ |
223 |
|
204 |
return p_value; |
224 |
|
|
} |
225 |
|
|
|
226 |
|
|
///Get the variable p_value |
227 |
|
|
/** @return Value between the <b>chevron</b> |
228 |
|
|
*/ |
229 |
|
157 |
std ::string & PXml::getValue(){ |
230 |
|
157 |
return p_value; |
231 |
|
|
} |
232 |
|
|
|
233 |
|
|
///Get the variable p_isText |
234 |
|
|
/** @return Say if the balise contains text only |
235 |
|
|
*/ |
236 |
|
157 |
bool PXml::getIsText() const{ |
237 |
|
157 |
return p_isText; |
238 |
|
|
} |
239 |
|
|
|
240 |
|
|
///Get the variable p_isText |
241 |
|
|
/** @return Say if the balise contains text only |
242 |
|
|
*/ |
243 |
|
1 |
bool & PXml::getIsText(){ |
244 |
|
1 |
return p_isText; |
245 |
|
|
} |
246 |
|
|
|
247 |
|
|
///Get the variable p_vecAttr |
248 |
|
|
/** @return Vector of attribute |
249 |
|
|
*/ |
250 |
|
102 |
const std ::vector<PXmlAttr> & PXml::getVecAttr() const{ |
251 |
|
102 |
return p_vecAttr; |
252 |
|
|
} |
253 |
|
|
|
254 |
|
|
///Get the variable p_vecAttr |
255 |
|
|
/** @return Vector of attribute |
256 |
|
|
*/ |
257 |
|
11 |
std ::vector<PXmlAttr> & PXml::getVecAttr(){ |
258 |
|
11 |
return p_vecAttr; |
259 |
|
|
} |
260 |
|
|
|
261 |
|
|
///Get the variable p_vecChild |
262 |
|
|
/** @return Child of the current PXml |
263 |
|
|
*/ |
264 |
|
164 |
const std ::vector<PXml> & PXml::getVecChild() const{ |
265 |
|
164 |
return p_vecChild; |
266 |
|
|
} |
267 |
|
|
|
268 |
|
|
///Get the variable p_vecChild |
269 |
|
|
/** @return Child of the current PXml |
270 |
|
|
*/ |
271 |
|
296 |
std ::vector<PXml> & PXml::getVecChild(){ |
272 |
|
296 |
return p_vecChild; |
273 |
|
|
} |
274 |
|
|
|
275 |
|
|
/*********************************************************************** |
276 |
|
|
* * |
277 |
|
|
* Private functions of class PXml * |
278 |
|
|
* * |
279 |
|
|
************************************************************************/ |
280 |
|
|
|
281 |
|
|
|
282 |
|
|
///Initialisation function of the class PXml |
283 |
|
962 |
void PXml::initialisationPXml(){ |
284 |
|
962 |
p_flag = 0lu; |
285 |
|
|
///Say if the balise is compact or not |
286 |
|
962 |
p_isCompact = 0; |
287 |
|
|
///Say if the balise contains text only |
288 |
|
962 |
p_isText = 0; |
289 |
|
|
|
290 |
|
962 |
} |
291 |
|
|
|
292 |
|
|
///Copy function of the class PXml |
293 |
|
|
/** @param other : other variable |
294 |
|
|
*/ |
295 |
|
758 |
void PXml::copyPXml(const PXml & other){ |
296 |
|
758 |
p_name = other.p_name; |
297 |
|
758 |
p_isCompact = other.p_isCompact; |
298 |
|
758 |
p_value = other.p_value; |
299 |
|
758 |
p_isText = other.p_isText; |
300 |
|
758 |
p_vecAttr = other.p_vecAttr; |
301 |
|
758 |
p_vecChild = other.p_vecChild; |
302 |
|
|
|
303 |
|
758 |
} |
304 |
|
|
|
305 |
|
|
|
306 |
|
|
|