Directory: | ./ |
---|---|
File: | tmp_project/PhoenixXml/src/PXml.cpp |
Date: | 2025-03-14 12:04:36 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 98 | 98 | 100.0% |
Branches: | 10 | 10 | 100.0% |
Line | Branch | Exec | Source |
---|---|---|---|
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 |
1/1✓ Branch 2 taken 21898 times.
|
21898 | PXmlAttr::PXmlAttr(){ |
26 |
1/1✓ Branch 1 taken 21898 times.
|
21898 | initialisationPXmlAttr(); |
27 | 21898 | } | |
28 | |||
29 | ///Copy constructor of the class PXmlAttr | ||
30 | /** @param other : other variable | ||
31 | */ | ||
32 |
1/1✓ Branch 2 taken 802114 times.
|
802114 | PXmlAttr::PXmlAttr(const PXmlAttr & other){ |
33 |
1/1✓ Branch 1 taken 802114 times.
|
802114 | initialisationPXmlAttr(); |
34 |
1/1✓ Branch 1 taken 802114 times.
|
802114 | copyPXmlAttr(other); |
35 | 802114 | } | |
36 | |||
37 | ///Destructor of the class PXmlAttr | ||
38 | 1648024 | 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 | 21206 | PXmlAttr & PXmlAttr::operator =(const PXmlAttr & other){ | |
47 | 21206 | copyPXmlAttr(other); | |
48 | 21206 | return *this; | |
49 | } | ||
50 | |||
51 | ///Set the variable p_name, of type 'PString' | ||
52 | /** @param name : Name of the attribute | ||
53 | */ | ||
54 | 21868 | void PXmlAttr::setName(const PString & name){ | |
55 | 21868 | p_name = name; | |
56 | 21868 | } | |
57 | |||
58 | ///Set the variable p_value, of type 'PString' | ||
59 | /** @param value : Value of the attribute | ||
60 | */ | ||
61 | 21928 | void PXmlAttr::setValue(const PString & value){ | |
62 | 21928 | p_value = value; | |
63 | 21928 | } | |
64 | |||
65 | ///Get the variable p_name | ||
66 | /** @return Name of the attribute | ||
67 | */ | ||
68 | 194205 | const PString & PXmlAttr::getName() const{ | |
69 | 194205 | return p_name; | |
70 | } | ||
71 | |||
72 | ///Get the variable p_name | ||
73 | /** @return Name of the attribute | ||
74 | */ | ||
75 | 243 | PString & PXmlAttr::getName(){ | |
76 | 243 | return p_name; | |
77 | } | ||
78 | |||
79 | ///Get the variable p_value | ||
80 | /** @return Value of the attribute | ||
81 | */ | ||
82 | 194165 | const PString & PXmlAttr::getValue() const{ | |
83 | 194165 | return p_value; | |
84 | } | ||
85 | |||
86 | ///Get the variable p_value | ||
87 | /** @return Value of the attribute | ||
88 | */ | ||
89 | 19 | PString & PXmlAttr::getValue(){ | |
90 | 19 | 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 | 824012 | void PXmlAttr::initialisationPXmlAttr(){ | |
102 | 824012 | p_flag = 0lu; | |
103 | |||
104 | 824012 | } | |
105 | |||
106 | ///Copy function of the class PXmlAttr | ||
107 | /** @param other : other variable | ||
108 | */ | ||
109 | 823320 | void PXmlAttr::copyPXmlAttr(const PXmlAttr & other){ | |
110 | 823320 | p_name = other.p_name; | |
111 | 823320 | p_value = other.p_value; | |
112 | |||
113 | 823320 | } | |
114 | |||
115 | /*********************************************************************** | ||
116 | * * | ||
117 | * Public functions of class PXml * | ||
118 | * * | ||
119 | ************************************************************************/ | ||
120 | |||
121 | |||
122 | ///Constructor of the class PXml | ||
123 |
1/1✓ Branch 2 taken 5452 times.
|
5452 | PXml::PXml(){ |
124 |
1/1✓ Branch 1 taken 5452 times.
|
5452 | initialisationPXml(); |
125 | 5452 | } | |
126 | |||
127 | ///Copy constructor of the class PXml | ||
128 | /** @param other : other variable | ||
129 | */ | ||
130 |
1/1✓ Branch 2 taken 347351 times.
|
347351 | PXml::PXml(const PXml & other){ |
131 |
1/1✓ Branch 1 taken 347351 times.
|
347351 | initialisationPXml(); |
132 |
1/1✓ Branch 1 taken 347351 times.
|
347351 | copyPXml(other); |
133 | 347351 | } | |
134 | |||
135 | ///Destructor of the class PXml | ||
136 | 705606 | 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 | 9718 | PXml & PXml::operator =(const PXml & other){ | |
145 | 9718 | copyPXml(other); | |
146 | 9718 | return *this; | |
147 | } | ||
148 | |||
149 | ///Set the variable p_name, of type 'PString' | ||
150 | /** @param name : Name of the class | ||
151 | */ | ||
152 | 5031 | void PXml::setName(const PString & name){ | |
153 | 5031 | p_name = name; | |
154 | 5031 | } | |
155 | |||
156 | ///Set the variable p_isCompact, of type 'bool' | ||
157 | /** @param isCompact : Say if the balise is compact or not | ||
158 | */ | ||
159 | 4992 | void PXml::setIsCompact(bool isCompact){ | |
160 | 4992 | p_isCompact = isCompact; | |
161 | 4992 | } | |
162 | |||
163 | ///Set the variable p_value, of type 'PString' | ||
164 | /** @param value : Value between the <b>chevron</b> | ||
165 | */ | ||
166 | 5247 | void PXml::setValue(const PString & value){ | |
167 | 5247 | p_value = value; | |
168 | 5247 | } | |
169 | |||
170 | ///Set the variable p_isText, of type 'bool' | ||
171 | /** @param isText : Say if the balise contains text only | ||
172 | */ | ||
173 | 414 | void PXml::setIsText(bool isText){ | |
174 | 414 | p_isText = isText; | |
175 | 414 | } | |
176 | |||
177 | ///Set the variable p_vecAttr, of type 'std ::vector<PXmlAttr>' | ||
178 | /** @param vecAttr : Vector of attribute | ||
179 | */ | ||
180 | 4 | void PXml::setVecAttr(const std ::vector<PXmlAttr> & vecAttr){ | |
181 | 4 | p_vecAttr = vecAttr; | |
182 | 4 | } | |
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 | 89332 | const PString & PXml::getName() const{ | |
195 | 89332 | return p_name; | |
196 | } | ||
197 | |||
198 | ///Get the variable p_name | ||
199 | /** @return Name of the class | ||
200 | */ | ||
201 | 505 | PString & PXml::getName(){ | |
202 | 505 | return p_name; | |
203 | } | ||
204 | |||
205 | ///Get the variable p_isCompact | ||
206 | /** @return Say if the balise is compact or not | ||
207 | */ | ||
208 | 43740 | bool PXml::getIsCompact() const{ | |
209 | 43740 | return p_isCompact; | |
210 | } | ||
211 | |||
212 | ///Get the variable p_isCompact | ||
213 | /** @return Say if the balise is compact or not | ||
214 | */ | ||
215 | 4992 | bool & PXml::getIsCompact(){ | |
216 | 4992 | return p_isCompact; | |
217 | } | ||
218 | |||
219 | ///Get the variable p_value | ||
220 | /** @return Value between the <b>chevron</b> | ||
221 | */ | ||
222 | 48143 | const PString & PXml::getValue() const{ | |
223 | 48143 | return p_value; | |
224 | } | ||
225 | |||
226 | ///Get the variable p_value | ||
227 | /** @return Value between the <b>chevron</b> | ||
228 | */ | ||
229 | 5320 | PString & PXml::getValue(){ | |
230 | 5320 | return p_value; | |
231 | } | ||
232 | |||
233 | ///Get the variable p_isText | ||
234 | /** @return Say if the balise contains text only | ||
235 | */ | ||
236 | 89193 | bool PXml::getIsText() const{ | |
237 | 89193 | 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 | 43771 | const std ::vector<PXmlAttr> & PXml::getVecAttr() const{ | |
251 | 43771 | return p_vecAttr; | |
252 | } | ||
253 | |||
254 | ///Get the variable p_vecAttr | ||
255 | /** @return Vector of attribute | ||
256 | */ | ||
257 | 21932 | std ::vector<PXmlAttr> & PXml::getVecAttr(){ | |
258 | 21932 | return p_vecAttr; | |
259 | } | ||
260 | |||
261 | ///Get the variable p_vecChild | ||
262 | /** @return Child of the current PXml | ||
263 | */ | ||
264 | 2743 | const std ::vector<PXml> & PXml::getVecChild() const{ | |
265 | 2743 | return p_vecChild; | |
266 | } | ||
267 | |||
268 | ///Get the variable p_vecChild | ||
269 | /** @return Child of the current PXml | ||
270 | */ | ||
271 | 15529 | std ::vector<PXml> & PXml::getVecChild(){ | |
272 | 15529 | 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 | 352803 | void PXml::initialisationPXml(){ | |
284 | 352803 | p_flag = 0lu; | |
285 | ///Say if the balise is compact or not | ||
286 | 352803 | p_isCompact = 0; | |
287 | ///Say if the balise contains text only | ||
288 | 352803 | p_isText = 0; | |
289 | |||
290 | 352803 | } | |
291 | |||
292 | ///Copy function of the class PXml | ||
293 | /** @param other : other variable | ||
294 | */ | ||
295 | 357069 | void PXml::copyPXml(const PXml & other){ | |
296 | 357069 | p_name = other.p_name; | |
297 | 357069 | p_isCompact = other.p_isCompact; | |
298 | 357069 | p_value = other.p_value; | |
299 | 357069 | p_isText = other.p_isText; | |
300 | 357069 | p_vecAttr = other.p_vecAttr; | |
301 | 357069 | p_vecChild = other.p_vecChild; | |
302 | |||
303 | 357069 | } | |
304 | |||
305 | |||
306 | |||
307 |