AWS SDK for C++

AWS SDK for C++ Version 1.11.743

Loading...
Searching...
No Matches
tinyxml2.h
1/*
2Original code by Lee Thomason (www.grinninglizard.com)
3
4This software is provided 'as-is', without any express or implied
5warranty. In no event will the authors be held liable for any
6damages arising from the use of this software.
7
8Permission is granted to anyone to use this software for any
9purpose, including commercial applications, and to alter it and
10redistribute it freely, subject to the following restrictions:
11
121. The origin of this software must not be misrepresented; you must
13not claim that you wrote the original software. If you use this
14software in a product, an acknowledgment in the product documentation
15would be appreciated but is not required.
16
172. Altered source versions must be plainly marked as such, and
18must not be misrepresented as being the original software.
19
203. This notice may not be removed or altered from any source
21distribution.
22*/
23/*
24This file has been modified from its original version by Amazon:
25 (1) Memory management operations use aws memory management api
26 (2) Import-export preprocessor logic tweaked for better integration into core library
27 (3) Wrapped everything in Amazon namespace to prevent static linking issues if the user includes a version of this code through another dependency
28*/
29#ifndef TINYXML2_INCLUDED
30#define TINYXML2_INCLUDED
31
32#if defined(ANDROID_NDK) || defined(__BORLANDC__) || defined(__QNXNTO__)
33# include <ctype.h>
34# include <limits.h>
35# include <stdio.h>
36# include <stdlib.h>
37# include <string.h>
38# if defined(__PS3__)
39# include <stddef.h>
40# endif
41#else
42# include <cctype>
43# include <climits>
44# include <cstdio>
45# include <cstdlib>
46# include <cstring>
47#endif
48#include <stdint.h>
49
50#include <aws/core/utils/memory/AWSMemory.h>
51
52/*
53 TODO: intern strings instead of allocation.
54*/
55/*
56 gcc:
57 g++ -Wall -DDEBUG tinyxml2.cpp xmltest.cpp -o gccxmltest.exe
58
59 Formatting, Artistic Style:
60 AStyle.exe --style=1tbs --indent-switches --break-closing-brackets --indent-preprocessor tinyxml2.cpp tinyxml2.h
61*/
62
63#if defined( _DEBUG ) || defined (__DEBUG__)
64# ifndef DEBUG
65# define DEBUG
66# endif
67#endif
68
69#ifdef _MSC_VER
70# pragma warning(push)
71# pragma warning(disable: 4251)
72#endif
73
74#ifdef _WIN32
75 #ifdef USE_IMPORT_EXPORT
76 #ifdef AWS_CORE_EXPORTS
77 #define TINYXML2_LIB __declspec(dllexport)
78 #else
79 #define TINYXML2_LIB __declspec(dllimport)
80 #endif // AWS_CORE_EXPORTS
81 #endif // USE_IMPORT_EXPORT
82#elif __GNUC__ >= 4
83 #define TINYXML2_LIB __attribute__((visibility("default")))
84#endif // _WIN32
85
86#ifndef TINYXML2_LIB
87 #define TINYXML2_LIB
88#endif // TINYXML2_LIB
89
90#if defined(DEBUG)
91# if defined(_MSC_VER)
92# // "(void)0," is for suppressing C4127 warning in "assert(false)", "assert(true)" and the like
93# define TIXMLASSERT( x ) if ( !((void)0,(x))) { __debugbreak(); }
94# elif defined (ANDROID_NDK)
95# include <android/log.h>
96# define TIXMLASSERT( x ) if ( !(x)) { __android_log_assert( "assert", "grinliz", "ASSERT in '%s' at %d.", __FILE__, __LINE__ ); }
97# else
98# include <assert.h>
99# define TIXMLASSERT assert
100# endif
101#else
102# define TIXMLASSERT( x ) {}
103#endif
104
105
106/* Versioning, past 1.0.14:
107 http://semver.org/
108*/
109static const int TIXML2_MAJOR_VERSION = 11;
110static const int TIXML2_MINOR_VERSION = 0;
111static const int TIXML2_PATCH_VERSION = 0;
112
113#define TINYXML2_MAJOR_VERSION 11
114#define TINYXML2_MINOR_VERSION 0
115#define TINYXML2_PATCH_VERSION 0
116
117namespace Aws
118{
119namespace External
120{
121// A fixed element depth limit is problematic. There needs to be a
122// limit to avoid a stack overflow. However, that limit varies per
123// system, and the capacity of the stack. On the other hand, it's a trivial
124// attack that can result from ill, malicious, or even correctly formed XML,
125// so there needs to be a limit in place.
126static const int TINYXML2_MAX_ELEMENT_DEPTH = 500;
127
128namespace tinyxml2
129{
130class XMLDocument;
131class XMLElement;
132class XMLAttribute;
133class XMLComment;
134class XMLText;
135class XMLDeclaration;
136class XMLUnknown;
137class XMLPrinter;
138
139static const char* ALLOCATION_TAG = "AWS::TinyXML";
140
141/*
142 A class that wraps strings. Normally stores the start and end
143 pointers into the XML file itself, and will apply normalization
144 and entity translation if actually read. Can also store (and memory
145 manage) a traditional char[]
146
147 Isn't clear why TINYXML2_LIB is needed; but seems to fix #719
148*/
149class TINYXML2_LIB StrPair
150{
151public:
152 enum Mode {
153 NEEDS_ENTITY_PROCESSING = 0x01,
154 NEEDS_NEWLINE_NORMALIZATION = 0x02,
155 NEEDS_WHITESPACE_COLLAPSING = 0x04,
156
157 TEXT_ELEMENT = NEEDS_ENTITY_PROCESSING | NEEDS_NEWLINE_NORMALIZATION,
158 TEXT_ELEMENT_LEAVE_ENTITIES = NEEDS_NEWLINE_NORMALIZATION,
159 ATTRIBUTE_NAME = 0,
160 ATTRIBUTE_VALUE = NEEDS_ENTITY_PROCESSING | NEEDS_NEWLINE_NORMALIZATION,
161 ATTRIBUTE_VALUE_LEAVE_ENTITIES = NEEDS_NEWLINE_NORMALIZATION,
162 COMMENT = NEEDS_NEWLINE_NORMALIZATION
163 };
164
165 StrPair() : _flags( 0 ), _start( 0 ), _end( 0 ) {}
167
168 void Set( char* start, char* end, int flags ) {
169 TIXMLASSERT( start );
170 TIXMLASSERT( end );
171 Reset();
172 _start = start;
173 _end = end;
174 _flags = flags | NEEDS_FLUSH;
175 }
176
177 const char* GetStr();
178
179 bool Empty() const {
180 return _start == _end;
181 }
182
183 void SetInternedStr( const char* str ) {
184 Reset();
185 _start = const_cast<char*>(str);
186 }
187
188 void SetStr( const char* str, int flags=0 );
189
190 char* ParseText( char* in, const char* endTag, int strFlags, int* curLineNumPtr );
191 char* ParseName( char* in );
192
193 void TransferTo( StrPair* other );
194 void Reset();
195
196private:
197 void CollapseWhitespace();
198
199 enum {
200 NEEDS_FLUSH = 0x100,
201 NEEDS_DELETE = 0x200
202 };
203
204 int _flags;
205 char* _start;
206 char* _end;
207
208 StrPair( const StrPair& other ); // not supported
209 void operator=( const StrPair& other ); // not supported, use TransferTo()
210};
211
212
213/*
214 A dynamic array of Plain Old Data. Doesn't support constructors, etc.
215 Has a small initial memory pool, so that low or no usage will not
216 cause a call to new/delete
217*/
218template <class T, size_t INITIAL_SIZE>
220{
221public:
223 _mem( _pool ),
224 _allocated( INITIAL_SIZE ),
225 _size( 0 )
226 {
227 }
228
230 if ( _mem != _pool ) {
231 Aws::DeleteArray<T>(_mem);
232 }
233 }
234
235 void Clear() {
236 _size = 0;
237 }
238
239 void Push( T t ) {
240 TIXMLASSERT( _size < INT_MAX );
241 EnsureCapacity( _size+1 );
242 _mem[_size] = t;
243 ++_size;
244 }
245
246 T* PushArr( size_t count ) {
247 TIXMLASSERT( _size <= SIZE_MAX - count );
248 EnsureCapacity( _size+count );
249 T* ret = &_mem[_size];
250 _size += count;
251 return ret;
252 }
253
254 T Pop() {
255 TIXMLASSERT( _size > 0 );
256 --_size;
257 return _mem[_size];
258 }
259
260 void PopArr( size_t count ) {
261 TIXMLASSERT( _size >= count );
262 _size -= count;
263 }
264
265 bool Empty() const {
266 return _size == 0;
267 }
268
269 T& operator[](size_t i) {
270 TIXMLASSERT( i < _size );
271 return _mem[i];
272 }
273
274 const T& operator[](size_t i) const {
275 TIXMLASSERT( i < _size );
276 return _mem[i];
277 }
278
279 const T& PeekTop() const {
280 TIXMLASSERT( _size > 0 );
281 return _mem[ _size - 1];
282 }
283
284 size_t Size() const {
285 return _size;
286 }
287
288 size_t Capacity() const {
289 TIXMLASSERT( _allocated >= INITIAL_SIZE );
290 return _allocated;
291 }
292
293 void SwapRemove(size_t i) {
294 TIXMLASSERT(i < _size);
295 TIXMLASSERT(_size > 0);
296 _mem[i] = _mem[_size - 1];
297 --_size;
298 }
299
300 const T* Mem() const {
301 TIXMLASSERT( _mem );
302 return _mem;
303 }
304
305 T* Mem() {
306 TIXMLASSERT( _mem );
307 return _mem;
308 }
309
310private:
311 DynArray( const DynArray& ); // not supported
312 void operator=( const DynArray& ); // not supported
313
314 void EnsureCapacity( size_t cap ) {
315 TIXMLASSERT( cap > 0 );
316 if ( cap > _allocated ) {
317 TIXMLASSERT( cap <= SIZE_MAX / 2 / sizeof(T));
318 const size_t newAllocated = cap * 2;
319 T* newMem = Aws::NewArray<T>(newAllocated, ALLOCATION_TAG);
320 TIXMLASSERT( newAllocated >= _size );
321 memcpy( newMem, _mem, sizeof(T) * _size ); // warning: not using constructors, only works for PODs
322 if ( _mem != _pool ) {
323 Aws::DeleteArray<T>(_mem);
324 }
325 _mem = newMem;
326 _allocated = newAllocated;
327 }
328 }
329
330 T* _mem;
331 T _pool[INITIAL_SIZE];
332 size_t _allocated; // objects allocated
333 size_t _size; // number objects in use
334};
335
336
337/*
338 Parent virtual class of a pool for fast allocation
339 and deallocation of objects.
340*/
342{
343public:
345 virtual ~MemPool() {}
346
347 virtual size_t ItemSize() const = 0;
348 virtual void* Alloc() = 0;
349 virtual void Free( void* ) = 0;
350 virtual void SetTracked() = 0;
351};
352
353
354/*
355 Template child class to create pools of the correct type.
356*/
357template< size_t ITEM_SIZE >
358class MemPoolT : public MemPool
359{
360public:
361 MemPoolT() : _blockPtrs(), _root(0), _currentAllocs(0), _nAllocs(0), _maxAllocs(0), _nUntracked(0) {}
364 }
365
366 void Clear() {
367 // Delete the blocks.
368 while( !_blockPtrs.Empty()) {
369 Block* lastBlock = _blockPtrs.Pop();
370 Aws::Delete(lastBlock);
371 }
372 _root = 0;
373 _currentAllocs = 0;
374 _nAllocs = 0;
375 _maxAllocs = 0;
376 _nUntracked = 0;
377 }
378
379 virtual size_t ItemSize() const override {
380 return ITEM_SIZE;
381 }
382 size_t CurrentAllocs() const {
383 return _currentAllocs;
384 }
385
386 virtual void* Alloc() override{
387 if ( !_root ) {
388 // Need a new block.
389 Block* block = Aws::New<Block>(ALLOCATION_TAG);
390 _blockPtrs.Push( block );
391
392 Item* blockItems = block->items;
393 for( size_t i = 0; i < ITEMS_PER_BLOCK - 1; ++i ) {
394 blockItems[i].next = &(blockItems[i + 1]);
395 }
396 blockItems[ITEMS_PER_BLOCK - 1].next = 0;
397 _root = blockItems;
398 }
399 Item* const result = _root;
400 TIXMLASSERT( result != 0 );
401 _root = _root->next;
402
403 ++_currentAllocs;
404 if ( _currentAllocs > _maxAllocs ) {
405 _maxAllocs = _currentAllocs;
406 }
407 ++_nAllocs;
408 ++_nUntracked;
409 return result;
410 }
411
412 virtual void Free( void* mem ) override {
413 if ( !mem ) {
414 return;
415 }
416 --_currentAllocs;
417 Item* item = static_cast<Item*>( mem );
418#ifdef DEBUG
419 memset( item, 0xfe, sizeof( *item ) );
420#endif
421 item->next = _root;
422 _root = item;
423 }
424 void Trace( const char* name ) {
425 printf( "Mempool %s watermark=%d [%dk] current=%d size=%d nAlloc=%d blocks=%d\n",
426 name, _maxAllocs, _maxAllocs * ITEM_SIZE / 1024, _currentAllocs,
427 ITEM_SIZE, _nAllocs, _blockPtrs.Size() );
428 }
429
430 void SetTracked() override {
431 --_nUntracked;
432 }
433
434 size_t Untracked() const {
435 return _nUntracked;
436 }
437
438 // This number is perf sensitive. 4k seems like a good tradeoff on my machine.
439 // The test file is large, 170k.
440 // Release: VS2010 gcc(no opt)
441 // 1k: 4000
442 // 2k: 4000
443 // 4k: 3900 21000
444 // 16k: 5200
445 // 32k: 4300
446 // 64k: 4000 21000
447 // Declared public because some compilers do not accept to use ITEMS_PER_BLOCK
448 // in private part if ITEMS_PER_BLOCK is private
449 enum { ITEMS_PER_BLOCK = (4 * 1024) / ITEM_SIZE };
450
451private:
452 MemPoolT( const MemPoolT& ); // not supported
453 void operator=( const MemPoolT& ); // not supported
454
455 union Item {
456 Item* next;
457 char itemData[static_cast<size_t>(ITEM_SIZE)];
458 };
459 struct Block {
460 Item items[ITEMS_PER_BLOCK];
461 };
462 DynArray< Block*, 10 > _blockPtrs;
463 Item* _root;
464
465 size_t _currentAllocs;
466 size_t _nAllocs;
467 size_t _maxAllocs;
468 size_t _nUntracked;
469};
470
471
472
492class TINYXML2_LIB XMLVisitor
493{
494public:
495 virtual ~XMLVisitor() {}
496
498 virtual bool VisitEnter( const XMLDocument& /*doc*/ ) {
499 return true;
500 }
502 virtual bool VisitExit( const XMLDocument& /*doc*/ ) {
503 return true;
504 }
505
507 virtual bool VisitEnter( const XMLElement& /*element*/, const XMLAttribute* /*firstAttribute*/ ) {
508 return true;
509 }
511 virtual bool VisitExit( const XMLElement& /*element*/ ) {
512 return true;
513 }
514
516 virtual bool Visit( const XMLDeclaration& /*declaration*/ ) {
517 return true;
518 }
520 virtual bool Visit( const XMLText& /*text*/ ) {
521 return true;
522 }
524 virtual bool Visit( const XMLComment& /*comment*/ ) {
525 return true;
526 }
528 virtual bool Visit( const XMLUnknown& /*unknown*/ ) {
529 return true;
530 }
531};
532
533// WARNING: must match XMLDocument::_errorNames[]
556
557
558/*
559 Utility functionality.
560*/
561class TINYXML2_LIB XMLUtil
562{
563public:
564 static const char* SkipWhiteSpace( const char* p, int* curLineNumPtr ) {
565 TIXMLASSERT( p );
566
567 while( IsWhiteSpace(*p) ) {
568 if (curLineNumPtr && *p == '\n') {
569 ++(*curLineNumPtr);
570 }
571 ++p;
572 }
573 TIXMLASSERT( p );
574 return p;
575 }
576 static char* SkipWhiteSpace( char* const p, int* curLineNumPtr ) {
577 return const_cast<char*>( SkipWhiteSpace( const_cast<const char*>(p), curLineNumPtr ) );
578 }
579
580 // Anything in the high order range of UTF-8 is assumed to not be whitespace. This isn't
581 // correct, but simple, and usually works.
582 static bool IsWhiteSpace( char p ) {
583 return !IsUTF8Continuation(p) && isspace( static_cast<unsigned char>(p) );
584 }
585
586 inline static bool IsNameStartChar( unsigned char ch ) {
587 if ( ch >= 128 ) {
588 // This is a heuristic guess in attempt to not implement Unicode-aware isalpha()
589 return true;
590 }
591 if ( isalpha( ch ) ) {
592 return true;
593 }
594 return ch == ':' || ch == '_';
595 }
596
597 inline static bool IsNameChar( unsigned char ch ) {
598 return IsNameStartChar( ch )
599 || isdigit( ch )
600 || ch == '.'
601 || ch == '-';
602 }
603
604 inline static bool IsPrefixHex( const char* p) {
605 p = SkipWhiteSpace(p, 0);
606 return p && *p == '0' && ( *(p + 1) == 'x' || *(p + 1) == 'X');
607 }
608
609 inline static bool StringEqual( const char* p, const char* q, int nChar=INT_MAX ) {
610 if ( p == q ) {
611 return true;
612 }
613 TIXMLASSERT( p );
614 TIXMLASSERT( q );
615 TIXMLASSERT( nChar >= 0 );
616 return strncmp( p, q, static_cast<size_t>(nChar) ) == 0;
617 }
618
619 inline static bool IsUTF8Continuation( const char p ) {
620 return ( p & 0x80 ) != 0;
621 }
622
623 static const char* ReadBOM( const char* p, bool* hasBOM );
624 // p is the starting location,
625 // the UTF-8 value of the entity will be placed in value, and length filled in.
626 static const char* GetCharacterRef( const char* p, char* value, int* length );
627 static void ConvertUTF32ToUTF8( unsigned long input, char* output, int* length );
628
629 // converts primitive types to strings
630 static void ToStr( int v, char* buffer, int bufferSize );
631 static void ToStr( unsigned v, char* buffer, int bufferSize );
632 static void ToStr( bool v, char* buffer, int bufferSize );
633 static void ToStr( float v, char* buffer, int bufferSize );
634 static void ToStr( double v, char* buffer, int bufferSize );
635 static void ToStr(int64_t v, char* buffer, int bufferSize);
636 static void ToStr(uint64_t v, char* buffer, int bufferSize);
637
638 // converts strings to primitive types
639 static bool ToInt( const char* str, int* value );
640 static bool ToUnsigned( const char* str, unsigned* value );
641 static bool ToBool( const char* str, bool* value );
642 static bool ToFloat( const char* str, float* value );
643 static bool ToDouble( const char* str, double* value );
644 static bool ToInt64(const char* str, int64_t* value);
645 static bool ToUnsigned64(const char* str, uint64_t* value);
646 // Changes what is serialized for a boolean value.
647 // Default to "true" and "false". Shouldn't be changed
648 // unless you have a special testing or compatibility need.
649 // Be careful: static, global, & not thread safe.
650 // Be sure to set static const memory as parameters.
651 static void SetBoolSerialization(const char* writeTrue, const char* writeFalse);
652
653private:
654 static const char* writeBoolTrue;
655 static const char* writeBoolFalse;
656};
657
658
684class TINYXML2_LIB XMLNode
685{
686 friend class XMLDocument;
687 friend class XMLElement;
688public:
689
691 const XMLDocument* GetDocument() const {
692 TIXMLASSERT( _document );
693 return _document;
694 }
697 TIXMLASSERT( _document );
698 return _document;
699 }
700
703 return 0;
704 }
706 virtual XMLText* ToText() {
707 return 0;
708 }
711 return 0;
712 }
715 return 0;
716 }
719 return 0;
720 }
723 return 0;
724 }
725
726 virtual const XMLElement* ToElement() const {
727 return 0;
728 }
729 virtual const XMLText* ToText() const {
730 return 0;
731 }
732 virtual const XMLComment* ToComment() const {
733 return 0;
734 }
735 virtual const XMLDocument* ToDocument() const {
736 return 0;
737 }
738 virtual const XMLDeclaration* ToDeclaration() const {
739 return 0;
740 }
741 virtual const XMLUnknown* ToUnknown() const {
742 return 0;
743 }
744
745 // ChildElementCount was originally suggested by msteiger on the sourceforge page for TinyXML and modified by KB1SPH for TinyXML-2.
746
747 int ChildElementCount(const char *value) const;
748
749 int ChildElementCount() const;
750
760 const char* Value() const;
761
765 void SetValue( const char* val, bool staticMem=false );
766
768 int GetLineNum() const { return _parseLineNum; }
769
771 const XMLNode* Parent() const {
772 return _parent;
773 }
774
776 return _parent;
777 }
778
780 bool NoChildren() const {
781 return !_firstChild;
782 }
783
785 const XMLNode* FirstChild() const {
786 return _firstChild;
787 }
788
790 return _firstChild;
791 }
792
796 const XMLElement* FirstChildElement( const char* name = 0 ) const;
797
798 XMLElement* FirstChildElement( const char* name = 0 ) {
799 return const_cast<XMLElement*>(const_cast<const XMLNode*>(this)->FirstChildElement( name ));
800 }
801
803 const XMLNode* LastChild() const {
804 return _lastChild;
805 }
806
808 return _lastChild;
809 }
810
814 const XMLElement* LastChildElement( const char* name = 0 ) const;
815
816 XMLElement* LastChildElement( const char* name = 0 ) {
817 return const_cast<XMLElement*>(const_cast<const XMLNode*>(this)->LastChildElement(name) );
818 }
819
821 const XMLNode* PreviousSibling() const {
822 return _prev;
823 }
824
826 return _prev;
827 }
828
830 const XMLElement* PreviousSiblingElement( const char* name = 0 ) const ;
831
832 XMLElement* PreviousSiblingElement( const char* name = 0 ) {
833 return const_cast<XMLElement*>(const_cast<const XMLNode*>(this)->PreviousSiblingElement( name ) );
834 }
835
837 const XMLNode* NextSibling() const {
838 return _next;
839 }
840
842 return _next;
843 }
844
846 const XMLElement* NextSiblingElement( const char* name = 0 ) const;
847
848 XMLElement* NextSiblingElement( const char* name = 0 ) {
849 return const_cast<XMLElement*>(const_cast<const XMLNode*>(this)->NextSiblingElement( name ) );
850 }
851
860
862 return InsertEndChild( addThis );
863 }
880 XMLNode* InsertAfterChild( XMLNode* afterThis, XMLNode* addThis );
881
886
890 void DeleteChild( XMLNode* node );
891
901 virtual XMLNode* ShallowClone( XMLDocument* document ) const = 0;
902
916 XMLNode* DeepClone( XMLDocument* target ) const;
917
924 virtual bool ShallowEqual( const XMLNode* compare ) const = 0;
925
948 virtual bool Accept( XMLVisitor* visitor ) const = 0;
949
955 void SetUserData(void* userData) { _userData = userData; }
956
962 void* GetUserData() const { return _userData; }
963
964protected:
965 explicit XMLNode( XMLDocument* );
966 virtual ~XMLNode();
967
968 virtual char* ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr);
969
974
977
980
982
983private:
984 MemPool* _memPool;
985 void Unlink( XMLNode* child );
986 static void DeleteNode( XMLNode* node );
987 void InsertChildPreamble( XMLNode* insertThis ) const;
988 const XMLElement* ToElementWithName( const char* name ) const;
989
990 XMLNode( const XMLNode& ); // not supported
991 XMLNode& operator=( const XMLNode& ); // not supported
992};
993
994
1007class TINYXML2_LIB XMLText : public XMLNode
1008{
1009 friend class XMLDocument;
1010public:
1011 virtual bool Accept( XMLVisitor* visitor ) const override;
1012
1013 virtual XMLText* ToText() override {
1014 return this;
1015 }
1016 virtual const XMLText* ToText() const override {
1017 return this;
1018 }
1019
1021 void SetCData( bool isCData ) {
1022 _isCData = isCData;
1023 }
1025 bool CData() const {
1026 return _isCData;
1027 }
1028
1029 virtual XMLNode* ShallowClone( XMLDocument* document ) const override;
1030 virtual bool ShallowEqual( const XMLNode* compare ) const override;
1031
1032protected:
1033 explicit XMLText( XMLDocument* doc ) : XMLNode( doc ), _isCData( false ) {}
1034 virtual ~XMLText() {}
1035
1036 char* ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr ) override;
1037
1038private:
1039 bool _isCData;
1040
1041 XMLText( const XMLText& ); // not supported
1042 XMLText& operator=( const XMLText& ); // not supported
1043};
1044
1045
1047class TINYXML2_LIB XMLComment : public XMLNode
1048{
1049 friend class XMLDocument;
1050public:
1051 virtual XMLComment* ToComment() override {
1052 return this;
1053 }
1054 virtual const XMLComment* ToComment() const override {
1055 return this;
1056 }
1057
1058 virtual bool Accept( XMLVisitor* visitor ) const override;
1059
1060 virtual XMLNode* ShallowClone( XMLDocument* document ) const override;
1061 virtual bool ShallowEqual( const XMLNode* compare ) const override;
1062
1063protected:
1064 explicit XMLComment( XMLDocument* doc );
1065 virtual ~XMLComment();
1066
1067 char* ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr) override;
1068
1069private:
1070 XMLComment( const XMLComment& ); // not supported
1071 XMLComment& operator=( const XMLComment& ); // not supported
1072};
1073
1074
1086class TINYXML2_LIB XMLDeclaration : public XMLNode
1087{
1088 friend class XMLDocument;
1089public:
1090 virtual XMLDeclaration* ToDeclaration() override {
1091 return this;
1092 }
1093 virtual const XMLDeclaration* ToDeclaration() const override {
1094 return this;
1095 }
1096
1097 virtual bool Accept( XMLVisitor* visitor ) const override;
1098
1099 virtual XMLNode* ShallowClone( XMLDocument* document ) const override;
1100 virtual bool ShallowEqual( const XMLNode* compare ) const override;
1101
1102protected:
1103 explicit XMLDeclaration( XMLDocument* doc );
1105
1106 char* ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr ) override;
1107
1108private:
1109 XMLDeclaration( const XMLDeclaration& ); // not supported
1110 XMLDeclaration& operator=( const XMLDeclaration& ); // not supported
1111};
1112
1113
1121class TINYXML2_LIB XMLUnknown : public XMLNode
1122{
1123 friend class XMLDocument;
1124public:
1125 virtual XMLUnknown* ToUnknown() override {
1126 return this;
1127 }
1128 virtual const XMLUnknown* ToUnknown() const override {
1129 return this;
1130 }
1131
1132 virtual bool Accept( XMLVisitor* visitor ) const override;
1133
1134 virtual XMLNode* ShallowClone( XMLDocument* document ) const override;
1135 virtual bool ShallowEqual( const XMLNode* compare ) const override;
1136
1137protected:
1138 explicit XMLUnknown( XMLDocument* doc );
1139 virtual ~XMLUnknown();
1140
1141 char* ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr ) override;
1142
1143private:
1144 XMLUnknown( const XMLUnknown& ); // not supported
1145 XMLUnknown& operator=( const XMLUnknown& ); // not supported
1146};
1147
1148
1149
1156class TINYXML2_LIB XMLAttribute
1157{
1158 friend class XMLElement;
1159public:
1161 const char* Name() const;
1162
1164 const char* Value() const;
1165
1167 int GetLineNum() const { return _parseLineNum; }
1168
1170 const XMLAttribute* Next() const {
1171 return _next;
1172 }
1173
1178 int IntValue() const {
1179 int i = 0;
1180 QueryIntValue(&i);
1181 return i;
1182 }
1183
1184 int64_t Int64Value() const {
1185 int64_t i = 0;
1186 QueryInt64Value(&i);
1187 return i;
1188 }
1189
1190 uint64_t Unsigned64Value() const {
1191 uint64_t i = 0;
1192 QueryUnsigned64Value(&i);
1193 return i;
1194 }
1195
1197 unsigned UnsignedValue() const {
1198 unsigned i=0;
1199 QueryUnsignedValue( &i );
1200 return i;
1201 }
1203 bool BoolValue() const {
1204 bool b=false;
1205 QueryBoolValue( &b );
1206 return b;
1207 }
1209 double DoubleValue() const {
1210 double d=0;
1211 QueryDoubleValue( &d );
1212 return d;
1213 }
1215 float FloatValue() const {
1216 float f=0;
1217 QueryFloatValue( &f );
1218 return f;
1219 }
1220
1225 XMLError QueryIntValue( int* value ) const;
1227 XMLError QueryUnsignedValue( unsigned int* value ) const;
1229 XMLError QueryInt64Value(int64_t* value) const;
1231 XMLError QueryUnsigned64Value(uint64_t* value) const;
1233 XMLError QueryBoolValue( bool* value ) const;
1235 XMLError QueryDoubleValue( double* value ) const;
1237 XMLError QueryFloatValue( float* value ) const;
1238
1240 void SetAttribute( const char* value );
1242 void SetAttribute( int value );
1244 void SetAttribute( unsigned value );
1246 void SetAttribute(int64_t value);
1248 void SetAttribute(uint64_t value);
1250 void SetAttribute( bool value );
1252 void SetAttribute( double value );
1254 void SetAttribute( float value );
1255
1256private:
1257 enum { BUF_SIZE = 200 };
1258
1259 XMLAttribute() : _name(), _value(),_parseLineNum( 0 ), _next( 0 ), _memPool( 0 ) {}
1260 virtual ~XMLAttribute() {}
1261
1262 XMLAttribute( const XMLAttribute& ); // not supported
1263 void operator=( const XMLAttribute& ); // not supported
1264 void SetName( const char* name );
1265
1266 char* ParseDeep( char* p, bool processEntities, int* curLineNumPtr );
1267
1268 mutable StrPair _name;
1269 mutable StrPair _value;
1270 int _parseLineNum;
1271 XMLAttribute* _next;
1272 MemPool* _memPool;
1273};
1274
1275
1280class TINYXML2_LIB XMLElement : public XMLNode
1281{
1282 friend class XMLDocument;
1283public:
1285 const char* Name() const {
1286 return Value();
1287 }
1289 void SetName( const char* str, bool staticMem=false ) {
1290 SetValue( str, staticMem );
1291 }
1292
1293 virtual XMLElement* ToElement() override {
1294 return this;
1295 }
1296 virtual const XMLElement* ToElement() const override {
1297 return this;
1298 }
1299 virtual bool Accept( XMLVisitor* visitor ) const override;
1300
1324 const char* Attribute( const char* name, const char* value=0 ) const;
1325
1332 int IntAttribute(const char* name, int defaultValue = 0) const;
1334 unsigned UnsignedAttribute(const char* name, unsigned defaultValue = 0) const;
1336 int64_t Int64Attribute(const char* name, int64_t defaultValue = 0) const;
1338 uint64_t Unsigned64Attribute(const char* name, uint64_t defaultValue = 0) const;
1340 bool BoolAttribute(const char* name, bool defaultValue = false) const;
1342 double DoubleAttribute(const char* name, double defaultValue = 0) const;
1344 float FloatAttribute(const char* name, float defaultValue = 0) const;
1345
1359 XMLError QueryIntAttribute( const char* name, int* value ) const {
1360 const XMLAttribute* a = FindAttribute( name );
1361 if ( !a ) {
1362 return XML_NO_ATTRIBUTE;
1363 }
1364 return a->QueryIntValue( value );
1365 }
1366
1368 XMLError QueryUnsignedAttribute( const char* name, unsigned int* value ) const {
1369 const XMLAttribute* a = FindAttribute( name );
1370 if ( !a ) {
1371 return XML_NO_ATTRIBUTE;
1372 }
1373 return a->QueryUnsignedValue( value );
1374 }
1375
1377 XMLError QueryInt64Attribute(const char* name, int64_t* value) const {
1378 const XMLAttribute* a = FindAttribute(name);
1379 if (!a) {
1380 return XML_NO_ATTRIBUTE;
1381 }
1382 return a->QueryInt64Value(value);
1383 }
1384
1386 XMLError QueryUnsigned64Attribute(const char* name, uint64_t* value) const {
1387 const XMLAttribute* a = FindAttribute(name);
1388 if(!a) {
1389 return XML_NO_ATTRIBUTE;
1390 }
1391 return a->QueryUnsigned64Value(value);
1392 }
1393
1395 XMLError QueryBoolAttribute( const char* name, bool* value ) const {
1396 const XMLAttribute* a = FindAttribute( name );
1397 if ( !a ) {
1398 return XML_NO_ATTRIBUTE;
1399 }
1400 return a->QueryBoolValue( value );
1401 }
1403 XMLError QueryDoubleAttribute( const char* name, double* value ) const {
1404 const XMLAttribute* a = FindAttribute( name );
1405 if ( !a ) {
1406 return XML_NO_ATTRIBUTE;
1407 }
1408 return a->QueryDoubleValue( value );
1409 }
1411 XMLError QueryFloatAttribute( const char* name, float* value ) const {
1412 const XMLAttribute* a = FindAttribute( name );
1413 if ( !a ) {
1414 return XML_NO_ATTRIBUTE;
1415 }
1416 return a->QueryFloatValue( value );
1417 }
1418
1420 XMLError QueryStringAttribute(const char* name, const char** value) const {
1421 const XMLAttribute* a = FindAttribute(name);
1422 if (!a) {
1423 return XML_NO_ATTRIBUTE;
1424 }
1425 *value = a->Value();
1426 return XML_SUCCESS;
1427 }
1428
1429
1430
1448 XMLError QueryAttribute( const char* name, int* value ) const {
1449 return QueryIntAttribute( name, value );
1450 }
1451
1452 XMLError QueryAttribute( const char* name, unsigned int* value ) const {
1453 return QueryUnsignedAttribute( name, value );
1454 }
1455
1456 XMLError QueryAttribute(const char* name, int64_t* value) const {
1457 return QueryInt64Attribute(name, value);
1458 }
1459
1460 XMLError QueryAttribute(const char* name, uint64_t* value) const {
1461 return QueryUnsigned64Attribute(name, value);
1462 }
1463
1464 XMLError QueryAttribute( const char* name, bool* value ) const {
1465 return QueryBoolAttribute( name, value );
1466 }
1467
1468 XMLError QueryAttribute( const char* name, double* value ) const {
1469 return QueryDoubleAttribute( name, value );
1470 }
1471
1472 XMLError QueryAttribute( const char* name, float* value ) const {
1473 return QueryFloatAttribute( name, value );
1474 }
1475
1476 XMLError QueryAttribute(const char* name, const char** value) const {
1477 return QueryStringAttribute(name, value);
1478 }
1479
1481 void SetAttribute( const char* name, const char* value ) {
1482 XMLAttribute* a = FindOrCreateAttribute( name );
1483 a->SetAttribute( value );
1484 }
1486 void SetAttribute( const char* name, int value ) {
1487 XMLAttribute* a = FindOrCreateAttribute( name );
1488 a->SetAttribute( value );
1489 }
1491 void SetAttribute( const char* name, unsigned value ) {
1492 XMLAttribute* a = FindOrCreateAttribute( name );
1493 a->SetAttribute( value );
1494 }
1495
1497 void SetAttribute(const char* name, int64_t value) {
1498 XMLAttribute* a = FindOrCreateAttribute(name);
1499 a->SetAttribute(value);
1500 }
1501
1503 void SetAttribute(const char* name, uint64_t value) {
1504 XMLAttribute* a = FindOrCreateAttribute(name);
1505 a->SetAttribute(value);
1506 }
1507
1509 void SetAttribute( const char* name, bool value ) {
1510 XMLAttribute* a = FindOrCreateAttribute( name );
1511 a->SetAttribute( value );
1512 }
1514 void SetAttribute( const char* name, double value ) {
1515 XMLAttribute* a = FindOrCreateAttribute( name );
1516 a->SetAttribute( value );
1517 }
1519 void SetAttribute( const char* name, float value ) {
1520 XMLAttribute* a = FindOrCreateAttribute( name );
1521 a->SetAttribute( value );
1522 }
1523
1527 void DeleteAttribute( const char* name );
1528
1531 return _rootAttribute;
1532 }
1534 const XMLAttribute* FindAttribute( const char* name ) const;
1535
1564 const char* GetText() const;
1565
1600 void SetText( const char* inText );
1602 void SetText( int value );
1604 void SetText( unsigned value );
1606 void SetText(int64_t value);
1608 void SetText(uint64_t value);
1610 void SetText( bool value );
1612 void SetText( double value );
1614 void SetText( float value );
1615
1642 XMLError QueryIntText( int* ival ) const;
1644 XMLError QueryUnsignedText( unsigned* uval ) const;
1646 XMLError QueryInt64Text(int64_t* uval) const;
1648 XMLError QueryUnsigned64Text(uint64_t* uval) const;
1650 XMLError QueryBoolText( bool* bval ) const;
1652 XMLError QueryDoubleText( double* dval ) const;
1654 XMLError QueryFloatText( float* fval ) const;
1655
1656 int IntText(int defaultValue = 0) const;
1657
1659 unsigned UnsignedText(unsigned defaultValue = 0) const;
1661 int64_t Int64Text(int64_t defaultValue = 0) const;
1663 uint64_t Unsigned64Text(uint64_t defaultValue = 0) const;
1665 bool BoolText(bool defaultValue = false) const;
1667 double DoubleText(double defaultValue = 0) const;
1669 float FloatText(float defaultValue = 0) const;
1670
1677 XMLComment* InsertNewComment(const char* comment);
1679 XMLText* InsertNewText(const char* text);
1683 XMLUnknown* InsertNewUnknown(const char* text);
1684
1685
1686 // internal:
1688 OPEN, // <foo>
1689 CLOSED, // <foo/>
1690 CLOSING // </foo>
1693 return _closingType;
1694 }
1695 virtual XMLNode* ShallowClone( XMLDocument* document ) const override;
1696 virtual bool ShallowEqual( const XMLNode* compare ) const override;
1697
1698protected:
1699 char* ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr ) override;
1700
1701private:
1702 XMLElement( XMLDocument* doc );
1703 virtual ~XMLElement();
1704 XMLElement( const XMLElement& ); // not supported
1705 void operator=( const XMLElement& ); // not supported
1706
1707 XMLAttribute* FindOrCreateAttribute( const char* name );
1708 char* ParseAttributes( char* p, int* curLineNumPtr );
1709 static void DeleteAttribute( XMLAttribute* attribute );
1710 XMLAttribute* CreateAttribute();
1711
1712 enum { BUF_SIZE = 200 };
1713 ElementClosingType _closingType;
1714 // The attribute list is ordered; there is no 'lastAttribute'
1715 // because the list needs to be scanned for dupes before adding
1716 // a new attribute.
1717 XMLAttribute* _rootAttribute;
1718};
1719
1720
1726
1727
1733class TINYXML2_LIB XMLDocument : public XMLNode
1734{
1735 friend class XMLElement;
1736 // Gives access to SetError and Push/PopDepth, but over-access for everything else.
1737 // Wishing C++ had "internal" scope.
1738 friend class XMLNode;
1739 friend class XMLText;
1740 friend class XMLComment;
1741 friend class XMLDeclaration;
1742 friend class XMLUnknown;
1743public:
1745 XMLDocument( bool processEntities = true, Whitespace whitespaceMode = PRESERVE_WHITESPACE );
1747
1748 virtual XMLDocument* ToDocument() override {
1749 TIXMLASSERT( this == _document );
1750 return this;
1751 }
1752 virtual const XMLDocument* ToDocument() const override {
1753 TIXMLASSERT( this == _document );
1754 return this;
1755 }
1756
1767 XMLError Parse( const char* xml, size_t nBytes=static_cast<size_t>(-1) );
1768
1774 XMLError LoadFile( const char* filename );
1775
1788
1794 XMLError SaveFile( const char* filename, bool compact = false );
1795
1803 XMLError SaveFile( FILE* fp, bool compact = false );
1804
1805 bool ProcessEntities() const {
1806 return _processEntities;
1807 }
1809 return _whitespaceMode;
1810 }
1811
1815 bool HasBOM() const {
1816 return _writeBOM;
1817 }
1820 void SetBOM( bool useBOM ) {
1821 _writeBOM = useBOM;
1822 }
1823
1828 return FirstChildElement();
1829 }
1830 const XMLElement* RootElement() const {
1831 return FirstChildElement();
1832 }
1833
1848 void Print( XMLPrinter* streamer=0 ) const;
1849 virtual bool Accept( XMLVisitor* visitor ) const override;
1850
1856 XMLElement* NewElement( const char* name );
1862 XMLComment* NewComment( const char* comment );
1868 XMLText* NewText( const char* text );
1880 XMLDeclaration* NewDeclaration( const char* text=0 );
1886 XMLUnknown* NewUnknown( const char* text );
1887
1892 void DeleteNode( XMLNode* node );
1893
1896
1898 bool Error() const {
1899 return _errorID != XML_SUCCESS;
1900 }
1903 return _errorID;
1904 }
1905 const char* ErrorName() const;
1906 static const char* ErrorIDToName(XMLError errorID);
1907
1911 const char* ErrorStr() const;
1912
1914 void PrintError() const;
1915
1917 int ErrorLineNum() const
1918 {
1919 return _errorLineNum;
1920 }
1921
1923 void Clear();
1924
1932 void DeepCopy(XMLDocument* target) const;
1933
1934 // internal
1935 char* Identify( char* p, XMLNode** node, bool first );
1936
1937 // internal
1938 void MarkInUse(const XMLNode* const);
1939
1940 virtual XMLNode* ShallowClone( XMLDocument* /*document*/ ) const override{
1941 return 0;
1942 }
1943 virtual bool ShallowEqual( const XMLNode* /*compare*/ ) const override{
1944 return false;
1945 }
1946
1947private:
1948 XMLDocument( const XMLDocument& ); // not supported
1949 void operator=( const XMLDocument& ); // not supported
1950
1951 bool _writeBOM;
1952 bool _processEntities;
1953 XMLError _errorID;
1954 Whitespace _whitespaceMode;
1955 mutable StrPair _errorStr;
1956 int _errorLineNum;
1957 char* _charBuffer;
1958 int _parseCurLineNum;
1959 int _parsingDepth;
1960 // Memory tracking does add some overhead.
1961 // However, the code assumes that you don't
1962 // have a bunch of unlinked nodes around.
1963 // Therefore it takes less memory to track
1964 // in the document vs. a linked list in the XMLNode,
1965 // and the performance is the same.
1966 DynArray<XMLNode*, 10> _unlinked;
1967
1968 MemPoolT< sizeof(XMLElement) > _elementPool;
1969 MemPoolT< sizeof(XMLAttribute) > _attributePool;
1970 MemPoolT< sizeof(XMLText) > _textPool;
1971 MemPoolT< sizeof(XMLComment) > _commentPool;
1972
1973 static const char* _errorNames[XML_ERROR_COUNT];
1974
1975 void Parse();
1976
1977 void SetError( XMLError error, int lineNum, const char* format, ... );
1978
1979 // Something of an obvious security hole, once it was discovered.
1980 // Either an ill-formed XML or an excessively deep one can overflow
1981 // the stack. Track stack depth, and error out if needed.
1982 class DepthTracker {
1983 public:
1984 explicit DepthTracker(XMLDocument * document) {
1985 this->_document = document;
1986 document->PushDepth();
1987 }
1988 ~DepthTracker() {
1989 _document->PopDepth();
1990 }
1991 private:
1992 XMLDocument * _document;
1993 };
1994 void PushDepth();
1995 void PopDepth();
1996
1997 template<class NodeType, size_t PoolElementSize>
1998 NodeType* CreateUnlinkedNode( MemPoolT<PoolElementSize>& pool );
1999};
2000
2001template<class NodeType, size_t PoolElementSize>
2002inline NodeType* XMLDocument::CreateUnlinkedNode( MemPoolT<PoolElementSize>& pool )
2003{
2004 TIXMLASSERT( sizeof( NodeType ) == PoolElementSize );
2005 TIXMLASSERT( sizeof( NodeType ) == pool.ItemSize() );
2006 NodeType* returnNode = new (pool.Alloc()) NodeType( this );
2007 TIXMLASSERT( returnNode );
2008 returnNode->_memPool = &pool;
2009
2010 _unlinked.Push(returnNode);
2011 return returnNode;
2012}
2013
2069class TINYXML2_LIB XMLHandle
2070{
2071public:
2073 explicit XMLHandle( XMLNode* node ) : _node( node ) {
2074 }
2076 explicit XMLHandle( XMLNode& node ) : _node( &node ) {
2077 }
2079 XMLHandle( const XMLHandle& ref ) : _node( ref._node ) {
2080 }
2083 _node = ref._node;
2084 return *this;
2085 }
2086
2089 return XMLHandle( _node ? _node->FirstChild() : 0 );
2090 }
2092 XMLHandle FirstChildElement( const char* name = 0 ) {
2093 return XMLHandle( _node ? _node->FirstChildElement( name ) : 0 );
2094 }
2097 return XMLHandle( _node ? _node->LastChild() : 0 );
2098 }
2100 XMLHandle LastChildElement( const char* name = 0 ) {
2101 return XMLHandle( _node ? _node->LastChildElement( name ) : 0 );
2102 }
2105 return XMLHandle( _node ? _node->PreviousSibling() : 0 );
2106 }
2108 XMLHandle PreviousSiblingElement( const char* name = 0 ) {
2109 return XMLHandle( _node ? _node->PreviousSiblingElement( name ) : 0 );
2110 }
2113 return XMLHandle( _node ? _node->NextSibling() : 0 );
2114 }
2116 XMLHandle NextSiblingElement( const char* name = 0 ) {
2117 return XMLHandle( _node ? _node->NextSiblingElement( name ) : 0 );
2118 }
2119
2122 return _node;
2123 }
2126 return ( _node ? _node->ToElement() : 0 );
2127 }
2130 return ( _node ? _node->ToText() : 0 );
2131 }
2134 return ( _node ? _node->ToUnknown() : 0 );
2135 }
2138 return ( _node ? _node->ToDeclaration() : 0 );
2139 }
2140
2141private:
2142 XMLNode* _node;
2143};
2144
2145
2150class TINYXML2_LIB XMLConstHandle
2151{
2152public:
2153 explicit XMLConstHandle( const XMLNode* node ) : _node( node ) {
2154 }
2155 explicit XMLConstHandle( const XMLNode& node ) : _node( &node ) {
2156 }
2157 XMLConstHandle( const XMLConstHandle& ref ) : _node( ref._node ) {
2158 }
2159
2161 _node = ref._node;
2162 return *this;
2163 }
2164
2166 return XMLConstHandle( _node ? _node->FirstChild() : 0 );
2167 }
2168 const XMLConstHandle FirstChildElement( const char* name = 0 ) const {
2169 return XMLConstHandle( _node ? _node->FirstChildElement( name ) : 0 );
2170 }
2172 return XMLConstHandle( _node ? _node->LastChild() : 0 );
2173 }
2174 const XMLConstHandle LastChildElement( const char* name = 0 ) const {
2175 return XMLConstHandle( _node ? _node->LastChildElement( name ) : 0 );
2176 }
2178 return XMLConstHandle( _node ? _node->PreviousSibling() : 0 );
2179 }
2180 const XMLConstHandle PreviousSiblingElement( const char* name = 0 ) const {
2181 return XMLConstHandle( _node ? _node->PreviousSiblingElement( name ) : 0 );
2182 }
2184 return XMLConstHandle( _node ? _node->NextSibling() : 0 );
2185 }
2186 const XMLConstHandle NextSiblingElement( const char* name = 0 ) const {
2187 return XMLConstHandle( _node ? _node->NextSiblingElement( name ) : 0 );
2188 }
2189
2190
2191 const XMLNode* ToNode() const {
2192 return _node;
2193 }
2194 const XMLElement* ToElement() const {
2195 return ( _node ? _node->ToElement() : 0 );
2196 }
2197 const XMLText* ToText() const {
2198 return ( _node ? _node->ToText() : 0 );
2199 }
2200 const XMLUnknown* ToUnknown() const {
2201 return ( _node ? _node->ToUnknown() : 0 );
2202 }
2204 return ( _node ? _node->ToDeclaration() : 0 );
2205 }
2206
2207private:
2208 const XMLNode* _node;
2209};
2210
2211
2254class TINYXML2_LIB XMLPrinter : public XMLVisitor
2255{
2256public:
2259 DONT_ESCAPE_APOS_CHARS_IN_ATTRIBUTES
2261
2268 XMLPrinter( FILE* file=0, bool compact = false, int depth = 0, EscapeAposCharsInAttributes aposInAttributes = ESCAPE_APOS_CHARS_IN_ATTRIBUTES );
2269 virtual ~XMLPrinter() {}
2270
2272 void PushHeader( bool writeBOM, bool writeDeclaration );
2276 void OpenElement( const char* name, bool compactMode=false );
2278 void PushAttribute( const char* name, const char* value );
2279 void PushAttribute( const char* name, int value );
2280 void PushAttribute( const char* name, unsigned value );
2281 void PushAttribute( const char* name, int64_t value );
2282 void PushAttribute( const char* name, uint64_t value );
2283 void PushAttribute( const char* name, bool value );
2284 void PushAttribute( const char* name, double value );
2286 virtual void CloseElement( bool compactMode=false );
2287
2289 void PushText( const char* text, bool cdata=false );
2291 void PushText( int value );
2293 void PushText( unsigned value );
2295 void PushText( int64_t value );
2297 void PushText( uint64_t value );
2299 void PushText( bool value );
2301 void PushText( float value );
2303 void PushText( double value );
2304
2306 void PushComment( const char* comment );
2307
2308 void PushDeclaration( const char* value );
2309 void PushUnknown( const char* value );
2310
2311 virtual bool VisitEnter( const XMLDocument& /*doc*/ ) override;
2312 virtual bool VisitExit( const XMLDocument& /*doc*/ ) override {
2313 return true;
2314 }
2315
2316 virtual bool VisitEnter( const XMLElement& element, const XMLAttribute* attribute ) override;
2317 virtual bool VisitExit( const XMLElement& element ) override;
2318
2319 virtual bool Visit( const XMLText& text ) override;
2320 virtual bool Visit( const XMLComment& comment ) override;
2321 virtual bool Visit( const XMLDeclaration& declaration ) override;
2322 virtual bool Visit( const XMLUnknown& unknown ) override;
2323
2328 const char* CStr() const {
2329 return _buffer.Mem();
2330 }
2336 size_t CStrSize() const {
2337 return _buffer.Size();
2338 }
2343 void ClearBuffer( bool resetToFirstElement = true ) {
2344 _buffer.Clear();
2345 _buffer.Push(0);
2346 _firstElement = resetToFirstElement;
2347 }
2348
2349protected:
2350 virtual bool CompactMode( const XMLElement& ) { return _compactMode; }
2351
2355 virtual void PrintSpace( int depth );
2356 virtual void Print( const char* format, ... );
2357 virtual void Write( const char* data, size_t size );
2358 virtual void Putc( char ch );
2359
2360 inline void Write(const char* data) { Write(data, strlen(data)); }
2361
2365
2366private:
2371 void PrepareForNewNode( bool compactMode );
2372 void PrintString( const char*, bool restrictedEntitySet ); // prints out, after detecting entities.
2373
2374 bool _firstElement;
2375 FILE* _fp;
2376 int _depth;
2377 int _textDepth;
2378 bool _processEntities;
2379 bool _compactMode;
2380
2381 enum {
2382 ENTITY_RANGE = 64,
2383 BUF_SIZE = 200
2384 };
2385 bool _entityFlag[ENTITY_RANGE];
2386 bool _restrictedEntityFlag[ENTITY_RANGE];
2387
2388 DynArray< char, 20 > _buffer;
2389
2390 // Prohibit cloning, intentionally not implemented
2391 XMLPrinter( const XMLPrinter& );
2392 XMLPrinter& operator=( const XMLPrinter& );
2393};
2394
2395
2396} // tinyxml2
2397} // namespace External
2398} // namespace Aws
2399
2400#if defined(_MSC_VER)
2401# pragma warning(pop)
2402#endif
2403
2404#endif // TINYXML2_INCLUDED
const T & operator[](size_t i) const
Definition tinyxml2.h:274
virtual void Free(void *)=0
virtual size_t ItemSize() const =0
virtual size_t ItemSize() const override
Definition tinyxml2.h:379
void Trace(const char *name)
Definition tinyxml2.h:424
virtual void * Alloc() override
Definition tinyxml2.h:386
virtual void Free(void *mem) override
Definition tinyxml2.h:412
void Set(char *start, char *end, int flags)
Definition tinyxml2.h:168
void SetStr(const char *str, int flags=0)
void SetInternedStr(const char *str)
Definition tinyxml2.h:183
void TransferTo(StrPair *other)
char * ParseText(char *in, const char *endTag, int strFlags, int *curLineNumPtr)
const char * Value() const
The value of the attribute.
XMLError QueryInt64Value(int64_t *value) const
See QueryIntValue.
float FloatValue() const
Query as a float. See IntValue()
Definition tinyxml2.h:1215
XMLError QueryUnsigned64Value(uint64_t *value) const
See QueryIntValue.
bool BoolValue() const
Query as a boolean. See IntValue()
Definition tinyxml2.h:1203
void SetAttribute(int64_t value)
Set the attribute to value.
int GetLineNum() const
Gets the line number the attribute is in, if the document was parsed from a file.
Definition tinyxml2.h:1167
void SetAttribute(double value)
Set the attribute to value.
const XMLAttribute * Next() const
The next attribute in the list.
Definition tinyxml2.h:1170
void SetAttribute(int value)
Set the attribute to value.
unsigned UnsignedValue() const
Query as an unsigned integer. See IntValue()
Definition tinyxml2.h:1197
void SetAttribute(bool value)
Set the attribute to value.
const char * Name() const
The name of the attribute.
XMLError QueryBoolValue(bool *value) const
See QueryIntValue.
XMLError QueryUnsignedValue(unsigned int *value) const
See QueryIntValue.
void SetAttribute(const char *value)
Set the attribute to a string value.
void SetAttribute(uint64_t value)
Set the attribute to value.
void SetAttribute(float value)
Set the attribute to value.
void SetAttribute(unsigned value)
Set the attribute to value.
XMLError QueryFloatValue(float *value) const
See QueryIntValue.
double DoubleValue() const
Query as a double. See IntValue()
Definition tinyxml2.h:1209
XMLError QueryDoubleValue(double *value) const
See QueryIntValue.
XMLError QueryIntValue(int *value) const
virtual const XMLComment * ToComment() const override
Definition tinyxml2.h:1054
virtual bool Accept(XMLVisitor *visitor) const override
virtual bool ShallowEqual(const XMLNode *compare) const override
virtual XMLNode * ShallowClone(XMLDocument *document) const override
char * ParseDeep(char *p, StrPair *parentEndTag, int *curLineNumPtr) override
virtual XMLComment * ToComment() override
Safely cast to a Comment, or null.
Definition tinyxml2.h:1051
XMLConstHandle & operator=(const XMLConstHandle &ref)
Definition tinyxml2.h:2160
const XMLConstHandle NextSiblingElement(const char *name=0) const
Definition tinyxml2.h:2186
XMLConstHandle(const XMLConstHandle &ref)
Definition tinyxml2.h:2157
const XMLElement * ToElement() const
Definition tinyxml2.h:2194
const XMLConstHandle PreviousSiblingElement(const char *name=0) const
Definition tinyxml2.h:2180
const XMLConstHandle LastChild() const
Definition tinyxml2.h:2171
const XMLConstHandle LastChildElement(const char *name=0) const
Definition tinyxml2.h:2174
const XMLConstHandle FirstChild() const
Definition tinyxml2.h:2165
const XMLDeclaration * ToDeclaration() const
Definition tinyxml2.h:2203
const XMLConstHandle PreviousSibling() const
Definition tinyxml2.h:2177
const XMLConstHandle NextSibling() const
Definition tinyxml2.h:2183
const XMLUnknown * ToUnknown() const
Definition tinyxml2.h:2200
const XMLConstHandle FirstChildElement(const char *name=0) const
Definition tinyxml2.h:2168
virtual XMLDeclaration * ToDeclaration() override
Safely cast to a Declaration, or null.
Definition tinyxml2.h:1090
char * ParseDeep(char *p, StrPair *parentEndTag, int *curLineNumPtr) override
virtual XMLNode * ShallowClone(XMLDocument *document) const override
virtual const XMLDeclaration * ToDeclaration() const override
Definition tinyxml2.h:1093
virtual bool Accept(XMLVisitor *visitor) const override
virtual bool ShallowEqual(const XMLNode *compare) const override
void Print(XMLPrinter *streamer=0) const
XMLError SaveFile(const char *filename, bool compact=false)
void MarkInUse(const XMLNode *const)
XMLError LoadFile(const char *filename)
int ErrorLineNum() const
Return the line where the error occurred, or zero if unknown.
Definition tinyxml2.h:1917
virtual XMLDocument * ToDocument() override
Safely cast to a Document, or null.
Definition tinyxml2.h:1748
bool Error() const
Return true if there was an error parsing the document.
Definition tinyxml2.h:1898
virtual XMLNode * ShallowClone(XMLDocument *) const override
Definition tinyxml2.h:1940
void PrintError() const
A (trivial) utility function that prints the ErrorStr() to stdout.
static const char * ErrorIDToName(XMLError errorID)
XMLDeclaration * NewDeclaration(const char *text=0)
XMLDocument(bool processEntities=true, Whitespace whitespaceMode=PRESERVE_WHITESPACE)
constructor
XMLError Parse(const char *xml, size_t nBytes=static_cast< size_t >(-1))
virtual bool Accept(XMLVisitor *visitor) const override
XMLElement * NewElement(const char *name)
XMLText * NewText(const char *text)
const XMLElement * RootElement() const
Definition tinyxml2.h:1830
virtual const XMLDocument * ToDocument() const override
Definition tinyxml2.h:1752
void Clear()
Clear the document, resetting it to the initial state.
XMLError SaveFile(FILE *fp, bool compact=false)
XMLUnknown * NewUnknown(const char *text)
void ClearError()
Clears the error flags.
virtual bool ShallowEqual(const XMLNode *) const override
Definition tinyxml2.h:1943
XMLComment * NewComment(const char *comment)
char * Identify(char *p, XMLNode **node, bool first)
XMLError ErrorID() const
Return the errorID.
Definition tinyxml2.h:1902
void DeepCopy(XMLDocument *target) const
void DeleteAttribute(const char *name)
unsigned UnsignedAttribute(const char *name, unsigned defaultValue=0) const
See IntAttribute()
uint64_t Unsigned64Text(uint64_t defaultValue=0) const
See QueryIntText()
XMLComment * InsertNewComment(const char *comment)
See InsertNewChildElement()
bool BoolText(bool defaultValue=false) const
See QueryIntText()
int IntAttribute(const char *name, int defaultValue=0) const
void SetAttribute(const char *name, int value)
Sets the named attribute to value.
Definition tinyxml2.h:1486
void SetAttribute(const char *name, uint64_t value)
Sets the named attribute to value.
Definition tinyxml2.h:1503
XMLError QueryAttribute(const char *name, int64_t *value) const
Definition tinyxml2.h:1456
XMLError QueryUnsignedText(unsigned *uval) const
See QueryIntText()
void SetName(const char *str, bool staticMem=false)
Set the name of the element.
Definition tinyxml2.h:1289
XMLText * InsertNewText(const char *text)
See InsertNewChildElement()
XMLError QueryBoolText(bool *bval) const
See QueryIntText()
void SetText(int64_t value)
Convenience method for setting text inside an element. See SetText() for important limitations.
float FloatAttribute(const char *name, float defaultValue=0) const
See IntAttribute()
XMLError QueryUnsigned64Attribute(const char *name, uint64_t *value) const
See QueryIntAttribute()
Definition tinyxml2.h:1386
void SetAttribute(const char *name, bool value)
Sets the named attribute to value.
Definition tinyxml2.h:1509
XMLError QueryBoolAttribute(const char *name, bool *value) const
See QueryIntAttribute()
Definition tinyxml2.h:1395
void SetText(int value)
Convenience method for setting text inside an element. See SetText() for important limitations.
int64_t Int64Text(int64_t defaultValue=0) const
See QueryIntText()
virtual bool ShallowEqual(const XMLNode *compare) const override
XMLError QueryFloatText(float *fval) const
See QueryIntText()
XMLError QueryUnsignedAttribute(const char *name, unsigned int *value) const
See QueryIntAttribute()
Definition tinyxml2.h:1368
virtual XMLNode * ShallowClone(XMLDocument *document) const override
void SetAttribute(const char *name, float value)
Sets the named attribute to value.
Definition tinyxml2.h:1519
XMLError QueryAttribute(const char *name, float *value) const
Definition tinyxml2.h:1472
uint64_t Unsigned64Attribute(const char *name, uint64_t defaultValue=0) const
See IntAttribute()
virtual bool Accept(XMLVisitor *visitor) const override
void SetText(double value)
Convenience method for setting text inside an element. See SetText() for important limitations.
virtual XMLElement * ToElement() override
Safely cast to an Element, or null.
Definition tinyxml2.h:1293
float FloatText(float defaultValue=0) const
See QueryIntText()
XMLError QueryFloatAttribute(const char *name, float *value) const
See QueryIntAttribute()
Definition tinyxml2.h:1411
double DoubleText(double defaultValue=0) const
See QueryIntText()
XMLError QueryAttribute(const char *name, unsigned int *value) const
Definition tinyxml2.h:1452
void SetText(bool value)
Convenience method for setting text inside an element. See SetText() for important limitations.
ElementClosingType ClosingType() const
Definition tinyxml2.h:1692
XMLError QueryInt64Text(int64_t *uval) const
See QueryIntText()
XMLError QueryDoubleText(double *dval) const
See QueryIntText()
void SetText(float value)
Convenience method for setting text inside an element. See SetText() for important limitations.
const char * Name() const
Get the name of an element (which is the Value() of the node.)
Definition tinyxml2.h:1285
const XMLAttribute * FindAttribute(const char *name) const
Query a specific attribute in the list.
int IntText(int defaultValue=0) const
unsigned UnsignedText(unsigned defaultValue=0) const
See QueryIntText()
XMLError QueryUnsigned64Text(uint64_t *uval) const
See QueryIntText()
void SetText(const char *inText)
XMLError QueryStringAttribute(const char *name, const char **value) const
See QueryIntAttribute()
Definition tinyxml2.h:1420
XMLDeclaration * InsertNewDeclaration(const char *text)
See InsertNewChildElement()
bool BoolAttribute(const char *name, bool defaultValue=false) const
See IntAttribute()
XMLError QueryAttribute(const char *name, double *value) const
Definition tinyxml2.h:1468
XMLError QueryAttribute(const char *name, bool *value) const
Definition tinyxml2.h:1464
void SetAttribute(const char *name, unsigned value)
Sets the named attribute to value.
Definition tinyxml2.h:1491
void SetText(unsigned value)
Convenience method for setting text inside an element. See SetText() for important limitations.
void SetAttribute(const char *name, const char *value)
Sets the named attribute to value.
Definition tinyxml2.h:1481
XMLError QueryAttribute(const char *name, const char **value) const
Definition tinyxml2.h:1476
XMLError QueryInt64Attribute(const char *name, int64_t *value) const
See QueryIntAttribute()
Definition tinyxml2.h:1377
const char * Attribute(const char *name, const char *value=0) const
XMLError QueryIntAttribute(const char *name, int *value) const
Definition tinyxml2.h:1359
XMLError QueryAttribute(const char *name, int *value) const
Definition tinyxml2.h:1448
double DoubleAttribute(const char *name, double defaultValue=0) const
See IntAttribute()
virtual const XMLElement * ToElement() const override
Definition tinyxml2.h:1296
XMLError QueryIntText(int *ival) const
XMLElement * InsertNewChildElement(const char *name)
XMLError QueryAttribute(const char *name, uint64_t *value) const
Definition tinyxml2.h:1460
XMLUnknown * InsertNewUnknown(const char *text)
See InsertNewChildElement()
void SetText(uint64_t value)
Convenience method for setting text inside an element. See SetText() for important limitations.
void SetAttribute(const char *name, double value)
Sets the named attribute to value.
Definition tinyxml2.h:1514
void SetAttribute(const char *name, int64_t value)
Sets the named attribute to value.
Definition tinyxml2.h:1497
const XMLAttribute * FirstAttribute() const
Return the first attribute in the list.
Definition tinyxml2.h:1530
int64_t Int64Attribute(const char *name, int64_t defaultValue=0) const
See IntAttribute()
char * ParseDeep(char *p, StrPair *parentEndTag, int *curLineNumPtr) override
XMLError QueryDoubleAttribute(const char *name, double *value) const
See QueryIntAttribute()
Definition tinyxml2.h:1403
XMLHandle FirstChildElement(const char *name=0)
Get the first child element of this handle.
Definition tinyxml2.h:2092
XMLHandle FirstChild()
Get the first child of this handle.
Definition tinyxml2.h:2088
XMLText * ToText()
Safe cast to XMLText. This can return null.
Definition tinyxml2.h:2129
XMLUnknown * ToUnknown()
Safe cast to XMLUnknown. This can return null.
Definition tinyxml2.h:2133
XMLDeclaration * ToDeclaration()
Safe cast to XMLDeclaration. This can return null.
Definition tinyxml2.h:2137
XMLNode * ToNode()
Safe cast to XMLNode. This can return null.
Definition tinyxml2.h:2121
XMLElement * ToElement()
Safe cast to XMLElement. This can return null.
Definition tinyxml2.h:2125
XMLHandle PreviousSibling()
Get the previous sibling of this handle.
Definition tinyxml2.h:2104
XMLHandle LastChildElement(const char *name=0)
Get the last child element of this handle.
Definition tinyxml2.h:2100
XMLHandle PreviousSiblingElement(const char *name=0)
Get the previous sibling element of this handle.
Definition tinyxml2.h:2108
XMLHandle LastChild()
Get the last child of this handle.
Definition tinyxml2.h:2096
XMLHandle(const XMLHandle &ref)
Copy constructor.
Definition tinyxml2.h:2079
XMLHandle NextSiblingElement(const char *name=0)
Get the next sibling element of this handle.
Definition tinyxml2.h:2116
XMLHandle(XMLNode *node)
Create a handle from any node (at any depth of the tree.) This can be a null pointer.
Definition tinyxml2.h:2073
XMLHandle & operator=(const XMLHandle &ref)
Assignment.
Definition tinyxml2.h:2082
XMLHandle NextSibling()
Get the next sibling of this handle.
Definition tinyxml2.h:2112
XMLHandle(XMLNode &node)
Create a handle from a node.
Definition tinyxml2.h:2076
virtual XMLDeclaration * ToDeclaration()
Safely cast to a Declaration, or null.
Definition tinyxml2.h:718
const XMLNode * NextSibling() const
Get the next (right) sibling node of this node.
Definition tinyxml2.h:837
virtual const XMLDeclaration * ToDeclaration() const
Definition tinyxml2.h:738
virtual bool ShallowEqual(const XMLNode *compare) const =0
const XMLNode * FirstChild() const
Get the first child node, or null if none exists.
Definition tinyxml2.h:785
const XMLElement * PreviousSiblingElement(const char *name=0) const
Get the previous (left) sibling element of this node, with an optionally supplied name.
virtual const XMLComment * ToComment() const
Definition tinyxml2.h:732
XMLElement * FirstChildElement(const char *name=0)
Definition tinyxml2.h:798
bool NoChildren() const
Returns true if this node has no children.
Definition tinyxml2.h:780
virtual bool Accept(XMLVisitor *visitor) const =0
XMLDocument * GetDocument()
Get the XMLDocument that owns this XMLNode.
Definition tinyxml2.h:696
const XMLElement * NextSiblingElement(const char *name=0) const
Get the next (right) sibling element of this node, with an optionally supplied name.
virtual const XMLUnknown * ToUnknown() const
Definition tinyxml2.h:741
virtual XMLText * ToText()
Safely cast to Text, or null.
Definition tinyxml2.h:706
const XMLNode * PreviousSibling() const
Get the previous (left) sibling node of this node.
Definition tinyxml2.h:821
XMLNode * InsertFirstChild(XMLNode *addThis)
XMLNode * InsertEndChild(XMLNode *addThis)
XMLNode * DeepClone(XMLDocument *target) const
virtual const XMLElement * ToElement() const
Definition tinyxml2.h:726
virtual XMLComment * ToComment()
Safely cast to a Comment, or null.
Definition tinyxml2.h:710
void SetValue(const char *val, bool staticMem=false)
virtual const XMLDocument * ToDocument() const
Definition tinyxml2.h:735
XMLElement * LastChildElement(const char *name=0)
Definition tinyxml2.h:816
XMLElement * PreviousSiblingElement(const char *name=0)
Definition tinyxml2.h:832
const XMLElement * LastChildElement(const char *name=0) const
XMLElement * NextSiblingElement(const char *name=0)
Definition tinyxml2.h:848
virtual XMLNode * ShallowClone(XMLDocument *document) const =0
XMLNode * InsertAfterChild(XMLNode *afterThis, XMLNode *addThis)
const XMLNode * Parent() const
Get the parent of this node on the DOM.
Definition tinyxml2.h:771
const char * Value() const
const XMLNode * LastChild() const
Get the last child node, or null if none exists.
Definition tinyxml2.h:803
virtual XMLUnknown * ToUnknown()
Safely cast to an Unknown, or null.
Definition tinyxml2.h:722
virtual char * ParseDeep(char *p, StrPair *parentEndTag, int *curLineNumPtr)
virtual XMLDocument * ToDocument()
Safely cast to a Document, or null.
Definition tinyxml2.h:714
int GetLineNum() const
Gets the line number the node is in, if the document was parsed from a file.
Definition tinyxml2.h:768
const XMLElement * FirstChildElement(const char *name=0) const
XMLNode * LinkEndChild(XMLNode *addThis)
Definition tinyxml2.h:861
void DeleteChild(XMLNode *node)
void SetUserData(void *userData)
Definition tinyxml2.h:955
virtual const XMLText * ToText() const
Definition tinyxml2.h:729
int ChildElementCount(const char *value) const
const XMLDocument * GetDocument() const
Get the XMLDocument that owns this XMLNode.
Definition tinyxml2.h:691
virtual XMLElement * ToElement()
Safely cast to an Element, or null.
Definition tinyxml2.h:702
virtual bool CompactMode(const XMLElement &)
Definition tinyxml2.h:2350
void OpenElement(const char *name, bool compactMode=false)
void PushAttribute(const char *name, int value)
void PushUnknown(const char *value)
void PushText(double value)
Add a text node from a double.
virtual bool VisitEnter(const XMLDocument &) override
Visit a document.
void PushText(bool value)
Add a text node from a bool.
void PushText(const char *text, bool cdata=false)
Add a text node.
void PushAttribute(const char *name, int64_t value)
XMLPrinter(FILE *file=0, bool compact=false, int depth=0, EscapeAposCharsInAttributes aposInAttributes=ESCAPE_APOS_CHARS_IN_ATTRIBUTES)
virtual bool VisitExit(const XMLElement &element) override
Visit an element.
virtual void PrintSpace(int depth)
void PushAttribute(const char *name, const char *value)
If streaming, add an attribute to an open element.
virtual void CloseElement(bool compactMode=false)
If streaming, close the Element.
DynArray< const char *, 10 > _stack
Definition tinyxml2.h:2364
void PushText(unsigned value)
Add a text node from an unsigned.
void PushText(float value)
Add a text node from a float.
virtual bool Visit(const XMLText &text) override
Visit a text node.
void PushAttribute(const char *name, bool value)
void Write(const char *data)
Definition tinyxml2.h:2360
void PushText(int value)
Add a text node from an integer.
virtual void Write(const char *data, size_t size)
void PushHeader(bool writeBOM, bool writeDeclaration)
virtual bool VisitEnter(const XMLElement &element, const XMLAttribute *attribute) override
Visit an element.
void PushAttribute(const char *name, double value)
void PushAttribute(const char *name, unsigned value)
virtual bool VisitExit(const XMLDocument &) override
Visit a document.
Definition tinyxml2.h:2312
void ClearBuffer(bool resetToFirstElement=true)
Definition tinyxml2.h:2343
virtual bool Visit(const XMLComment &comment) override
Visit a comment node.
void PushText(int64_t value)
Add a text node from a signed 64bit integer.
virtual void Print(const char *format,...)
void PushDeclaration(const char *value)
void PushComment(const char *comment)
Add a comment.
virtual bool Visit(const XMLDeclaration &declaration) override
Visit a declaration.
virtual bool Visit(const XMLUnknown &unknown) override
Visit an unknown node.
void PushText(uint64_t value)
Add a text node from an unsigned 64bit integer.
void PushAttribute(const char *name, uint64_t value)
virtual const XMLText * ToText() const override
Definition tinyxml2.h:1016
bool CData() const
Returns true if this is a CDATA text element.
Definition tinyxml2.h:1025
virtual bool ShallowEqual(const XMLNode *compare) const override
void SetCData(bool isCData)
Declare whether this should be CDATA or standard text.
Definition tinyxml2.h:1021
virtual bool Accept(XMLVisitor *visitor) const override
char * ParseDeep(char *p, StrPair *parentEndTag, int *curLineNumPtr) override
virtual XMLNode * ShallowClone(XMLDocument *document) const override
virtual XMLText * ToText() override
Safely cast to Text, or null.
Definition tinyxml2.h:1013
virtual XMLNode * ShallowClone(XMLDocument *document) const override
virtual const XMLUnknown * ToUnknown() const override
Definition tinyxml2.h:1128
virtual bool ShallowEqual(const XMLNode *compare) const override
virtual bool Accept(XMLVisitor *visitor) const override
char * ParseDeep(char *p, StrPair *parentEndTag, int *curLineNumPtr) override
virtual XMLUnknown * ToUnknown() override
Safely cast to an Unknown, or null.
Definition tinyxml2.h:1125
static const char * SkipWhiteSpace(const char *p, int *curLineNumPtr)
Definition tinyxml2.h:564
static bool IsPrefixHex(const char *p)
Definition tinyxml2.h:604
static char * SkipWhiteSpace(char *const p, int *curLineNumPtr)
Definition tinyxml2.h:576
static void ToStr(bool v, char *buffer, int bufferSize)
static bool ToInt64(const char *str, int64_t *value)
static void ToStr(float v, char *buffer, int bufferSize)
static bool ToBool(const char *str, bool *value)
static void ToStr(uint64_t v, char *buffer, int bufferSize)
static void ToStr(int64_t v, char *buffer, int bufferSize)
static bool IsUTF8Continuation(const char p)
Definition tinyxml2.h:619
static bool ToUnsigned64(const char *str, uint64_t *value)
static void ConvertUTF32ToUTF8(unsigned long input, char *output, int *length)
static bool StringEqual(const char *p, const char *q, int nChar=INT_MAX)
Definition tinyxml2.h:609
static void SetBoolSerialization(const char *writeTrue, const char *writeFalse)
static void ToStr(double v, char *buffer, int bufferSize)
static void ToStr(int v, char *buffer, int bufferSize)
static bool IsNameChar(unsigned char ch)
Definition tinyxml2.h:597
static bool ToUnsigned(const char *str, unsigned *value)
static const char * ReadBOM(const char *p, bool *hasBOM)
static bool ToDouble(const char *str, double *value)
static bool IsNameStartChar(unsigned char ch)
Definition tinyxml2.h:586
static const char * GetCharacterRef(const char *p, char *value, int *length)
static bool ToFloat(const char *str, float *value)
static bool IsWhiteSpace(char p)
Definition tinyxml2.h:582
static bool ToInt(const char *str, int *value)
static void ToStr(unsigned v, char *buffer, int bufferSize)
virtual bool Visit(const XMLDeclaration &)
Visit a declaration.
Definition tinyxml2.h:516
virtual bool VisitEnter(const XMLDocument &)
Visit a document.
Definition tinyxml2.h:498
virtual bool VisitEnter(const XMLElement &, const XMLAttribute *)
Visit an element.
Definition tinyxml2.h:507
virtual bool Visit(const XMLComment &)
Visit a comment node.
Definition tinyxml2.h:524
virtual bool VisitExit(const XMLDocument &)
Visit a document.
Definition tinyxml2.h:502
virtual bool Visit(const XMLText &)
Visit a text node.
Definition tinyxml2.h:520
virtual bool VisitExit(const XMLElement &)
Visit an element.
Definition tinyxml2.h:511
virtual bool Visit(const XMLUnknown &)
Visit an unknown node.
Definition tinyxml2.h:528
static const char * ALLOCATION_TAG
Definition tinyxml2.h:139
static const int TINYXML2_MAX_ELEMENT_DEPTH
Definition tinyxml2.h:126
std::enable_if<!std::is_polymorphic< T >::value >::type Delete(T *pointerToT)
Definition AWSMemory.h:100