ReactOS 0.4.16-dev-319-g6cf4263
tinyxml2.h
Go to the documentation of this file.
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
24#ifndef TINYXML2_INCLUDED
25#define TINYXML2_INCLUDED
26
27#if defined(ANDROID_NDK) || defined(__BORLANDC__) || defined(__QNXNTO__)
28# include <ctype.h>
29# include <limits.h>
30# include <stdio.h>
31# include <stdlib.h>
32# include <string.h>
33#else
34# include <cctype>
35# include <climits>
36# include <cstdio>
37# include <cstdlib>
38# include <cstring>
39#endif
40
41/*
42 TODO: intern strings instead of allocation.
43*/
44/*
45 gcc:
46 g++ -Wall -DDEBUG tinyxml2.cpp xmltest.cpp -o gccxmltest.exe
47
48 Formatting, Artistic Style:
49 AStyle.exe --style=1tbs --indent-switches --break-closing-brackets --indent-preprocessor tinyxml2.cpp tinyxml2.h
50*/
51
52#if defined( _DEBUG ) || defined( DEBUG ) || defined (__DEBUG__)
53# ifndef DEBUG
54# define DEBUG
55# endif
56#endif
57
58#ifdef _MSC_VER
59# pragma warning(push)
60# pragma warning(disable: 4251)
61#endif
62
63#ifdef _WIN32
64# ifdef TINYXML2_EXPORT
65# define TINYXML2_LIB __declspec(dllexport)
66# elif defined(TINYXML2_IMPORT)
67# define TINYXML2_LIB __declspec(dllimport)
68# else
69# define TINYXML2_LIB
70# endif
71#else
72# define TINYXML2_LIB
73#endif
74
75
76#if defined(DEBUG)
77# if defined(_MSC_VER)
78# // "(void)0," is for suppressing C4127 warning in "assert(false)", "assert(true)" and the like
79# define TIXMLASSERT( x ) if ( !((void)0,(x))) { __debugbreak(); }
80# elif defined (ANDROID_NDK)
81# include <android/log.h>
82# define TIXMLASSERT( x ) if ( !(x)) { __android_log_assert( "assert", "grinliz", "ASSERT in '%s' at %d.", __FILE__, __LINE__ ); }
83# else
84# include <assert.h>
85# define TIXMLASSERT assert
86# endif
87#else
88# define TIXMLASSERT( x ) {}
89#endif
90
91
92/* Versioning, past 1.0.14:
93 http://semver.org/
94*/
95static const int TIXML2_MAJOR_VERSION = 3;
96static const int TIXML2_MINOR_VERSION = 0;
97static const int TIXML2_PATCH_VERSION = 0;
98
99namespace tinyxml2
100{
101class XMLDocument;
102class XMLElement;
103class XMLAttribute;
104class XMLComment;
105class XMLText;
106class XMLDeclaration;
107class XMLUnknown;
108class XMLPrinter;
109
110/*
111 A class that wraps strings. Normally stores the start and end
112 pointers into the XML file itself, and will apply normalization
113 and entity translation if actually read. Can also store (and memory
114 manage) a traditional char[]
115*/
117{
118public:
119 enum {
123
130 };
131
132 StrPair() : _flags( 0 ), _start( 0 ), _end( 0 ) {}
133 ~StrPair();
134
135 void Set( char* start, char* end, int flags ) {
136 Reset();
137 _start = start;
138 _end = end;
140 }
141
142 const char* GetStr();
143
144 bool Empty() const {
145 return _start == _end;
146 }
147
148 void SetInternedStr( const char* str ) {
149 Reset();
150 _start = const_cast<char*>(str);
151 }
152
153 void SetStr( const char* str, int flags=0 );
154
155 char* ParseText( char* in, const char* endTag, int strFlags );
156 char* ParseName( char* in );
157
158 void TransferTo( StrPair* other );
159
160private:
161 void Reset();
162 void CollapseWhitespace();
163
164 enum {
165 NEEDS_FLUSH = 0x100,
166 NEEDS_DELETE = 0x200
167 };
168
170 char* _start;
171 char* _end;
172
173 StrPair( const StrPair& other ); // not supported
174 void operator=( StrPair& other ); // not supported, use TransferTo()
175};
176
177
178/*
179 A dynamic array of Plain Old Data. Doesn't support constructors, etc.
180 Has a small initial memory pool, so that low or no usage will not
181 cause a call to new/delete
182*/
183template <class T, int INITIAL_SIZE>
185{
186public:
188 _mem = _pool;
189 _allocated = INITIAL_SIZE;
190 _size = 0;
191 }
192
194 if ( _mem != _pool ) {
195 delete [] _mem;
196 }
197 }
198
199 void Clear() {
200 _size = 0;
201 }
202
203 void Push( T t ) {
206 _mem[_size++] = t;
207 }
208
209 T* PushArr( int count ) {
210 TIXMLASSERT( count >= 0 );
213 T* ret = &_mem[_size];
214 _size += count;
215 return ret;
216 }
217
218 T Pop() {
219 TIXMLASSERT( _size > 0 );
220 return _mem[--_size];
221 }
222
223 void PopArr( int count ) {
224 TIXMLASSERT( _size >= count );
225 _size -= count;
226 }
227
228 bool Empty() const {
229 return _size == 0;
230 }
231
232 T& operator[](int i) {
233 TIXMLASSERT( i>= 0 && i < _size );
234 return _mem[i];
235 }
236
237 const T& operator[](int i) const {
238 TIXMLASSERT( i>= 0 && i < _size );
239 return _mem[i];
240 }
241
242 const T& PeekTop() const {
243 TIXMLASSERT( _size > 0 );
244 return _mem[ _size - 1];
245 }
246
247 int Size() const {
248 TIXMLASSERT( _size >= 0 );
249 return _size;
250 }
251
252 int Capacity() const {
253 TIXMLASSERT( _allocated >= INITIAL_SIZE );
254 return _allocated;
255 }
256
257 const T* Mem() const {
258 TIXMLASSERT( _mem );
259 return _mem;
260 }
261
262 T* Mem() {
263 TIXMLASSERT( _mem );
264 return _mem;
265 }
266
267private:
268 DynArray( const DynArray& ); // not supported
269 void operator=( const DynArray& ); // not supported
270
271 void EnsureCapacity( int cap ) {
272 TIXMLASSERT( cap > 0 );
273 if ( cap > _allocated ) {
274 TIXMLASSERT( cap <= INT_MAX / 2 );
275 int newAllocated = cap * 2;
276 T* newMem = new T[newAllocated];
277 memcpy( newMem, _mem, sizeof(T)*_size ); // warning: not using constructors, only works for PODs
278 if ( _mem != _pool ) {
279 delete [] _mem;
280 }
281 _mem = newMem;
282 _allocated = newAllocated;
283 }
284 }
285
287 T _pool[INITIAL_SIZE];
288 int _allocated; // objects allocated
289 int _size; // number objects in use
290};
291
292
293/*
294 Parent virtual class of a pool for fast allocation
295 and deallocation of objects.
296*/
298{
299public:
301 virtual ~MemPool() {}
302
303 virtual int ItemSize() const = 0;
304 virtual void* Alloc() = 0;
305 virtual void Free( void* ) = 0;
306 virtual void SetTracked() = 0;
307 virtual void Clear() = 0;
308};
309
310
311/*
312 Template child class to create pools of the correct type.
313*/
314template< int SIZE >
315class MemPoolT : public MemPool
316{
317public:
320 Clear();
321 }
322
323 void Clear() {
324 // Delete the blocks.
325 while( !_blockPtrs.Empty()) {
326 Block* b = _blockPtrs.Pop();
327 delete b;
328 }
329 _root = 0;
330 _currentAllocs = 0;
331 _nAllocs = 0;
332 _maxAllocs = 0;
333 _nUntracked = 0;
334 }
335
336 virtual int ItemSize() const {
337 return SIZE;
338 }
339 int CurrentAllocs() const {
340 return _currentAllocs;
341 }
342
343 virtual void* Alloc() {
344 if ( !_root ) {
345 // Need a new block.
346 Block* block = new Block();
347 _blockPtrs.Push( block );
348
349 for( int i=0; i<COUNT-1; ++i ) {
350 block->chunk[i].next = &block->chunk[i+1];
351 }
352 block->chunk[COUNT-1].next = 0;
353 _root = block->chunk;
354 }
355 void* result = _root;
356 _root = _root->next;
357
359 if ( _currentAllocs > _maxAllocs ) {
361 }
362 _nAllocs++;
363 _nUntracked++;
364 return result;
365 }
366
367 virtual void Free( void* mem ) {
368 if ( !mem ) {
369 return;
370 }
372 Chunk* chunk = static_cast<Chunk*>( mem );
373#ifdef DEBUG
374 memset( chunk, 0xfe, sizeof(Chunk) );
375#endif
376 chunk->next = _root;
377 _root = chunk;
378 }
379 void Trace( const char* name ) {
380 printf( "Mempool %s watermark=%d [%dk] current=%d size=%d nAlloc=%d blocks=%d\n",
382 }
383
384 void SetTracked() {
385 _nUntracked--;
386 }
387
388 int Untracked() const {
389 return _nUntracked;
390 }
391
392 // This number is perf sensitive. 4k seems like a good tradeoff on my machine.
393 // The test file is large, 170k.
394 // Release: VS2010 gcc(no opt)
395 // 1k: 4000
396 // 2k: 4000
397 // 4k: 3900 21000
398 // 16k: 5200
399 // 32k: 4300
400 // 64k: 4000 21000
401 enum { COUNT = (4*1024)/SIZE }; // Some compilers do not accept to use COUNT in private part if COUNT is private
402
403private:
404 MemPoolT( const MemPoolT& ); // not supported
405 void operator=( const MemPoolT& ); // not supported
406
407 union Chunk {
409 char mem[SIZE];
410 };
411 struct Block {
413 };
416
421};
422
423
424
445{
446public:
447 virtual ~XMLVisitor() {}
448
450 virtual bool VisitEnter( const XMLDocument& /*doc*/ ) {
451 return true;
452 }
454 virtual bool VisitExit( const XMLDocument& /*doc*/ ) {
455 return true;
456 }
457
459 virtual bool VisitEnter( const XMLElement& /*element*/, const XMLAttribute* /*firstAttribute*/ ) {
460 return true;
461 }
463 virtual bool VisitExit( const XMLElement& /*element*/ ) {
464 return true;
465 }
466
468 virtual bool Visit( const XMLDeclaration& /*declaration*/ ) {
469 return true;
470 }
472 virtual bool Visit( const XMLText& /*text*/ ) {
473 return true;
474 }
476 virtual bool Visit( const XMLComment& /*comment*/ ) {
477 return true;
478 }
480 virtual bool Visit( const XMLUnknown& /*unknown*/ ) {
481 return true;
482 }
483};
484
485// WARNING: must match XMLDocument::_errorNames[]
508
511
512
513/*
514 Utility functionality.
515*/
517{
518public:
519 static const char* SkipWhiteSpace( const char* p ) {
520 TIXMLASSERT( p );
521 while( IsWhiteSpace(*p) ) {
522 ++p;
523 }
524 TIXMLASSERT( p );
525 return p;
526 }
527 static char* SkipWhiteSpace( char* p ) {
528 return const_cast<char*>( SkipWhiteSpace( const_cast<const char*>(p) ) );
529 }
530
531 // Anything in the high order range of UTF-8 is assumed to not be whitespace. This isn't
532 // correct, but simple, and usually works.
533 static bool IsWhiteSpace( char p ) {
534 return !IsUTF8Continuation(p) && isspace( static_cast<unsigned char>(p) );
535 }
536
537 inline static bool IsNameStartChar( unsigned char ch ) {
538 if ( ch >= 128 ) {
539 // This is a heuristic guess in attempt to not implement Unicode-aware isalpha()
540 return true;
541 }
542 if ( isalpha( ch ) ) {
543 return true;
544 }
545 return ch == ':' || ch == '_';
546 }
547
548 inline static bool IsNameChar( unsigned char ch ) {
549 return IsNameStartChar( ch )
550 || isdigit( ch )
551 || ch == '.'
552 || ch == '-';
553 }
554
555 inline static bool StringEqual( const char* p, const char* q, int nChar=INT_MAX ) {
556 if ( p == q ) {
557 return true;
558 }
559 return strncmp( p, q, nChar ) == 0;
560 }
561
562 inline static bool IsUTF8Continuation( char p ) {
563 return ( p & 0x80 ) != 0;
564 }
565
566 static const char* ReadBOM( const char* p, bool* hasBOM );
567 // p is the starting location,
568 // the UTF-8 value of the entity will be placed in value, and length filled in.
569 static const char* GetCharacterRef( const char* p, char* value, int* length );
570 static void ConvertUTF32ToUTF8( unsigned long input, char* output, int* length );
571
572 // converts primitive types to strings
573 static void ToStr( int v, char* buffer, int bufferSize );
574 static void ToStr( unsigned v, char* buffer, int bufferSize );
575 static void ToStr( bool v, char* buffer, int bufferSize );
576 static void ToStr( float v, char* buffer, int bufferSize );
577 static void ToStr( double v, char* buffer, int bufferSize );
578
579 // converts strings to primitive types
580 static bool ToInt( const char* str, int* value );
581 static bool ToUnsigned( const char* str, unsigned* value );
582 static bool ToBool( const char* str, bool* value );
583 static bool ToFloat( const char* str, float* value );
584 static bool ToDouble( const char* str, double* value );
585};
586
587
614{
615 friend class XMLDocument;
616 friend class XMLElement;
617public:
618
620 const XMLDocument* GetDocument() const {
621 TIXMLASSERT( _document );
622 return _document;
623 }
626 TIXMLASSERT( _document );
627 return _document;
628 }
629
632 return 0;
633 }
635 virtual XMLText* ToText() {
636 return 0;
637 }
640 return 0;
641 }
644 return 0;
645 }
648 return 0;
649 }
652 return 0;
653 }
654
655 virtual const XMLElement* ToElement() const {
656 return 0;
657 }
658 virtual const XMLText* ToText() const {
659 return 0;
660 }
661 virtual const XMLComment* ToComment() const {
662 return 0;
663 }
664 virtual const XMLDocument* ToDocument() const {
665 return 0;
666 }
667 virtual const XMLDeclaration* ToDeclaration() const {
668 return 0;
669 }
670 virtual const XMLUnknown* ToUnknown() const {
671 return 0;
672 }
673
683 const char* Value() const;
684
688 void SetValue( const char* val, bool staticMem=false );
689
691 const XMLNode* Parent() const {
692 return _parent;
693 }
694
696 return _parent;
697 }
698
700 bool NoChildren() const {
701 return !_firstChild;
702 }
703
705 const XMLNode* FirstChild() const {
706 return _firstChild;
707 }
708
710 return _firstChild;
711 }
712
716 const XMLElement* FirstChildElement( const char* name = 0 ) const;
717
718 XMLElement* FirstChildElement( const char* name = 0 ) {
719 return const_cast<XMLElement*>(const_cast<const XMLNode*>(this)->FirstChildElement( name ));
720 }
721
723 const XMLNode* LastChild() const {
724 return _lastChild;
725 }
726
728 return _lastChild;
729 }
730
734 const XMLElement* LastChildElement( const char* name = 0 ) const;
735
736 XMLElement* LastChildElement( const char* name = 0 ) {
737 return const_cast<XMLElement*>(const_cast<const XMLNode*>(this)->LastChildElement(name) );
738 }
739
741 const XMLNode* PreviousSibling() const {
742 return _prev;
743 }
744
746 return _prev;
747 }
748
750 const XMLElement* PreviousSiblingElement( const char* name = 0 ) const ;
751
753 return const_cast<XMLElement*>(const_cast<const XMLNode*>(this)->PreviousSiblingElement( name ) );
754 }
755
757 const XMLNode* NextSibling() const {
758 return _next;
759 }
760
762 return _next;
763 }
764
766 const XMLElement* NextSiblingElement( const char* name = 0 ) const;
767
768 XMLElement* NextSiblingElement( const char* name = 0 ) {
769 return const_cast<XMLElement*>(const_cast<const XMLNode*>(this)->NextSiblingElement( name ) );
770 }
771
779 XMLNode* InsertEndChild( XMLNode* addThis );
780
782 return InsertEndChild( addThis );
783 }
791 XMLNode* InsertFirstChild( XMLNode* addThis );
800 XMLNode* InsertAfterChild( XMLNode* afterThis, XMLNode* addThis );
801
805 void DeleteChildren();
806
810 void DeleteChild( XMLNode* node );
811
821 virtual XMLNode* ShallowClone( XMLDocument* document ) const = 0;
822
829 virtual bool ShallowEqual( const XMLNode* compare ) const = 0;
830
853 virtual bool Accept( XMLVisitor* visitor ) const = 0;
854
855protected:
857 virtual ~XMLNode();
858
859 virtual char* ParseDeep( char*, StrPair* );
860
864
867
870
871private:
873 void Unlink( XMLNode* child );
874 static void DeleteNode( XMLNode* node );
875 void InsertChildPreamble( XMLNode* insertThis ) const;
876
877 XMLNode( const XMLNode& ); // not supported
878 XMLNode& operator=( const XMLNode& ); // not supported
879};
880
881
895{
896 friend class XMLBase;
897 friend class XMLDocument;
898public:
899 virtual bool Accept( XMLVisitor* visitor ) const;
900
901 virtual XMLText* ToText() {
902 return this;
903 }
904 virtual const XMLText* ToText() const {
905 return this;
906 }
907
909 void SetCData( bool isCData ) {
910 _isCData = isCData;
911 }
913 bool CData() const {
914 return _isCData;
915 }
916
917 virtual XMLNode* ShallowClone( XMLDocument* document ) const;
918 virtual bool ShallowEqual( const XMLNode* compare ) const;
919
920protected:
921 XMLText( XMLDocument* doc ) : XMLNode( doc ), _isCData( false ) {}
922 virtual ~XMLText() {}
923
924 char* ParseDeep( char*, StrPair* endTag );
925
926private:
928
929 XMLText( const XMLText& ); // not supported
930 XMLText& operator=( const XMLText& ); // not supported
931};
932
933
936{
937 friend class XMLDocument;
938public:
940 return this;
941 }
942 virtual const XMLComment* ToComment() const {
943 return this;
944 }
945
946 virtual bool Accept( XMLVisitor* visitor ) const;
947
948 virtual XMLNode* ShallowClone( XMLDocument* document ) const;
949 virtual bool ShallowEqual( const XMLNode* compare ) const;
950
951protected:
952 XMLComment( XMLDocument* doc );
953 virtual ~XMLComment();
954
955 char* ParseDeep( char*, StrPair* endTag );
956
957private:
958 XMLComment( const XMLComment& ); // not supported
959 XMLComment& operator=( const XMLComment& ); // not supported
960};
961
962
975{
976 friend class XMLDocument;
977public:
979 return this;
980 }
981 virtual const XMLDeclaration* ToDeclaration() const {
982 return this;
983 }
984
985 virtual bool Accept( XMLVisitor* visitor ) const;
986
987 virtual XMLNode* ShallowClone( XMLDocument* document ) const;
988 virtual bool ShallowEqual( const XMLNode* compare ) const;
989
990protected:
992 virtual ~XMLDeclaration();
993
994 char* ParseDeep( char*, StrPair* endTag );
995
996private:
997 XMLDeclaration( const XMLDeclaration& ); // not supported
998 XMLDeclaration& operator=( const XMLDeclaration& ); // not supported
999};
1000
1001
1010{
1011 friend class XMLDocument;
1012public:
1014 return this;
1015 }
1016 virtual const XMLUnknown* ToUnknown() const {
1017 return this;
1018 }
1019
1020 virtual bool Accept( XMLVisitor* visitor ) const;
1021
1022 virtual XMLNode* ShallowClone( XMLDocument* document ) const;
1023 virtual bool ShallowEqual( const XMLNode* compare ) const;
1024
1025protected:
1026 XMLUnknown( XMLDocument* doc );
1027 virtual ~XMLUnknown();
1028
1029 char* ParseDeep( char*, StrPair* endTag );
1030
1031private:
1032 XMLUnknown( const XMLUnknown& ); // not supported
1033 XMLUnknown& operator=( const XMLUnknown& ); // not supported
1034};
1035
1036
1037
1045{
1046 friend class XMLElement;
1047public:
1049 const char* Name() const;
1050
1052 const char* Value() const;
1053
1055 const XMLAttribute* Next() const {
1056 return _next;
1057 }
1058
1063 int IntValue() const {
1064 int i=0;
1065 QueryIntValue( &i );
1066 return i;
1067 }
1069 unsigned UnsignedValue() const {
1070 unsigned i=0;
1071 QueryUnsignedValue( &i );
1072 return i;
1073 }
1075 bool BoolValue() const {
1076 bool b=false;
1077 QueryBoolValue( &b );
1078 return b;
1079 }
1081 double DoubleValue() const {
1082 double d=0;
1083 QueryDoubleValue( &d );
1084 return d;
1085 }
1087 float FloatValue() const {
1088 float f=0;
1089 QueryFloatValue( &f );
1090 return f;
1091 }
1092
1097 XMLError QueryIntValue( int* value ) const;
1099 XMLError QueryUnsignedValue( unsigned int* value ) const;
1101 XMLError QueryBoolValue( bool* value ) const;
1103 XMLError QueryDoubleValue( double* value ) const;
1105 XMLError QueryFloatValue( float* value ) const;
1106
1108 void SetAttribute( const char* value );
1110 void SetAttribute( int value );
1112 void SetAttribute( unsigned value );
1114 void SetAttribute( bool value );
1116 void SetAttribute( double value );
1118 void SetAttribute( float value );
1119
1120private:
1121 enum { BUF_SIZE = 200 };
1122
1123 XMLAttribute() : _next( 0 ), _memPool( 0 ) {}
1124 virtual ~XMLAttribute() {}
1125
1126 XMLAttribute( const XMLAttribute& ); // not supported
1127 void operator=( const XMLAttribute& ); // not supported
1128 void SetName( const char* name );
1129
1130 char* ParseDeep( char* p, bool processEntities );
1131
1136};
1137
1138
1144{
1145 friend class XMLBase;
1146 friend class XMLDocument;
1147public:
1149 const char* Name() const {
1150 return Value();
1151 }
1153 void SetName( const char* str, bool staticMem=false ) {
1154 SetValue( str, staticMem );
1155 }
1156
1158 return this;
1159 }
1160 virtual const XMLElement* ToElement() const {
1161 return this;
1162 }
1163 virtual bool Accept( XMLVisitor* visitor ) const;
1164
1188 const char* Attribute( const char* name, const char* value=0 ) const;
1189
1195 int IntAttribute( const char* name ) const {
1196 int i=0;
1197 QueryIntAttribute( name, &i );
1198 return i;
1199 }
1201 unsigned UnsignedAttribute( const char* name ) const {
1202 unsigned i=0;
1203 QueryUnsignedAttribute( name, &i );
1204 return i;
1205 }
1207 bool BoolAttribute( const char* name ) const {
1208 bool b=false;
1209 QueryBoolAttribute( name, &b );
1210 return b;
1211 }
1213 double DoubleAttribute( const char* name ) const {
1214 double d=0;
1215 QueryDoubleAttribute( name, &d );
1216 return d;
1217 }
1219 float FloatAttribute( const char* name ) const {
1220 float f=0;
1221 QueryFloatAttribute( name, &f );
1222 return f;
1223 }
1224
1238 XMLError QueryIntAttribute( const char* name, int* value ) const {
1239 const XMLAttribute* a = FindAttribute( name );
1240 if ( !a ) {
1241 return XML_NO_ATTRIBUTE;
1242 }
1243 return a->QueryIntValue( value );
1244 }
1246 XMLError QueryUnsignedAttribute( const char* name, unsigned int* value ) const {
1247 const XMLAttribute* a = FindAttribute( name );
1248 if ( !a ) {
1249 return XML_NO_ATTRIBUTE;
1250 }
1251 return a->QueryUnsignedValue( value );
1252 }
1254 XMLError QueryBoolAttribute( const char* name, bool* value ) const {
1255 const XMLAttribute* a = FindAttribute( name );
1256 if ( !a ) {
1257 return XML_NO_ATTRIBUTE;
1258 }
1259 return a->QueryBoolValue( value );
1260 }
1262 XMLError QueryDoubleAttribute( const char* name, double* value ) const {
1263 const XMLAttribute* a = FindAttribute( name );
1264 if ( !a ) {
1265 return XML_NO_ATTRIBUTE;
1266 }
1267 return a->QueryDoubleValue( value );
1268 }
1270 XMLError QueryFloatAttribute( const char* name, float* value ) const {
1271 const XMLAttribute* a = FindAttribute( name );
1272 if ( !a ) {
1273 return XML_NO_ATTRIBUTE;
1274 }
1275 return a->QueryFloatValue( value );
1276 }
1277
1278
1296 int QueryAttribute( const char* name, int* value ) const {
1297 return QueryIntAttribute( name, value );
1298 }
1299
1300 int QueryAttribute( const char* name, unsigned int* value ) const {
1301 return QueryUnsignedAttribute( name, value );
1302 }
1303
1304 int QueryAttribute( const char* name, bool* value ) const {
1305 return QueryBoolAttribute( name, value );
1306 }
1307
1308 int QueryAttribute( const char* name, double* value ) const {
1309 return QueryDoubleAttribute( name, value );
1310 }
1311
1312 int QueryAttribute( const char* name, float* value ) const {
1313 return QueryFloatAttribute( name, value );
1314 }
1315
1317 void SetAttribute( const char* name, const char* value ) {
1318 XMLAttribute* a = FindOrCreateAttribute( name );
1319 a->SetAttribute( value );
1320 }
1322 void SetAttribute( const char* name, int value ) {
1323 XMLAttribute* a = FindOrCreateAttribute( name );
1324 a->SetAttribute( value );
1325 }
1327 void SetAttribute( const char* name, unsigned value ) {
1328 XMLAttribute* a = FindOrCreateAttribute( name );
1329 a->SetAttribute( value );
1330 }
1332 void SetAttribute( const char* name, bool value ) {
1333 XMLAttribute* a = FindOrCreateAttribute( name );
1334 a->SetAttribute( value );
1335 }
1337 void SetAttribute( const char* name, double value ) {
1338 XMLAttribute* a = FindOrCreateAttribute( name );
1339 a->SetAttribute( value );
1340 }
1342 void SetAttribute( const char* name, float value ) {
1343 XMLAttribute* a = FindOrCreateAttribute( name );
1344 a->SetAttribute( value );
1345 }
1346
1350 void DeleteAttribute( const char* name );
1351
1354 return _rootAttribute;
1355 }
1357 const XMLAttribute* FindAttribute( const char* name ) const;
1358
1387 const char* GetText() const;
1388
1423 void SetText( const char* inText );
1425 void SetText( int value );
1427 void SetText( unsigned value );
1429 void SetText( bool value );
1431 void SetText( double value );
1433 void SetText( float value );
1434
1461 XMLError QueryIntText( int* ival ) const;
1463 XMLError QueryUnsignedText( unsigned* uval ) const;
1465 XMLError QueryBoolText( bool* bval ) const;
1467 XMLError QueryDoubleText( double* dval ) const;
1469 XMLError QueryFloatText( float* fval ) const;
1470
1471 // internal:
1472 enum {
1473 OPEN, // <foo>
1474 CLOSED, // <foo/>
1475 CLOSING // </foo>
1477 int ClosingType() const {
1478 return _closingType;
1479 }
1480 virtual XMLNode* ShallowClone( XMLDocument* document ) const;
1481 virtual bool ShallowEqual( const XMLNode* compare ) const;
1482
1483protected:
1484 char* ParseDeep( char* p, StrPair* endTag );
1485
1486private:
1487 XMLElement( XMLDocument* doc );
1488 virtual ~XMLElement();
1489 XMLElement( const XMLElement& ); // not supported
1490 void operator=( const XMLElement& ); // not supported
1491
1493 return const_cast<XMLAttribute*>(const_cast<const XMLElement*>(this)->FindAttribute( name ));
1494 }
1495 XMLAttribute* FindOrCreateAttribute( const char* name );
1496 //void LinkAttribute( XMLAttribute* attrib );
1497 char* ParseAttributes( char* p );
1498 static void DeleteAttribute( XMLAttribute* attribute );
1499
1500 enum { BUF_SIZE = 200 };
1502 // The attribute list is ordered; there is no 'lastAttribute'
1503 // because the list needs to be scanned for dupes before adding
1504 // a new attribute.
1506};
1507
1508
1513
1514
1521{
1522 friend class XMLElement;
1523public:
1525 XMLDocument( bool processEntities = true, Whitespace = PRESERVE_WHITESPACE );
1526 ~XMLDocument();
1527
1529 TIXMLASSERT( this == _document );
1530 return this;
1531 }
1532 virtual const XMLDocument* ToDocument() const {
1533 TIXMLASSERT( this == _document );
1534 return this;
1535 }
1536
1547 XMLError Parse( const char* xml, size_t nBytes=(size_t)(-1) );
1548
1554 XMLError LoadFile( const char* filename );
1555
1568
1574 XMLError SaveFile( const char* filename, bool compact = false );
1575
1583 XMLError SaveFile( FILE* fp, bool compact = false );
1584
1585 bool ProcessEntities() const {
1586 return _processEntities;
1587 }
1589 return _whitespace;
1590 }
1591
1595 bool HasBOM() const {
1596 return _writeBOM;
1597 }
1600 void SetBOM( bool useBOM ) {
1601 _writeBOM = useBOM;
1602 }
1603
1608 return FirstChildElement();
1609 }
1610 const XMLElement* RootElement() const {
1611 return FirstChildElement();
1612 }
1613
1628 void Print( XMLPrinter* streamer=0 ) const;
1629 virtual bool Accept( XMLVisitor* visitor ) const;
1630
1636 XMLElement* NewElement( const char* name );
1642 XMLComment* NewComment( const char* comment );
1648 XMLText* NewText( const char* text );
1660 XMLDeclaration* NewDeclaration( const char* text=0 );
1666 XMLUnknown* NewUnknown( const char* text );
1667
1672 void DeleteNode( XMLNode* node );
1673
1674 void SetError( XMLError error, const char* str1, const char* str2 );
1675
1677 bool Error() const {
1678 return _errorID != XML_NO_ERROR;
1679 }
1682 return _errorID;
1683 }
1684 const char* ErrorName() const;
1685
1687 const char* GetErrorStr1() const {
1688 return _errorStr1;
1689 }
1691 const char* GetErrorStr2() const {
1692 return _errorStr2;
1693 }
1695 void PrintError() const;
1696
1698 void Clear();
1699
1700 // internal
1701 char* Identify( char* p, XMLNode** node );
1702
1703 virtual XMLNode* ShallowClone( XMLDocument* /*document*/ ) const {
1704 return 0;
1705 }
1706 virtual bool ShallowEqual( const XMLNode* /*compare*/ ) const {
1707 return false;
1708 }
1709
1710private:
1711 XMLDocument( const XMLDocument& ); // not supported
1712 void operator=( const XMLDocument& ); // not supported
1713
1718 const char* _errorStr1;
1719 const char* _errorStr2;
1721
1722 MemPoolT< sizeof(XMLElement) > _elementPool;
1723 MemPoolT< sizeof(XMLAttribute) > _attributePool;
1724 MemPoolT< sizeof(XMLText) > _textPool;
1725 MemPoolT< sizeof(XMLComment) > _commentPool;
1726
1727 static const char* _errorNames[XML_ERROR_COUNT];
1728
1729 void Parse();
1730};
1731
1732
1789{
1790public:
1793 _node = node;
1794 }
1797 _node = &node;
1798 }
1801 _node = ref._node;
1802 }
1805 _node = ref._node;
1806 return *this;
1807 }
1808
1811 return XMLHandle( _node ? _node->FirstChild() : 0 );
1812 }
1814 XMLHandle FirstChildElement( const char* name = 0 ) {
1815 return XMLHandle( _node ? _node->FirstChildElement( name ) : 0 );
1816 }
1819 return XMLHandle( _node ? _node->LastChild() : 0 );
1820 }
1822 XMLHandle LastChildElement( const char* name = 0 ) {
1823 return XMLHandle( _node ? _node->LastChildElement( name ) : 0 );
1824 }
1827 return XMLHandle( _node ? _node->PreviousSibling() : 0 );
1828 }
1831 return XMLHandle( _node ? _node->PreviousSiblingElement( name ) : 0 );
1832 }
1835 return XMLHandle( _node ? _node->NextSibling() : 0 );
1836 }
1838 XMLHandle NextSiblingElement( const char* name = 0 ) {
1839 return XMLHandle( _node ? _node->NextSiblingElement( name ) : 0 );
1840 }
1841
1844 return _node;
1845 }
1848 return ( ( _node == 0 ) ? 0 : _node->ToElement() );
1849 }
1852 return ( ( _node == 0 ) ? 0 : _node->ToText() );
1853 }
1856 return ( ( _node == 0 ) ? 0 : _node->ToUnknown() );
1857 }
1860 return ( ( _node == 0 ) ? 0 : _node->ToDeclaration() );
1861 }
1862
1863private:
1865};
1866
1867
1873{
1874public:
1876 _node = node;
1877 }
1879 _node = &node;
1880 }
1882 _node = ref._node;
1883 }
1884
1886 _node = ref._node;
1887 return *this;
1888 }
1889
1891 return XMLConstHandle( _node ? _node->FirstChild() : 0 );
1892 }
1893 const XMLConstHandle FirstChildElement( const char* name = 0 ) const {
1894 return XMLConstHandle( _node ? _node->FirstChildElement( name ) : 0 );
1895 }
1897 return XMLConstHandle( _node ? _node->LastChild() : 0 );
1898 }
1899 const XMLConstHandle LastChildElement( const char* name = 0 ) const {
1900 return XMLConstHandle( _node ? _node->LastChildElement( name ) : 0 );
1901 }
1903 return XMLConstHandle( _node ? _node->PreviousSibling() : 0 );
1904 }
1905 const XMLConstHandle PreviousSiblingElement( const char* name = 0 ) const {
1906 return XMLConstHandle( _node ? _node->PreviousSiblingElement( name ) : 0 );
1907 }
1909 return XMLConstHandle( _node ? _node->NextSibling() : 0 );
1910 }
1911 const XMLConstHandle NextSiblingElement( const char* name = 0 ) const {
1912 return XMLConstHandle( _node ? _node->NextSiblingElement( name ) : 0 );
1913 }
1914
1915
1916 const XMLNode* ToNode() const {
1917 return _node;
1918 }
1919 const XMLElement* ToElement() const {
1920 return ( ( _node == 0 ) ? 0 : _node->ToElement() );
1921 }
1922 const XMLText* ToText() const {
1923 return ( ( _node == 0 ) ? 0 : _node->ToText() );
1924 }
1925 const XMLUnknown* ToUnknown() const {
1926 return ( ( _node == 0 ) ? 0 : _node->ToUnknown() );
1927 }
1929 return ( ( _node == 0 ) ? 0 : _node->ToDeclaration() );
1930 }
1931
1932private:
1934};
1935
1936
1980{
1981public:
1988 XMLPrinter( FILE* file=0, bool compact = false, int depth = 0 );
1989 virtual ~XMLPrinter() {}
1990
1992 void PushHeader( bool writeBOM, bool writeDeclaration );
1996 void OpenElement( const char* name, bool compactMode=false );
1998 void PushAttribute( const char* name, const char* value );
1999 void PushAttribute( const char* name, int value );
2000 void PushAttribute( const char* name, unsigned value );
2001 void PushAttribute( const char* name, bool value );
2002 void PushAttribute( const char* name, double value );
2004 virtual void CloseElement( bool compactMode=false );
2005
2007 void PushText( const char* text, bool cdata=false );
2009 void PushText( int value );
2011 void PushText( unsigned value );
2013 void PushText( bool value );
2015 void PushText( float value );
2017 void PushText( double value );
2018
2020 void PushComment( const char* comment );
2021
2022 void PushDeclaration( const char* value );
2023 void PushUnknown( const char* value );
2024
2025 virtual bool VisitEnter( const XMLDocument& /*doc*/ );
2026 virtual bool VisitExit( const XMLDocument& /*doc*/ ) {
2027 return true;
2028 }
2029
2030 virtual bool VisitEnter( const XMLElement& element, const XMLAttribute* attribute );
2031 virtual bool VisitExit( const XMLElement& element );
2032
2033 virtual bool Visit( const XMLText& text );
2034 virtual bool Visit( const XMLComment& comment );
2035 virtual bool Visit( const XMLDeclaration& declaration );
2036 virtual bool Visit( const XMLUnknown& unknown );
2037
2042 const char* CStr() const {
2043 return _buffer.Mem();
2044 }
2050 int CStrSize() const {
2051 return _buffer.Size();
2052 }
2058 _buffer.Clear();
2059 _buffer.Push(0);
2060 }
2061
2062protected:
2063 virtual bool CompactMode( const XMLElement& ) { return _compactMode; }
2064
2068 virtual void PrintSpace( int depth );
2069 void Print( const char* format, ... );
2070
2071 void SealElementIfJustOpened();
2074
2075private:
2076 void PrintString( const char*, bool restrictedEntitySet ); // prints out, after detecting entities.
2077
2084
2085 enum {
2086 ENTITY_RANGE = 64,
2087 BUF_SIZE = 200
2089 bool _entityFlag[ENTITY_RANGE];
2090 bool _restrictedEntityFlag[ENTITY_RANGE];
2091
2093};
2094
2095
2096} // tinyxml2
2097
2098#if defined(_MSC_VER)
2099# pragma warning(pop)
2100#endif
2101
2102#endif // TINYXML2_INCLUDED
#define isspace(c)
Definition: acclib.h:69
#define isalpha(c)
Definition: acclib.h:74
#define isdigit(c)
Definition: acclib.h:68
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
Definition: utclib.c:534
struct NameRec_ * Name
Definition: cdprocs.h:460
static __inline VOID DeleteNode(NODE *node)
Definition: text.h:48
static VOID PrintError(DWORD dwError)
Definition: cacls.c:37
bool Empty() const
Definition: tinyxml2.h:228
T _pool[INITIAL_SIZE]
Definition: tinyxml2.h:287
void EnsureCapacity(int cap)
Definition: tinyxml2.h:271
const T & PeekTop() const
Definition: tinyxml2.h:242
void operator=(const DynArray &)
T & operator[](int i)
Definition: tinyxml2.h:232
int Size() const
Definition: tinyxml2.h:247
const T & operator[](int i) const
Definition: tinyxml2.h:237
const T * Mem() const
Definition: tinyxml2.h:257
int Capacity() const
Definition: tinyxml2.h:252
DynArray(const DynArray &)
void PopArr(int count)
Definition: tinyxml2.h:223
T * PushArr(int count)
Definition: tinyxml2.h:209
void Push(T t)
Definition: tinyxml2.h:203
void Trace(const char *name)
Definition: tinyxml2.h:379
virtual int ItemSize() const
Definition: tinyxml2.h:336
int Untracked() const
Definition: tinyxml2.h:388
virtual void Free(void *mem)
Definition: tinyxml2.h:367
void operator=(const MemPoolT &)
int CurrentAllocs() const
Definition: tinyxml2.h:339
virtual void * Alloc()
Definition: tinyxml2.h:343
MemPoolT(const MemPoolT &)
DynArray< Block *, 10 > _blockPtrs
Definition: tinyxml2.h:414
virtual int ItemSize() const =0
virtual void * Alloc()=0
virtual void Free(void *)=0
virtual void Clear()=0
virtual void SetTracked()=0
virtual ~MemPool()
Definition: tinyxml2.h:301
void operator=(StrPair &other)
void SetStr(const char *str, int flags=0)
Definition: tinyxml2.cpp:178
void SetInternedStr(const char *str)
Definition: tinyxml2.h:148
@ NEEDS_WHITESPACE_COLLAPSING
Definition: tinyxml2.h:122
@ ATTRIBUTE_VALUE_LEAVE_ENTITIES
Definition: tinyxml2.h:128
@ NEEDS_NEWLINE_NORMALIZATION
Definition: tinyxml2.h:121
@ TEXT_ELEMENT_LEAVE_ENTITIES
Definition: tinyxml2.h:125
void TransferTo(StrPair *other)
Definition: tinyxml2.cpp:144
void Set(char *start, char *end, int flags)
Definition: tinyxml2.h:135
char * ParseName(char *in)
Definition: tinyxml2.cpp:211
StrPair(const StrPair &other)
bool Empty() const
Definition: tinyxml2.h:144
const char * GetStr()
Definition: tinyxml2.cpp:260
char * ParseText(char *in, const char *endTag, int strFlags)
Definition: tinyxml2.cpp:191
void CollapseWhitespace()
Definition: tinyxml2.cpp:231
virtual ~XMLAttribute()
Definition: tinyxml2.h:1124
unsigned UnsignedValue() const
Query as an unsigned integer. See IntValue()
Definition: tinyxml2.h:1069
float FloatValue() const
Query as a float. See IntValue()
Definition: tinyxml2.h:1087
void operator=(const XMLAttribute &)
XMLAttribute * _next
Definition: tinyxml2.h:1134
XMLAttribute(const XMLAttribute &)
double DoubleValue() const
Query as a double. See IntValue()
Definition: tinyxml2.h:1081
bool BoolValue() const
Query as a boolean. See IntValue()
Definition: tinyxml2.h:1075
const XMLAttribute * Next() const
The next attribute in the list.
Definition: tinyxml2.h:1055
int IntValue() const
Definition: tinyxml2.h:1063
virtual XMLComment * ToComment()
Safely cast to a Comment, or null.
Definition: tinyxml2.h:939
XMLComment & operator=(const XMLComment &)
XMLComment(const XMLComment &)
virtual const XMLComment * ToComment() const
Definition: tinyxml2.h:942
XMLConstHandle(const XMLNode *node)
Definition: tinyxml2.h:1875
const XMLText * ToText() const
Definition: tinyxml2.h:1922
XMLConstHandle & operator=(const XMLConstHandle &ref)
Definition: tinyxml2.h:1885
const XMLConstHandle NextSiblingElement(const char *name=0) const
Definition: tinyxml2.h:1911
const XMLElement * ToElement() const
Definition: tinyxml2.h:1919
XMLConstHandle(const XMLConstHandle &ref)
Definition: tinyxml2.h:1881
const XMLUnknown * ToUnknown() const
Definition: tinyxml2.h:1925
const XMLDeclaration * ToDeclaration() const
Definition: tinyxml2.h:1928
XMLConstHandle(const XMLNode &node)
Definition: tinyxml2.h:1878
const XMLConstHandle LastChild() const
Definition: tinyxml2.h:1896
const XMLConstHandle LastChildElement(const char *name=0) const
Definition: tinyxml2.h:1899
const XMLConstHandle FirstChildElement(const char *name=0) const
Definition: tinyxml2.h:1893
const XMLNode * ToNode() const
Definition: tinyxml2.h:1916
const XMLConstHandle PreviousSibling() const
Definition: tinyxml2.h:1902
const XMLNode * _node
Definition: tinyxml2.h:1933
const XMLConstHandle NextSibling() const
Definition: tinyxml2.h:1908
const XMLConstHandle FirstChild() const
Definition: tinyxml2.h:1890
const XMLConstHandle PreviousSiblingElement(const char *name=0) const
Definition: tinyxml2.h:1905
XMLDeclaration & operator=(const XMLDeclaration &)
XMLDeclaration(const XMLDeclaration &)
virtual const XMLDeclaration * ToDeclaration() const
Definition: tinyxml2.h:981
virtual XMLDeclaration * ToDeclaration()
Safely cast to a Declaration, or null.
Definition: tinyxml2.h:978
XMLElement * RootElement()
Definition: tinyxml2.h:1607
void SetBOM(bool useBOM)
Definition: tinyxml2.h:1600
bool HasBOM() const
Definition: tinyxml2.h:1595
bool Error() const
Return true if there was an error parsing the document.
Definition: tinyxml2.h:1677
const char * _errorStr1
Definition: tinyxml2.h:1718
const XMLElement * RootElement() const
Definition: tinyxml2.h:1610
Whitespace _whitespace
Definition: tinyxml2.h:1717
bool ProcessEntities() const
Definition: tinyxml2.h:1585
const char * _errorStr2
Definition: tinyxml2.h:1719
virtual bool ShallowEqual(const XMLNode *) const
Definition: tinyxml2.h:1706
Whitespace WhitespaceMode() const
Definition: tinyxml2.h:1588
virtual XMLDocument * ToDocument()
Safely cast to a Document, or null.
Definition: tinyxml2.h:1528
const char * GetErrorStr1() const
Return a possibly helpful diagnostic location or string.
Definition: tinyxml2.h:1687
void operator=(const XMLDocument &)
virtual const XMLDocument * ToDocument() const
Definition: tinyxml2.h:1532
const char * GetErrorStr2() const
Return a possibly helpful secondary diagnostic location or string.
Definition: tinyxml2.h:1691
XMLDocument(const XMLDocument &)
virtual XMLNode * ShallowClone(XMLDocument *) const
Definition: tinyxml2.h:1703
XMLError ErrorID() const
Return the errorID.
Definition: tinyxml2.h:1681
int QueryAttribute(const char *name, int *value) const
Definition: tinyxml2.h:1296
bool BoolAttribute(const char *name) const
See IntAttribute()
Definition: tinyxml2.h:1207
void SetAttribute(const char *name, const char *value)
Sets the named attribute to value.
Definition: tinyxml2.h:1317
XMLError QueryBoolAttribute(const char *name, bool *value) const
See QueryIntAttribute()
Definition: tinyxml2.h:1254
int QueryAttribute(const char *name, unsigned int *value) const
Definition: tinyxml2.h:1300
XMLElement(const XMLElement &)
void SetAttribute(const char *name, double value)
Sets the named attribute to value.
Definition: tinyxml2.h:1337
XMLError QueryUnsignedAttribute(const char *name, unsigned int *value) const
See QueryIntAttribute()
Definition: tinyxml2.h:1246
unsigned UnsignedAttribute(const char *name) const
See IntAttribute()
Definition: tinyxml2.h:1201
int QueryAttribute(const char *name, float *value) const
Definition: tinyxml2.h:1312
const XMLAttribute * FirstAttribute() const
Return the first attribute in the list.
Definition: tinyxml2.h:1353
void SetAttribute(const char *name, float value)
Sets the named attribute to value.
Definition: tinyxml2.h:1342
XMLError QueryDoubleAttribute(const char *name, double *value) const
See QueryIntAttribute()
Definition: tinyxml2.h:1262
float FloatAttribute(const char *name) const
See IntAttribute()
Definition: tinyxml2.h:1219
XMLAttribute * FindAttribute(const char *name)
Definition: tinyxml2.h:1492
int QueryAttribute(const char *name, double *value) const
Definition: tinyxml2.h:1308
double DoubleAttribute(const char *name) const
See IntAttribute()
Definition: tinyxml2.h:1213
XMLError QueryIntAttribute(const char *name, int *value) const
Definition: tinyxml2.h:1238
void SetName(const char *str, bool staticMem=false)
Set the name of the element.
Definition: tinyxml2.h:1153
virtual const XMLElement * ToElement() const
Definition: tinyxml2.h:1160
int QueryAttribute(const char *name, bool *value) const
Definition: tinyxml2.h:1304
void SetAttribute(const char *name, bool value)
Sets the named attribute to value.
Definition: tinyxml2.h:1332
void SetAttribute(const char *name, int value)
Sets the named attribute to value.
Definition: tinyxml2.h:1322
virtual XMLElement * ToElement()
Safely cast to an Element, or null.
Definition: tinyxml2.h:1157
const char * Name() const
Get the name of an element (which is the Value() of the node.)
Definition: tinyxml2.h:1149
int ClosingType() const
Definition: tinyxml2.h:1477
XMLError QueryFloatAttribute(const char *name, float *value) const
See QueryIntAttribute()
Definition: tinyxml2.h:1270
int IntAttribute(const char *name) const
Definition: tinyxml2.h:1195
XMLAttribute * _rootAttribute
Definition: tinyxml2.h:1505
void SetAttribute(const char *name, unsigned value)
Sets the named attribute to value.
Definition: tinyxml2.h:1327
void operator=(const XMLElement &)
XMLHandle PreviousSibling()
Get the previous sibling of this handle.
Definition: tinyxml2.h:1826
XMLHandle LastChildElement(const char *name=0)
Get the last child element of this handle.
Definition: tinyxml2.h:1822
XMLHandle FirstChild()
Get the first child of this handle.
Definition: tinyxml2.h:1810
XMLNode * ToNode()
Safe cast to XMLNode. This can return null.
Definition: tinyxml2.h:1843
XMLHandle FirstChildElement(const char *name=0)
Get the first child element of this handle.
Definition: tinyxml2.h:1814
XMLHandle PreviousSiblingElement(const char *name=0)
Get the previous sibling element of this handle.
Definition: tinyxml2.h:1830
XMLDeclaration * ToDeclaration()
Safe cast to XMLDeclaration. This can return null.
Definition: tinyxml2.h:1859
XMLHandle(XMLNode *node)
Create a handle from any node (at any depth of the tree.) This can be a null pointer.
Definition: tinyxml2.h:1792
XMLHandle LastChild()
Get the last child of this handle.
Definition: tinyxml2.h:1818
XMLHandle & operator=(const XMLHandle &ref)
Assignment.
Definition: tinyxml2.h:1804
XMLHandle(XMLNode &node)
Create a handle from a node.
Definition: tinyxml2.h:1796
XMLHandle NextSibling()
Get the next sibling of this handle.
Definition: tinyxml2.h:1834
XMLElement * ToElement()
Safe cast to XMLElement. This can return null.
Definition: tinyxml2.h:1847
XMLText * ToText()
Safe cast to XMLText. This can return null.
Definition: tinyxml2.h:1851
XMLUnknown * ToUnknown()
Safe cast to XMLUnknown. This can return null.
Definition: tinyxml2.h:1855
XMLHandle NextSiblingElement(const char *name=0)
Get the next sibling element of this handle.
Definition: tinyxml2.h:1838
XMLHandle(const XMLHandle &ref)
Copy constructor.
Definition: tinyxml2.h:1800
virtual const XMLText * ToText() const
Definition: tinyxml2.h:658
XMLNode * NextSibling()
Definition: tinyxml2.h:761
XMLNode * _lastChild
Definition: tinyxml2.h:866
virtual XMLText * ToText()
Safely cast to Text, or null.
Definition: tinyxml2.h:635
virtual XMLDeclaration * ToDeclaration()
Safely cast to a Declaration, or null.
Definition: tinyxml2.h:647
XMLNode * _parent
Definition: tinyxml2.h:862
XMLNode * _next
Definition: tinyxml2.h:869
XMLNode * FirstChild()
Definition: tinyxml2.h:709
StrPair _value
Definition: tinyxml2.h:863
XMLElement * FirstChildElement(const char *name=0)
Definition: tinyxml2.h:718
XMLDocument * GetDocument()
Get the XMLDocument that owns this XMLNode.
Definition: tinyxml2.h:625
XMLElement * LastChildElement(const char *name=0)
Definition: tinyxml2.h:736
const XMLNode * Parent() const
Get the parent of this node on the DOM.
Definition: tinyxml2.h:691
MemPool * _memPool
Definition: tinyxml2.h:872
XMLNode * LastChild()
Definition: tinyxml2.h:727
XMLNode & operator=(const XMLNode &)
XMLNode * PreviousSibling()
Definition: tinyxml2.h:745
virtual XMLComment * ToComment()
Safely cast to a Comment, or null.
Definition: tinyxml2.h:639
virtual XMLDocument * ToDocument()
Safely cast to a Document, or null.
Definition: tinyxml2.h:643
const XMLNode * LastChild() const
Get the last child node, or null if none exists.
Definition: tinyxml2.h:723
const XMLDocument * GetDocument() const
Get the XMLDocument that owns this XMLNode.
Definition: tinyxml2.h:620
virtual const XMLElement * ToElement() const
Definition: tinyxml2.h:655
XMLNode(const XMLNode &)
virtual bool ShallowEqual(const XMLNode *compare) const =0
virtual bool Accept(XMLVisitor *visitor) const =0
XMLElement * NextSiblingElement(const char *name=0)
Definition: tinyxml2.h:768
XMLDocument * _document
Definition: tinyxml2.h:861
virtual XMLNode * ShallowClone(XMLDocument *document) const =0
const XMLNode * PreviousSibling() const
Get the previous (left) sibling node of this node.
Definition: tinyxml2.h:741
virtual const XMLDeclaration * ToDeclaration() const
Definition: tinyxml2.h:667
virtual XMLElement * ToElement()
Safely cast to an Element, or null.
Definition: tinyxml2.h:631
XMLNode * _prev
Definition: tinyxml2.h:868
XMLNode * _firstChild
Definition: tinyxml2.h:865
virtual XMLUnknown * ToUnknown()
Safely cast to an Unknown, or null.
Definition: tinyxml2.h:651
virtual const XMLUnknown * ToUnknown() const
Definition: tinyxml2.h:670
const XMLNode * FirstChild() const
Get the first child node, or null if none exists.
Definition: tinyxml2.h:705
XMLElement * PreviousSiblingElement(const char *name=0)
Definition: tinyxml2.h:752
bool NoChildren() const
Returns true if this node has no children.
Definition: tinyxml2.h:700
virtual const XMLDocument * ToDocument() const
Definition: tinyxml2.h:664
XMLNode * Parent()
Definition: tinyxml2.h:695
XMLNode * LinkEndChild(XMLNode *addThis)
Definition: tinyxml2.h:781
virtual const XMLComment * ToComment() const
Definition: tinyxml2.h:661
const XMLNode * NextSibling() const
Get the next (right) sibling node of this node.
Definition: tinyxml2.h:757
virtual bool VisitExit(const XMLDocument &)
Visit a document.
Definition: tinyxml2.h:2026
DynArray< char, 20 > _buffer
Definition: tinyxml2.h:2092
int CStrSize() const
Definition: tinyxml2.h:2050
virtual bool CompactMode(const XMLElement &)
Definition: tinyxml2.h:2063
DynArray< const char *, 10 > _stack
Definition: tinyxml2.h:2073
const char * CStr() const
Definition: tinyxml2.h:2042
virtual ~XMLPrinter()
Definition: tinyxml2.h:1989
XMLText(const XMLText &)
virtual const XMLText * ToText() const
Definition: tinyxml2.h:904
virtual XMLText * ToText()
Safely cast to Text, or null.
Definition: tinyxml2.h:901
XMLText & operator=(const XMLText &)
bool CData() const
Returns true if this is a CDATA text element.
Definition: tinyxml2.h:913
void SetCData(bool isCData)
Declare whether this should be CDATA or standard text.
Definition: tinyxml2.h:909
XMLText(XMLDocument *doc)
Definition: tinyxml2.h:921
virtual ~XMLText()
Definition: tinyxml2.h:922
virtual XMLUnknown * ToUnknown()
Safely cast to an Unknown, or null.
Definition: tinyxml2.h:1013
XMLUnknown(const XMLUnknown &)
virtual const XMLUnknown * ToUnknown() const
Definition: tinyxml2.h:1016
XMLUnknown & operator=(const XMLUnknown &)
static bool IsNameChar(unsigned char ch)
Definition: tinyxml2.h:548
static const char * SkipWhiteSpace(const char *p)
Definition: tinyxml2.h:519
static bool ToUnsigned(const char *str, unsigned *value)
Definition: tinyxml2.cpp:567
static void ConvertUTF32ToUTF8(unsigned long input, char *output, int *length)
Definition: tinyxml2.cpp:381
static bool IsWhiteSpace(char p)
Definition: tinyxml2.h:533
static bool ToFloat(const char *str, float *value)
Definition: tinyxml2.cpp:594
static void ToStr(int v, char *buffer, int bufferSize)
Definition: tinyxml2.cpp:526
static const char * GetCharacterRef(const char *p, char *value, int *length)
Definition: tinyxml2.cpp:430
static char * SkipWhiteSpace(char *p)
Definition: tinyxml2.h:527
static bool IsNameStartChar(unsigned char ch)
Definition: tinyxml2.h:537
static bool StringEqual(const char *p, const char *q, int nChar=INT_MAX)
Definition: tinyxml2.h:555
static bool ToInt(const char *str, int *value)
Definition: tinyxml2.cpp:559
static bool IsUTF8Continuation(char p)
Definition: tinyxml2.h:562
static bool ToDouble(const char *str, double *value)
Definition: tinyxml2.cpp:602
static bool ToBool(const char *str, bool *value)
Definition: tinyxml2.cpp:575
static const char * ReadBOM(const char *p, bool *hasBOM)
Definition: tinyxml2.cpp:363
virtual bool Visit(const XMLUnknown &)
Visit an unknown node.
Definition: tinyxml2.h:480
virtual bool VisitExit(const XMLDocument &)
Visit a document.
Definition: tinyxml2.h:454
virtual ~XMLVisitor()
Definition: tinyxml2.h:447
virtual bool VisitExit(const XMLElement &)
Visit an element.
Definition: tinyxml2.h:463
virtual bool VisitEnter(const XMLDocument &)
Visit a document.
Definition: tinyxml2.h:450
virtual bool Visit(const XMLComment &)
Visit a comment node.
Definition: tinyxml2.h:476
virtual bool Visit(const XMLDeclaration &)
Visit a declaration.
Definition: tinyxml2.h:468
virtual bool Visit(const XMLText &)
Visit a text node.
Definition: tinyxml2.h:472
virtual bool VisitEnter(const XMLElement &, const XMLAttribute *)
Visit an element.
Definition: tinyxml2.h:459
#define BUF_SIZE
Definition: conport.c:56
#define SIZE
Definition: consume.c:5
float bval
Definition: cylfrac.c:48
static WCHAR unknown[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1605
const WCHAR * text
Definition: package.c:1794
char * NewText
Definition: edittest.c:57
#define printf
Definition: freeldr.h:97
size_t bufferSize
GLuint start
Definition: gl.h:1545
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546
const GLdouble * v
Definition: gl.h:2040
GLuint GLuint end
Definition: gl.h:1545
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLdouble GLdouble t
Definition: gl.h:2047
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063
GLuint buffer
Definition: glext.h:5915
GLfloat f
Definition: glext.h:7540
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLuint in
Definition: glext.h:9616
GLbitfield flags
Definition: glext.h:7161
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
GLuint GLfloat * val
Definition: glext.h:7180
GLfloat GLfloat p
Definition: glext.h:8902
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
GLenum GLenum GLenum input
Definition: glext.h:9031
GLuint64EXT * result
Definition: glext.h:11304
GLenum cap
Definition: glext.h:9639
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
void * LoadFile(const char *pszFileName, size_t *pFileSize)
Definition: hpp.c:74
#define INT_MAX
Definition: intsafe.h:150
const char * filename
Definition: ioapi.h:137
#define d
Definition: ke_i.h:81
#define f
Definition: ke_i.h:83
#define b
Definition: ke_i.h:79
#define T
Definition: mbstring.h:31
NTSTATUS FindAttribute(PDEVICE_EXTENSION Vcb, PFILE_RECORD_HEADER MftRecord, ULONG Type, PCWSTR Name, ULONG NameLength, PNTFS_ATTR_CONTEXT *AttrCtx, PULONG Offset)
Definition: mft.c:131
#define error(str)
Definition: mkdosfs.c:1605
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define comment(fmt, arg1)
Definition: rebar.c:847
static void Clear(void)
Definition: treeview.c:388
@ SetValue
Definition: shader.c:1968
static HWND child
Definition: cursoricon.c:298
int other
Definition: msacm.c:1376
@ XML_ERROR_MISMATCHED_ELEMENT
Definition: tinyxml2.h:504
@ XML_ERROR_EMPTY_DOCUMENT
Definition: tinyxml2.h:503
@ XML_SUCCESS
Definition: tinyxml2.h:487
@ XML_ERROR_ELEMENT_MISMATCH
Definition: tinyxml2.h:494
@ XML_ERROR_PARSING_ATTRIBUTE
Definition: tinyxml2.h:496
@ XML_ERROR_FILE_NOT_FOUND
Definition: tinyxml2.h:491
@ XML_ERROR_IDENTIFYING_TAG
Definition: tinyxml2.h:497
@ XML_ERROR_PARSING_TEXT
Definition: tinyxml2.h:498
@ XML_ERROR_PARSING_COMMENT
Definition: tinyxml2.h:500
@ XML_NO_TEXT_NODE
Definition: tinyxml2.h:507
@ XML_ERROR_FILE_READ_ERROR
Definition: tinyxml2.h:493
@ XML_ERROR_PARSING_UNKNOWN
Definition: tinyxml2.h:502
@ XML_ERROR_PARSING_CDATA
Definition: tinyxml2.h:499
@ XML_ERROR_COUNT
Definition: tinyxml2.h:509
@ XML_NO_ATTRIBUTE
Definition: tinyxml2.h:489
@ XML_NO_ERROR
Definition: tinyxml2.h:488
@ XML_ERROR_PARSING_DECLARATION
Definition: tinyxml2.h:501
@ XML_WRONG_ATTRIBUTE_TYPE
Definition: tinyxml2.h:490
@ XML_ERROR_PARSING
Definition: tinyxml2.h:505
@ XML_ERROR_PARSING_ELEMENT
Definition: tinyxml2.h:495
@ XML_ERROR_FILE_COULD_NOT_BE_OPENED
Definition: tinyxml2.h:492
@ XML_CAN_NOT_CONVERT_TEXT
Definition: tinyxml2.h:506
@ PRESERVE_WHITESPACE
Definition: tinyxml2.h:1510
@ COLLAPSE_WHITESPACE
Definition: tinyxml2.h:1511
const WCHAR * str
#define memset(x, y, z)
Definition: compat.h:39
double dval
Definition: format.c:274
#define false
Definition: stdbool.h:37
Definition: bug.cpp:8
Definition: fci.c:127
Definition: format.c:58
Definition: mem.c:349
Definition: name.c:39
Definition: send.c:48
VOID PrintString(LPCWSTR String, UINT MaxWidth, BOOL bAlignLeft)
Definition: tasklist.c:39
VOID PrintSpace(UINT Length)
Definition: tasklist.c:31
#define TIXMLASSERT(x)
Definition: tinyxml2.h:88
static const int TIXML2_PATCH_VERSION
Definition: tinyxml2.h:97
static const int TIXML2_MAJOR_VERSION
Definition: tinyxml2.h:95
#define TINYXML2_LIB
Definition: tinyxml2.h:72
static const int TIXML2_MINOR_VERSION
Definition: tinyxml2.h:96
Definition: dlist.c:348
Definition: pdh_main.c:94
static int Unlink(const char **args)
Definition: vfdcmd.c:2549
int ret
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413
static unsigned int block
Definition: xmlmemory.c:101