Subversion Repositories tpanel

Rev

Rev 480 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
446 andreas 1
/*
486 andreas 2
 * Copyright (C) 2022 to 2025 by Andreas Theofilu <andreas@theosys.at>
446 andreas 3
 *
4
 * This program is free software; you can redistribute it and/or modify
5
 * it under the terms of the GNU General Public License as published by
6
 * the Free Software Foundation; either version 3 of the License, or
7
 * (at your option) any later version.
8
 *
9
 * This program is distributed in the hope that it will be useful,
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 * GNU General Public License for more details.
13
 *
14
 * You should have received a copy of the GNU General Public License
15
 * along with this program; if not, write to the Free Software Foundation,
16
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
17
 */
18
 
19
#ifndef __TEXPATPP_H__
20
#define __TEXPATPP_H__
21
 
22
#include <string>
23
#include <vector>
24
 
25
#include <expat.h>
26
#include "tvalidatefile.h"
27
 
28
namespace Expat
29
{
30
    /**
31
     * @enum _ETYPE_t
32
     * @brief Internal used type identifier for elements.
33
     */
34
    typedef enum _ETYPE_t
35
    {
36
        _ET_START,      //!< Element is a start element. Other elements with a bigger depth follow.
37
        _ET_END,        //!< Element is an end element. Other elements with a bigger depth are before.
38
        _ET_ATOMIC      //!< Element is a single one which starts and stop in one line.
39
    }_ETYPE_t;
40
 
41
    typedef struct _ATTRIBUTE_t
42
    {
43
        std::string name;
44
        std::string content;
45
    }_ATTRIBUTE_t;
46
 
47
    typedef _ATTRIBUTE_t ATTRIBUTE_t;
48
 
49
    typedef struct _ELEMENT_t
50
    {
51
        std::string name;
52
        int depth;
53
        std::string content;
54
        std::vector<_ATTRIBUTE_t> attrs;
55
        _ETYPE_t eType;
56
    }_ELEMENT_t;
57
 
58
    /**
59
     * @enum TENCODING_t
60
     * @brief Defines the possible integrated encodings.
61
     * If the encoding is not ENC_UTF8 it must be set before the parser is
62
     * started. The encoding defines the character set used for the XML file.
63
     * If the XML file is encoded in a different character set than defined,
64
     * it may lead into parsing errors.
65
     */
66
    typedef enum TENCODING_t
67
    {
68
        ENC_UNKNOWN,        //!< Unknown encoding. This is equal with ENC_UTF8
69
        ENC_UTF8,           //!< Default encoding if not defined elsewhere
70
        ENC_UTF16,          //!< UTF16 encoding.
71
        ENC_ISO_8859_1,     //!< ISO-8859-1 encoding.
72
        ENC_CP1250,         //!< CP1250 (Windows) character set.
73
        ENC_US_ASCII        //!< US-ASCII encoding.
74
    }TENCODING_t;
75
 
76
    /**
77
    * @class TExpat
78
    * @brief C++ wrapper class for the XML parser expat.
79
    *
80
    * This class is a small C++ wrapper for the XML parser expat. Expat is part of
81
    * *NIX system and also in the NDK of Android. Therefor it is used in this
82
    * project.
83
    */
84
    class TExpat : public TValidateFile
85
    {
86
        public:
87
            /**
88
            * Constructor.
89
            */
90
            TExpat();
91
            /**
92
            * Constructor.
93
            *
94
            * @param file  The file name of a file containing the XML code to parse.
95
            */
96
            TExpat(const std::string& file);
97
            /**
98
            * Destructor.
99
            */
100
            ~TExpat();
101
 
102
            /**
103
             * @brief Sets the file to parse.
104
             * This method does not check the file. If it is invalid, the parser
105
             * will fail.
106
             *
107
             * @param file  The file to parse.
108
             */
109
            void setFile(const std::string& file) { mFile = file; }
110
            /**
111
             * @brief Set the encoding of the XML file.
112
             * By default UTF8 encoding is assumed if not explicitely defined
113
             * in the XML file. If there is an encoding defination in the XML
114
             * file like:
115
             *
116
             *  <?xml version="1.0" encoding="ISO-8859-2"?>
117
             *
118
             * for example, than this encoding is used by default.
119
             *
120
             * This method sets the encoding to one of the supported encodings.
121
             * If the XML file is encoded in another character set as defined,
122
             * than it may come to errors during parsing!
123
             *
124
             * @param enc   Encoding to be used for parsing the XML file.
125
             */
126
            void setEncoding(TENCODING_t enc);
127
            /**
128
             * @brief Starts the XML parser.
129
             * This method invoke the XML parser. If any error occure and error
130
             * message is logged and the error handler is set.
131
             *
132
             * @return On success it returns TRUE and FALSE otherwise.
133
             */
134
            bool parse(bool debug=false);
135
 
136
            /**
137
             * Retrieves the first element with the name \p name at the depth
138
             * \p depth.
139
             *
140
             * @param name  The name of the wanted element. This is case
141
             * sensitive!
142
             * @param depth The depth where the element is.
143
             *
144
             * @return On success the content of the element is returned.
145
             * Otherwise an empty string is returned.
146
             */
147
            std::string getElement(const std::string& name, int depth, bool *valid=nullptr);
148
            /**
149
             * Retrieves the first element with the name \p name at the depth
150
             * \p depth.
151
             *
152
             * @param name  The name of the wanted element. This is case
153
             * sensitive!
154
             * @param depth The depth where the element is.
155
             * @param valid An optional pointer retrieving the state of the
156
             * search. On success it returns TRUE, otherwise FALSE.
157
             * @return On success the content of the element is returned as an
158
             * integer. Otherwise 0 is returned and \p valid is set to FALSE.
159
             */
160
            int getElementInt(const std::string& name, int depth, bool *valid=nullptr);
161
            /**
162
             * Retrieves the first element with the name \p name at the depth
163
             * \p depth.
164
             *
165
             * @param name  The name of the wanted element. This is case
166
             * sensitive!
167
             * @param depth The depth where the element is.
168
             * @param valid An optional pointer retrieving the state of the
169
             * search. On success it returns TRUE, otherwise FALSE.
170
             * @return On success the content of the element is returned as a
171
             * long integer. Otherwise 0 is returned and \p valid is set to FALSE.
172
             */
173
            long getElementLong(const std::string& name, int depth, bool *valid=nullptr);
174
            /**
175
             * Retrieves the first element with the name \p name at the depth
176
             * \p depth.
177
             *
178
             * @param name  The name of the wanted element. This is case
179
             * sensitive!
180
             * @param depth The depth where the element is.
181
             * @param valid An optional pointer retrieving the state of the
182
             * search. On success it returns TRUE, otherwise FALSE.
183
             * @return On success the content of the element is returned as a
184
             * floating value. Otherwise 0 is returned and \p valid is set to FALSE.
185
             */
186
            float getElementFloat(const std::string& name, int depth, bool *valid=nullptr);
187
            /**
188
             * Retrieves the first element with the name \p name at the depth
189
             * \p depth.
190
             *
191
             * @param name  The name of the wanted element. This is case
192
             * sensitive!
193
             * @param depth The depth where the element is.
194
             * @param valid An optional pointer retrieving the state of the
195
             * search. On success it returns TRUE, otherwise FALSE.
196
             * @return On success the content of the element is returned as a
197
             * double value. Otherwise 0 is returned and \p valid is set to FALSE.
198
             */
199
            double getElementDouble(const std::string& name, int depth, bool *valid=nullptr);
200
            /**
201
             * Retrieves the first element with the name \p name at the depth
202
             * \p depth.
203
             *
204
             * @param name  The name of the wanted element. This is case
205
             * sensitive!
206
             * @param depth The depth where the element is.
207
             *
208
             * @return On success returns the index of the element found.
209
             * Otherwise TExpat::npos is returned.
210
             */
211
            size_t getElementIndex(const std::string& name, int depth);
212
            /**
213
             * @brief Retrieves the first element with the name \p name.
214
             * This method saves the found position internally. If no matching
215
             * entity was found, the internal position is set to an invalid
216
             * position.
217
             *
218
             * @param name  The name of the wanted element. This is case
219
             * sensitive!
220
             * @param depth This parameter is optional and can be NULL. If it is
221
             * present, the method returns the depth of the found element with
222
             * this parameter. If the element was not found, this parameter
223
             * will contain -1.
224
             *
225
             * @return On success returns the index of the element found.
226
             * Otherwise TExpat::npos is returned.
227
             */
228
            size_t getElementIndex(const std::string& name, int *depth);
229
            /**
230
             * Retrieves the \p name, the \p content and the attributes of the
231
             * element. If the element has no attributes, an empty attribute
232
             * list is returned.
233
             *
234
             * This method does not set the internal position. This means that
235
             * a method depending on the internal position like getNextElement()
236
             * will not succeed or return the content of another entity!
237
             *
238
             * @param index The index of the element. This value may be
239
             * retrieved by calling previously the method getElementIndex().
240
             * @param name  This parameter can be NULL. If it is present, the
241
             * name of the element is returned.
242
             * @param content   This parameter can be NULL. If it is present,
243
             * the content of the element is returned. If there was no content,
244
             * an empty string is returned.
245
             * @param attrs This parameter can be NULL. If it is present and if
246
             * the element contains at least 1 attribute, the attributes are
247
             * returned in the vector.
248
             *
249
             * @return If a valid element was found, the index is returned.
250
             * Otherwise TExpat::npos will be returned.
251
             */
252
            size_t getElementFromIndex(size_t index, std::string *name, std::string *content, std::vector<ATTRIBUTE_t> *attrs);
253
            /**
254
             * @brief Retrieves the next element from the given index \p index.
255
             * The method succeeds if the next element is not an end tag or if
256
             * \p index is less than the number of total elements. The method
257
             * increases the index by 1 and returns this entity.
258
             *
259
             * This method does not set the internal position. This means that
260
             * a method depending on the internal position like getNextElement()
261
             * will not succeed or return the content of another entity!
262
             *
263
             * @param index The index of the element. This value may be
264
             * retrieved by calling previously the method getElementIndex().
265
             * @param name  This parameter can be NULL. If it is present, the
266
             * name of the element is returned.
267
             * @param content   This parameter can be NULL. If it is present,
268
             * the content of the element is returned. If there was no content,
269
             * an empty string is returned.
270
             * @param attrs This parameter can be NULL. If it is present and if
271
             * the element contains at least 1 attribute, the attributes are
272
             * returned in the vector.
273
             *
274
             * @return If a valid element was found, the index is returned.
275
             * Otherwise TExpat::npos will be returned.
276
             */
277
            size_t getNextElementFromIndex(size_t index, std::string *name, std::string *content, std::vector<ATTRIBUTE_t> *attrs);
278
            /**
279
             * @brief Retrieves the first element with the name \p name.
280
             *
281
             * This method saves the found position internally. If no matching
282
             * entity was found, the internal position is set to an invalid
283
             * position.
284
             *
285
             * @param name  The name of the wanted element.
286
             * @param depth A pointer to an integer. The method returns the
287
             * depth of the found element in this parameter.
288
             *
289
             * @return On success the content of the element is returned, if
290
             * any. Otherwise an error is logged and an empty string is returned.
291
             * The parameter \p depth is set to -1 on error.
292
             */
293
            std::string getFirstElement(const std::string& name, int *depth);
294
            /**
295
             * Retrieves the next element in the list. This method depends on
296
             * the method getFirstElement(), which must be called previous.
297
             *
298
             * This method saves the found position internally. If no matching
299
             * entity was found, the internal position is set to an invalid
300
             * position.
301
             *
302
             * @param name  The name of the element to search for. This
303
             * parameter is optional and may be NULL.
304
             * @param depth The depth of the element to return. If there are
305
             * no more elements with the name \p name and the depth \p depth
306
             * than an empty string is returned.
307
             *
308
             * @return On success the content of the element is returned. If
309
             * an error occurs an error message is logged and the error is set.
310
             */
311
            std::string getNextElement(const std::string& name, int depth, bool *valid=nullptr);
312
            /**
313
             * Retrieves the next element in the list. This method depends on
314
             * the method getFirstElement(), which must be called previous.
315
             *
316
             * This method saves the found position internally. If no matching
317
             * entity was found, the internal position is set to an invalid
318
             * position.
319
             *
320
             * @param name  The name of the element to search for. This
321
             * parameter is optional and may be NULL.
322
             * @param depth The depth of the element to return. If there are
323
             * no more elements with the name \p name and the depth \p depth
324
             * than an empty string is returned.
325
             *
326
             * @return On success the index of the element is returned. If
327
             * an error occurs an error message is logged and the error is set.
328
             */
329
            size_t getNextElementIndex(const std::string& name, int depth);
330
            /**
331
             * Searches in the attribute list of an attribute called \p name
332
             * and returns the content.
333
             *
334
             * @param name  The name of the wanted attribute.
335
             * @param attrs A vector list of attributes.
336
             *
337
             * @return On success returns the content of the attribute \p name.
338
             * Otherwise an empty string is returned.
339
             */
340
            std::string getAttribute(const std::string& name, std::vector<ATTRIBUTE_t>& attrs);
341
            /**
342
             * Searches in the attribute list of an attribute called \p name
343
             * and returns the content.
344
             *
345
             * @param name  The name of the wanted attribute.
346
             * @param attrs A vector list of attributes.
347
             *
480 andreas 348
             * @return On success returns TRUE or FALSE depending on the
349
             * content.
350
             */
351
            bool getAttributeBool(const std::string& name, std::vector<ATTRIBUTE_t>& attrs);
352
            /**
353
             * Searches in the attribute list of an attribute called \p name
354
             * and returns the content.
355
             *
356
             * @param name  The name of the wanted attribute.
357
             * @param attrs A vector list of attributes.
358
             *
446 andreas 359
             * @return On success returns the content of the attribute \p name
360
             * as an integer value.
361
             * Otherwise an error text is set (TError) and 0 is returned.
362
             */
363
            int getAttributeInt(const std::string& name, std::vector<ATTRIBUTE_t>& attrs);
364
            /**
365
             * Searches in the attribute list of an attribute called \p name
366
             * and returns the content.
367
             *
368
             * @param name  The name of the wanted attribute.
369
             * @param attrs A vector list of attributes.
370
             *
371
             * @return On success returns the content of the attribute \p name
372
             * as a long value.
373
             * Otherwise an error text is set (TError) and 0 is returned.
374
             */
375
            long getAttributeLong(const std::string& name, std::vector<ATTRIBUTE_t>& attrs);
376
            /**
377
             * Searches in the attribute list of an attribute called \p name
378
             * and returns the content.
379
             *
380
             * @param name  The name of the wanted attribute.
381
             * @param attrs A vector list of attributes.
382
             *
383
             * @return On success returns the content of the attribute \p name
384
             * as a floating value.
385
             * Otherwise an error text is set (TError) and 0 is returned.
386
             */
387
            float getAttributeFloat(const std::string& name, std::vector<ATTRIBUTE_t>& attrs);
388
            /**
389
             * Searches in the attribute list of an attribute called \p name
390
             * and returns the content.
391
             *
392
             * @param name  The name of the wanted attribute.
393
             * @param attrs A vector list of attributes.
394
             *
395
             * @return On success returns the content of the attribute \p name
396
             * as a double precission floating value.
397
             * Otherwise an error text is set (TError) and 0 is returned.
398
             */
399
            double getAttributeDouble(const std::string& name, std::vector<ATTRIBUTE_t>& attrs);
400
            /**
480 andreas 401
             * Converts a string into a boolean.
402
             *
403
             * @param content   A string containing numbers.
486 andreas 404
             * @param def Optional: A value which is returned in case of an error.
480 andreas 405
             * @return Returns the boolean value.
406
             */
486 andreas 407
            bool convertElementToBool(const std::string& content, bool def=false);
480 andreas 408
            /**
446 andreas 409
             * Converts a string into an integer value.
410
             *
411
             * @param content   A string containing numbers.
486 andreas 412
             * @param def Optional: A value which is returned in case of an error.
446 andreas 413
             * @return On success returns the value representation of the
414
             * \p content. If not convertable, TError is set and 0 is returned.
415
             */
486 andreas 416
            int convertElementToInt(const std::string& content, int def=0);
446 andreas 417
            /**
418
             * Converts a string into a long integer value.
419
             *
420
             * @param content   A string containing numbers.
486 andreas 421
             * @param def Optional: A value which is returned in case of an error.
446 andreas 422
             * @return On success returns the value representation of the
423
             * \p content. If not convertable, TError is set and 0 is returned.
424
             */
486 andreas 425
            long convertElementToLong(const std::string& content, long def=0);
446 andreas 426
            /**
427
             * Converts a string into a floating value.
428
             *
429
             * @param content   A string containing numbers.
486 andreas 430
             * @param def Optional: A value which is returned in case of an error.
446 andreas 431
             * @return On success returns the value representation of the
432
             * \p content. If not convertable, TError is set and 0 is returned.
433
             */
486 andreas 434
            float convertElementToFloat(const std::string& content, float def=0.0);
446 andreas 435
            /**
436
             * Converts a string into a double floating value.
437
             *
438
             * @param content   A string containing numbers.
486 andreas 439
             * @param def Optional: A value which is returned in case of an error.
446 andreas 440
             * @return On success returns the value representation of the
441
             * \p content. If not convertable, TError is set and 0 is returned.
442
             */
486 andreas 443
            double convertElementToDouble(const std::string& content, double def=0.0);
446 andreas 444
            /**
445
             * Sets the internal pointer to the \p index. If this points to an
446
             * invalid index, the method sets an error and returns FALSE.
447
             *
448
             * @param index The index into the internal XML list.
449
             * @return On success it returns TRUE.
450
             */
451
            bool setIndex(size_t index);
452
            /**
453
             * Retrieves the attribute list from the current position.
454
             *
455
             * @return On success the attributes of the current position are
456
             * returned. If the current position is at the end or doesn't
457
             * has attributes, an empty list is returned.
458
             */
459
            std::vector<ATTRIBUTE_t> getAttributes();
460
            /**
461
             * Retrieves the attribute list from the \p index.
462
             *
463
             * @return On success the attributes of the position \p index are
464
             * returned. If the position \p index is at the end or doesn't
465
             * has attributes, an empty list is returned.
466
             */
467
            std::vector<ATTRIBUTE_t> getAttributes(size_t index);
468
 
469
            /**
486 andreas 470
             * @brief bool isElementTypeStart(size_t index)
471
             * Test the element the index is pointing to, for the type START.
472
             * If this is true it returns TRUE. If the parameter \b index
473
             * points to an invalid index, FALSE is returned.
474
             *
475
             * @param index The index of the element to test.
476
             *
477
             * @return If the element is a valid element and has a START tag it
478
             * return TRUE. Otherwise FALSE is returned.
479
             */
480
            bool isElementTypeStart(size_t index);
481
            /**
482
             * @brief bool isElementTypeEnd(size_t index)
483
             * Test the element the index is pointing to, for the type END. If
484
             * this is true it returns TRUE. If the parameter \b index points
485
             * to an invalid index, TRUE is returned.
486
             *
487
             * @param index The index of the element to test.
488
             *
489
             * @return If the element is a valid element and not an END tag it
490
             * return FALSE. Otherwise TRUE is returned.
491
             */
492
            bool isElementTypeEnd(size_t index);
493
            /**
494
             * @brief bool isElementTypeAtomic(size_t index)
495
             * Test the element the index is pointing to, for the type ATOMIC.
496
             * If this is true it returns TRUE. If the parameter \b index
497
             * points to an invalid index, FALSE is returned.
498
             *
499
             * @param index The index of the element to test.
500
             *
501
             * @return If the element is a valid element and an ATOMIC tag it
502
             * return TRUE. Otherwise FALSE is returned.
503
             */
504
            bool isElementTypeAtomic(size_t index);
505
            /**
506
             * @brief bool getElementType(size_t index);
507
             * Returns the internal type of the element the parameter
508
             * \b index is pointing to.
509
             *
510
             * @param index The index of the element.
511
             *
512
             * @return If \b index points to a valid element the type of it is
513
             * returned. If it is an invalid element it will return always
514
             * _ET_END.
515
             */
516
            _ETYPE_t getElementType(size_t index);
517
            /**
518
             * @brief bool getElementTypeStr(size_t index)
519
             * Returns the internal type of the element the parameter
520
             * \b index is pointing to as a string.
521
             *
522
             * @param index The index of the element.
523
             *
524
             * @return If \b index points to a valid element the type of it is
525
             * returned. If it is an invalid element it will return always
526
             * "END".
527
             */
528
            std::string getElementTypeStr(size_t index);
529
            /**
446 andreas 530
             * Checks whether the internal pointer points to a valid entry or
531
             * not. If the internal pointer is valid it returns the name of the
532
             * entity the pointer points to.
533
             *
534
             * @param valid This is an optional parameter. If this is set, then
535
             * it is set to TRUE when the method succeeds and to FALSE
536
             * otherwise.
537
             *
538
             * @return On success it returns the name of the entity and set the
539
             * parameter \p valid to TRUE. On error it returns an empty string
540
             * and sets the parameter \p valid to FALSE.
541
             */
542
            std::string getElementName(bool *valid=nullptr);
543
            /**
544
             * Checks whether the internal pointer points to a valid entry or
545
             * not. If the internal pointer is valid it returns the content of
546
             * the entity the pointer points to.
547
             *
548
             * @param valid This is an optional parameter. If this is set, then
549
             * it is set to TRUE when the method succeeds and to FALSE
550
             * otherwise.
551
             *
552
             * @return On success it returns the content of the entity and set
553
             * the parameter \p valid to TRUE. On error it returns an empty
554
             * string and sets the parameter \p valid to FALSE.
555
             */
556
            std::string getElementContent(bool *valid=nullptr);
557
            /**
558
             * Checks whether the internal pointer points to a valid entry or
559
             * not. If the internal pointer is valid it returns the content of
560
             * the entity converted to an integer.
561
             *
562
             * @param valid This is an optional parameter. If this is set, then
563
             * it is set to TRUE when the method succeeds and to FALSE
564
             * otherwise.
565
             *
566
             * @return On success it returns the content of the entity converted
567
             * to an integer and set  the parameter \p valid to TRUE. On error
568
             * it returns an empty string and sets the parameter \p valid to
569
             * FALSE.
570
             */
571
            int getElementContentInt(bool *valid=nullptr);
572
            /**
573
             * Checks whether the internal pointer points to a valid entry or
574
             * not. If the internal pointer is valid it returns the content of
575
             * the entity converted to a long.
576
             *
577
             * @param valid This is an optional parameter. If this is set, then
578
             * it is set to TRUE when the method succeeds and to FALSE
579
             * otherwise.
580
             *
581
             * @return On success it returns the content of the entity converted
582
             * to a long and set  the parameter \p valid to TRUE. On error
583
             * it returns an empty string and sets the parameter \p valid to
584
             * FALSE.
585
             */
586
            long getElementContentLong(bool *valid=nullptr);
587
            /**
588
             * Checks whether the internal pointer points to a valid entry or
589
             * not. If the internal pointer is valid it returns the content of
590
             * the entity converted to a floating value.
591
             *
592
             * @param valid This is an optional parameter. If this is set, then
593
             * it is set to TRUE when the method succeeds and to FALSE
594
             * otherwise.
595
             *
596
             * @return On success it returns the content of the entity converted
597
             * to a float and set  the parameter \p valid to TRUE. On error
598
             * it returns an empty string and sets the parameter \p valid to
599
             * FALSE.
600
             */
601
            float getElementContentFloat(bool *valid=nullptr);
602
            /**
603
             * Checks whether the internal pointer points to a valid entry or
604
             * not. If the internal pointer is valid it returns the content of
605
             * the entity converted to a double.
606
             *
607
             * @param valid This is an optional parameter. If this is set, then
608
             * it is set to TRUE when the method succeeds and to FALSE
609
             * otherwise.
610
             *
611
             * @return On success it returns the content of the entity converted
612
             * to a double and set  the parameter \p valid to TRUE. On error
613
             * it returns an empty string and sets the parameter \p valid to
614
             * FALSE.
615
             */
616
            double getElementContentDouble(bool *valid=nullptr);
617
 
618
            static const size_t npos = static_cast<size_t>(-1); //!< Marks an invalid index
619
 
620
        protected:
621
            static void startElement(void* userData, const XML_Char* name, const XML_Char** attrs);
622
            static void XMLCALL endElement(void *userData, const XML_Char *name);
623
            static void XMLCALL CharacterDataHandler(void *, const XML_Char *s, int len);
624
            static int cp1250_encoding_handler(void*, const XML_Char* encoding, XML_Encoding* info);
625
 
626
        private:
627
            static void createCP1250Encoding(XML_Encoding *enc);    //!< Internal handler to handle CP1250 encoded files.
628
 
629
            std::string mFile;                                      //!< The name of a file containing the XML code to parse
630
            std::vector<_ELEMENT_t> mElements;                      //!< The list of elemets in the order they appeared
631
            std::vector<_ELEMENT_t>::iterator mLastIter{mElements.end()};   //!< The pointer to the last iterator
632
            std::string mEncoding{"UTF-8"};                         //!< Encoding of the XML file. UTF-8 is default encoding.
633
            TENCODING_t mSetEncoding{ENC_UTF8};                     //!< Encoding of the XML file. UTF-8 is default encoding.
634
//            int mLastDepth{0};                                      //!< The depth of the last found element.
635
            // Variables used for the static methods
636
            static int mDepth;
637
            static std::string mContent;
638
            static std::string mLastName;
639
            static std::vector<_ATTRIBUTE_t> mAttributes;
640
    };
641
}
642
 
643
#endif