ReactOS  0.4.11-dev-201-g2a6aa77
tinyxml2.h
Go to the documentation of this file.
1 /*
2 Original code by Lee Thomason (www.grinninglizard.com)
3 
4 This software is provided 'as-is', without any express or implied
5 warranty. In no event will the authors be held liable for any
6 damages arising from the use of this software.
7 
8 Permission is granted to anyone to use this software for any
9 purpose, including commercial applications, and to alter it and
10 redistribute it freely, subject to the following restrictions:
11 
12 1. The origin of this software must not be misrepresented; you must
13 not claim that you wrote the original software. If you use this
14 software in a product, an acknowledgment in the product documentation
15 would be appreciated but is not required.
16 
17 2. Altered source versions must be plainly marked as such, and
18 must not be misrepresented as being the original software.
19 
20 3. This notice may not be removed or altered from any source
21 distribution.
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 */
95 static const int TIXML2_MAJOR_VERSION = 3;
96 static const int TIXML2_MINOR_VERSION = 0;
97 static const int TIXML2_PATCH_VERSION = 0;
98 
99 namespace tinyxml2
100 {
101 class XMLDocument;
102 class XMLElement;
103 class XMLAttribute;
104 class XMLComment;
105 class XMLText;
106 class XMLDeclaration;
107 class XMLUnknown;
108 class 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 */
116 class StrPair
117 {
118 public:
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;
139  _flags = flags | NEEDS_FLUSH;
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 
160 private:
161  void Reset();
162  void CollapseWhitespace();
163 
164  enum {
165  NEEDS_FLUSH = 0x100,
166  NEEDS_DELETE = 0x200
167  };
168 
169  int _flags;
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 */
183 template <class T, int INITIAL_SIZE>
184 class DynArray
185 {
186 public:
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 ) {
205  EnsureCapacity( _size+1 );
206  _mem[_size++] = t;
207  }
208 
209  T* PushArr( int count ) {
210  TIXMLASSERT( count >= 0 );
211  TIXMLASSERT( _size <= INT_MAX - count );
212  EnsureCapacity( _size+count );
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 
267 private:
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 
286  T* _mem;
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 */
297 class MemPool
298 {
299 public:
300  MemPool() {}
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 */
314 template< int SIZE >
315 class MemPoolT : public MemPool
316 {
317 public:
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 
358  ++_currentAllocs;
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  }
371  --_currentAllocs;
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 
403 private:
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  };
415  Chunk* _root;
416 
418  int _nAllocs;
421 };
422 
423 
424 
445 {
446 public:
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[]
486 enum XMLError {
508 
510 };
511 
512 
513 /*
514  Utility functionality.
515 */
516 class XMLUtil
517 {
518 public:
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;
617 public:
618 
620  const XMLDocument* GetDocument() const {
621  TIXMLASSERT( _document );
622  return _document;
623  }
626  TIXMLASSERT( _document );
627  return _document;
628  }
629 
631  virtual XMLElement* ToElement() {
632  return 0;
633  }
635  virtual XMLText* ToText() {
636  return 0;
637  }
639  virtual XMLComment* ToComment() {
640  return 0;
641  }
643  virtual XMLDocument* ToDocument() {
644  return 0;
645  }
648  return 0;
649  }
651  virtual XMLUnknown* ToUnknown() {
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 
752  XMLElement* PreviousSiblingElement( const char* name = 0 ) {
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 
781  XMLNode* LinkEndChild( XMLNode* addThis ) {
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 
855 protected:
856  XMLNode( XMLDocument* );
857  virtual ~XMLNode();
858 
859  virtual char* ParseDeep( char*, StrPair* );
860 
863  mutable StrPair _value;
864 
867 
870 
871 private:
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;
898 public:
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 
920 protected:
921  XMLText( XMLDocument* doc ) : XMLNode( doc ), _isCData( false ) {}
922  virtual ~XMLText() {}
923 
924  char* ParseDeep( char*, StrPair* endTag );
925 
926 private:
927  bool _isCData;
928 
929  XMLText( const XMLText& ); // not supported
930  XMLText& operator=( const XMLText& ); // not supported
931 };
932 
933 
936 {
937  friend class XMLDocument;
938 public:
939  virtual XMLComment* ToComment() {
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 
951 protected:
952  XMLComment( XMLDocument* doc );
953  virtual ~XMLComment();
954 
955  char* ParseDeep( char*, StrPair* endTag );
956 
957 private:
958  XMLComment( const XMLComment& ); // not supported
959  XMLComment& operator=( const XMLComment& ); // not supported
960 };
961 
962 
975 {
976  friend class XMLDocument;
977 public:
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 
990 protected:
991  XMLDeclaration( XMLDocument* doc );
992  virtual ~XMLDeclaration();
993 
994  char* ParseDeep( char*, StrPair* endTag );
995 
996 private:
997  XMLDeclaration( const XMLDeclaration& ); // not supported
998  XMLDeclaration& operator=( const XMLDeclaration& ); // not supported
999 };
1000 
1001 
1010 {
1011  friend class XMLDocument;
1012 public:
1013  virtual XMLUnknown* ToUnknown() {
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 
1025 protected:
1026  XMLUnknown( XMLDocument* doc );
1027  virtual ~XMLUnknown();
1028 
1029  char* ParseDeep( char*, StrPair* endTag );
1030 
1031 private:
1032  XMLUnknown( const XMLUnknown& ); // not supported
1033  XMLUnknown& operator=( const XMLUnknown& ); // not supported
1034 };
1035 
1036 
1037 
1045 {
1046  friend class XMLElement;
1047 public:
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 
1120 private:
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 
1132  mutable StrPair _name;
1133  mutable StrPair _value;
1136 };
1137 
1138 
1144 {
1145  friend class XMLBase;
1146  friend class XMLDocument;
1147 public:
1149  const char* Name() const {
1150  return Value();
1151  }
1153  void SetName( const char* str, bool staticMem=false ) {
1154  SetValue( str, staticMem );
1155  }
1156 
1157  virtual XMLElement* ToElement() {
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 
1353  const XMLAttribute* FirstAttribute() const {
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>
1476  };
1477  int ClosingType() const {
1478  return _closingType;
1479  }
1480  virtual XMLNode* ShallowClone( XMLDocument* document ) const;
1481  virtual bool ShallowEqual( const XMLNode* compare ) const;
1482 
1483 protected:
1484  char* ParseDeep( char* p, StrPair* endTag );
1485 
1486 private:
1487  XMLElement( XMLDocument* doc );
1488  virtual ~XMLElement();
1489  XMLElement( const XMLElement& ); // not supported
1490  void operator=( const XMLElement& ); // not supported
1491 
1492  XMLAttribute* FindAttribute( const char* name ) {
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 
1512 };
1513 
1514 
1521 {
1522  friend class XMLElement;
1523 public:
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 
1567  XMLError LoadFile( FILE* );
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  }
1681  XMLError ErrorID() const {
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 
1710 private:
1711  XMLDocument( const XMLDocument& ); // not supported
1712  void operator=( const XMLDocument& ); // not supported
1713 
1718  const char* _errorStr1;
1719  const char* _errorStr2;
1721 
1726 
1727  static const char* _errorNames[XML_ERROR_COUNT];
1728 
1729  void Parse();
1730 };
1731 
1732 
1789 {
1790 public:
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 
1863 private:
1865 };
1866 
1867 
1873 {
1874 public:
1876  _node = node;
1877  }
1879  _node = &node;
1880  }
1882  _node = ref._node;
1883  }
1884 
1886  _node = ref._node;
1887  return *this;
1888  }
1889 
1890  const XMLConstHandle FirstChild() const {
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  }
1896  const XMLConstHandle LastChild() const {
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  }
1908  const XMLConstHandle NextSibling() const {
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 
1932 private:
1933  const XMLNode* _node;
1934 };
1935 
1936 
1980 {
1981 public:
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  }
2057  void ClearBuffer() {
2058  _buffer.Clear();
2059  _buffer.Push(0);
2060  }
2061 
2062 protected:
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 
2075 private:
2076  void PrintString( const char*, bool restrictedEntitySet ); // prints out, after detecting entities.
2077 
2080  int _depth;
2084 
2085  enum {
2086  ENTITY_RANGE = 64,
2087  BUF_SIZE = 200
2088  };
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
virtual XMLElement * ToElement()
Safely cast to an Element, or null.
Definition: tinyxml2.h:1157
static unsigned int block
Definition: xmlmemory.c:118
double DoubleAttribute(const char *name) const
See IntAttribute()
Definition: tinyxml2.h:1213
Whitespace _whitespace
Definition: tinyxml2.h:1717
int QueryAttribute(const char *name, int *value) const
Definition: tinyxml2.h:1296
int QueryAttribute(const char *name, bool *value) const
Definition: tinyxml2.h:1304
const XMLDeclaration * ToDeclaration() const
Definition: tinyxml2.h:1928
Definition: bug.cpp:7
void CollapseWhitespace()
Definition: tinyxml2.cpp:231
const char * _errorStr1
Definition: tinyxml2.h:1718
bool BoolValue() const
Query as a boolean. See IntValue()
Definition: tinyxml2.h:1075
Definition: graphics.c:170
#define isspace(c)
Definition: acclib.h:69
bool Error() const
Return true if there was an error parsing the document.
Definition: tinyxml2.h:1677
virtual ~XMLText()
Definition: tinyxml2.h:922
const XMLConstHandle FirstChild() const
Definition: tinyxml2.h:1890
UINTN Attribute
Definition: acefiex.h:227
Definition: get.c:139
void Push(T t)
Definition: tinyxml2.h:203
static UCHAR ULONG UCHAR ULONG UCHAR * output
Definition: bcrypt.c:29
const XMLConstHandle LastChild() const
Definition: tinyxml2.h:1896
XMLError QueryIntValue(int *value) const
Definition: tinyxml2.cpp:1286
const XMLText * ToText() const
Definition: tinyxml2.h:1922
virtual void Free(void *mem)
Definition: tinyxml2.h:367
static const int TIXML2_PATCH_VERSION
Definition: tinyxml2.h:97
XMLError QueryUnsignedAttribute(const char *name, unsigned int *value) const
See QueryIntAttribute()
Definition: tinyxml2.h:1246
virtual const XMLDeclaration * ToDeclaration() const
Definition: tinyxml2.h:667
#define INT_MAX
Definition: limits.h:40
virtual XMLDocument * ToDocument()
Safely cast to a Document, or null.
Definition: tinyxml2.h:643
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
T _pool[INITIAL_SIZE]
Definition: tinyxml2.h:287
virtual const XMLComment * ToComment() const
Definition: tinyxml2.h:661
virtual void * Alloc()
Definition: tinyxml2.h:343
const XMLNode * _node
Definition: tinyxml2.h:1933
virtual ~MemPool()
Definition: tinyxml2.h:301
XMLElement * PreviousSiblingElement(const char *name=0)
Definition: tinyxml2.h:752
T * PushArr(int count)
Definition: tinyxml2.h:209
XMLError QueryFloatValue(float *value) const
See QueryIntValue.
Definition: tinyxml2.cpp:1313
const T & operator[](int i) const
Definition: tinyxml2.h:237
const WCHAR * text
Definition: package.c:1827
XMLElement * LastChildElement(const char *name=0)
Definition: tinyxml2.h:736
XMLAttribute * _rootAttribute
Definition: tinyxml2.h:1505
MemPoolT< sizeof(XMLAttribute) > _attributePool
Definition: tinyxml2.h:1723
int other
Definition: msacm.c:1364
static const char * SkipWhiteSpace(const char *p)
Definition: tinyxml2.h:519
int CurrentAllocs() const
Definition: tinyxml2.h:339
void SetAttribute(const char *name, unsigned value)
Sets the named attribute to value.
Definition: tinyxml2.h:1327
virtual ~XMLAttribute()
Definition: tinyxml2.h:1124
virtual XMLComment * ToComment()
Safely cast to a Comment, or null.
Definition: tinyxml2.h:639
struct Parse Parse
Definition: dwarfinfo.c:330
XMLNode * FirstChild()
Definition: tinyxml2.h:709
XMLConstHandle & operator=(const XMLConstHandle &ref)
Definition: tinyxml2.h:1885
const T * Mem() const
Definition: tinyxml2.h:257
GLdouble GLdouble t
Definition: gl.h:2047
static VOID PrintError(DWORD dwError)
Definition: cacls.c:37
virtual const XMLText * ToText() const
Definition: tinyxml2.h:658
virtual bool VisitEnter(const XMLElement &, const XMLAttribute *)
Visit an element.
Definition: tinyxml2.h:459
XMLNode * _lastChild
Definition: tinyxml2.h:866
virtual ~XMLVisitor()
Definition: tinyxml2.h:447
bool CData() const
Returns true if this is a CDATA text element.
Definition: tinyxml2.h:913
void Set(char *start, char *end, int flags)
Definition: tinyxml2.h:135
DynArray< Block *, 10 > _blockPtrs
Definition: tinyxml2.h:414
virtual void Free(void *)=0
GLuint buffer
Definition: glext.h:5915
#define isalpha(c)
Definition: acclib.h:74
int ClosingType() const
Definition: tinyxml2.h:1477
static bool IsNameChar(unsigned char ch)
Definition: tinyxml2.h:548
static bool IsWhiteSpace(char p)
Definition: tinyxml2.h:533
GLuint GLuint end
Definition: gl.h:1545
void TransferTo(StrPair *other)
Definition: tinyxml2.cpp:144
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
static int Unlink(const char **args)
Definition: vfdcmd.c:2549
XMLNode * _next
Definition: tinyxml2.h:869
const XMLElement * RootElement() const
Definition: tinyxml2.h:1610
virtual XMLUnknown * ToUnknown()
Safely cast to an Unknown, or null.
Definition: tinyxml2.h:1013
virtual bool Visit(const XMLText &)
Visit a text node.
Definition: tinyxml2.h:472
const char * filename
Definition: ioapi.h:135
const XMLNode * FirstChild() const
Get the first child node, or null if none exists.
Definition: tinyxml2.h:705
XMLNode * _firstChild
Definition: tinyxml2.h:865
virtual bool ShallowEqual(const XMLNode *) const
Definition: tinyxml2.h:1706
Definition: send.c:47
static HWND child
Definition: cursoricon.c:298
#define T
Definition: mbstring.h:31
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
static char * SkipWhiteSpace(char *p)
Definition: tinyxml2.h:527
#define BUF_SIZE
Definition: conport.c:56
double DoubleValue() const
Query as a double. See IntValue()
Definition: tinyxml2.h:1081
XMLConstHandle(const XMLNode *node)
Definition: tinyxml2.h:1875
XMLNode * PreviousSibling()
Definition: tinyxml2.h:745
void Print(USHORT Window, LPSTR p)
Definition: hardware.c:797
virtual bool VisitExit(const XMLDocument &)
Visit a document.
Definition: tinyxml2.h:454
char * ParseName(char *in)
Definition: tinyxml2.cpp:211
const T & PeekTop() const
Definition: tinyxml2.h:242
XMLConstHandle(const XMLNode &node)
Definition: tinyxml2.h:1878
int QueryAttribute(const char *name, double *value) const
Definition: tinyxml2.h:1308
void SetAttribute(const char *value)
Set the attribute to a string value.
Definition: tinyxml2.cpp:1331
virtual const XMLText * ToText() const
Definition: tinyxml2.h:904
struct node node
XMLError QueryFloatAttribute(const char *name, float *value) const
See QueryIntAttribute()
Definition: tinyxml2.h:1270
virtual const XMLUnknown * ToUnknown() const
Definition: tinyxml2.h:670
GLenum GLclampf GLint i
Definition: glfuncs.h:14
XMLNode * _parent
Definition: tinyxml2.h:862
const XMLNode * ToNode() const
Definition: tinyxml2.h:1916
const XMLConstHandle PreviousSibling() const
Definition: tinyxml2.h:1902
virtual XMLText * ToText()
Safely cast to Text, or null.
Definition: tinyxml2.h:901
MemPool * _memPool
Definition: tinyxml2.h:872
virtual bool Visit(const XMLComment &)
Visit a comment node.
Definition: tinyxml2.h:476
int IntAttribute(const char *name) const
Definition: tinyxml2.h:1195
XMLHandle LastChild()
Get the last child of this handle.
Definition: tinyxml2.h:1818
XMLNode * Parent()
Definition: tinyxml2.h:695
virtual XMLNode * ShallowClone(XMLDocument *) const
Definition: tinyxml2.h:1703
BOOL LoadFile(LPTSTR FileName)
Definition: stats.c:172
int Capacity() const
Definition: tinyxml2.h:252
void SetAttribute(const char *name, const char *value)
Sets the named attribute to value.
Definition: tinyxml2.h:1317
const char * GetErrorStr2() const
Return a possibly helpful secondary diagnostic location or string.
Definition: tinyxml2.h:1691
XMLHandle FirstChildElement(const char *name=0)
Get the first child element of this handle.
Definition: tinyxml2.h:1814
void operator=(const DynArray &)
static const int TIXML2_MINOR_VERSION
Definition: tinyxml2.h:96
const XMLUnknown * ToUnknown() const
Definition: tinyxml2.h:1925
XMLHandle & operator=(const XMLHandle &ref)
Assignment.
Definition: tinyxml2.h:1804
bool Empty() const
Definition: tinyxml2.h:228
const WCHAR * str
const XMLConstHandle NextSibling() const
Definition: tinyxml2.h:1908
void SetBOM(bool useBOM)
Definition: tinyxml2.h:1600
XMLError QueryDoubleValue(double *value) const
See QueryIntValue.
Definition: tinyxml2.cpp:1322
bool ProcessEntities() const
Definition: tinyxml2.h:1585
DynArray< char, 20 > _buffer
Definition: tinyxml2.h:2092
XMLError ErrorID() const
Return the errorID.
Definition: tinyxml2.h:1681
XMLElement * RootElement()
Definition: tinyxml2.h:1607
BOOL DeleteNode(HWND hwndTV, HTREEITEM hItem)
Definition: treeview.c:102
XMLHandle NextSiblingElement(const char *name=0)
Get the next sibling element of this handle.
Definition: tinyxml2.h:1838
static bool IsUTF8Continuation(char p)
Definition: tinyxml2.h:562
#define isdigit(c)
Definition: acclib.h:68
const XMLNode * Parent() const
Get the parent of this node on the DOM.
Definition: tinyxml2.h:691
#define b
Definition: ke_i.h:79
virtual ~XMLPrinter()
Definition: tinyxml2.h:1989
XMLAttribute * _next
Definition: tinyxml2.h:1134
const XMLAttribute * Next() const
The next attribute in the list.
Definition: tinyxml2.h:1055
GLuint GLfloat * val
Definition: glext.h:7180
XMLError QueryDoubleAttribute(const char *name, double *value) const
See QueryIntAttribute()
Definition: tinyxml2.h:1262
void SetName(const char *str, bool staticMem=false)
Set the name of the element.
Definition: tinyxml2.h:1153
virtual int ItemSize() const
Definition: tinyxml2.h:336
void SetAttribute(const char *name, double value)
Sets the named attribute to value.
Definition: tinyxml2.h:1337
int IntValue() const
Definition: tinyxml2.h:1063
GLfloat f
Definition: glext.h:7540
int QueryAttribute(const char *name, float *value) const
Definition: tinyxml2.h:1312
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
void operator=(const MemPoolT &)
const XMLConstHandle PreviousSiblingElement(const char *name=0) const
Definition: tinyxml2.h:1905
static const int TIXML2_MAJOR_VERSION
Definition: tinyxml2.h:95
double dval
Definition: format.c:274
StrPair _value
Definition: tinyxml2.h:863
virtual void SetTracked()=0
#define d
Definition: ke_i.h:81
MemPoolT< sizeof(XMLComment) > _commentPool
Definition: tinyxml2.h:1725
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
virtual void * Alloc()=0
#define TINYXML2_LIB
Definition: tinyxml2.h:72
bool BoolAttribute(const char *name) const
See IntAttribute()
Definition: tinyxml2.h:1207
XMLHandle LastChildElement(const char *name=0)
Get the last child element of this handle.
Definition: tinyxml2.h:1822
void EnsureCapacity(int cap)
Definition: tinyxml2.h:271
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
Definition: utclib.c:534
const char * GetStr()
Definition: tinyxml2.cpp:260
virtual bool VisitExit(const XMLDocument &)
Visit a document.
Definition: tinyxml2.h:2026
void SetStr(const char *str, int flags=0)
Definition: tinyxml2.cpp:178
GLuint GLuint GLsizei count
Definition: gl.h:1545
int Size() const
Definition: tinyxml2.h:247
XMLHandle(XMLNode &node)
Create a handle from a node.
Definition: tinyxml2.h:1796
void SetCData(bool isCData)
Declare whether this should be CDATA or standard text.
Definition: tinyxml2.h:909
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063
XMLDocument * GetDocument()
Get the XMLDocument that owns this XMLNode.
Definition: tinyxml2.h:625
#define false
Definition: stdbool.h:38
Definition: id3.c:18
GLbitfield flags
Definition: glext.h:7161
const XMLDocument * GetDocument() const
Get the XMLDocument that owns this XMLNode.
Definition: tinyxml2.h:620
_In_ PUNICODE_STRING Name
Definition: mrx.h:218
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546
int ret
virtual XMLDeclaration * ToDeclaration()
Safely cast to a Declaration, or null.
Definition: tinyxml2.h:978
virtual XMLUnknown * ToUnknown()
Safely cast to an Unknown, or null.
Definition: tinyxml2.h:651
static bool StringEqual(const char *p, const char *q, int nChar=INT_MAX)
Definition: tinyxml2.h:555
int Untracked() const
Definition: tinyxml2.h:388
const char * _errorStr2
Definition: tinyxml2.h:1719
unsigned UnsignedAttribute(const char *name) const
See IntAttribute()
Definition: tinyxml2.h:1201
virtual bool VisitExit(const XMLElement &)
Visit an element.
Definition: tinyxml2.h:463
Definition: id3.c:18
static VOID PrintString(char *fmt,...)
Definition: usetup.c:112
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
virtual const XMLElement * ToElement() const
Definition: tinyxml2.h:1160
virtual bool Visit(const XMLUnknown &)
Visit an unknown node.
Definition: tinyxml2.h:480
XMLConstHandle(const XMLConstHandle &ref)
Definition: tinyxml2.h:1881
XMLElement * NextSiblingElement(const char *name=0)
Definition: tinyxml2.h:768
const XMLNode * PreviousSibling() const
Get the previous (left) sibling node of this node.
Definition: tinyxml2.h:741
UINTN UINT8 Value
Definition: acefiex.h:751
char * NewText
Definition: edittest.c:57
GLfloat CONST GLvector4f * in
Definition: m_xform.h:122
virtual const XMLDeclaration * ToDeclaration() const
Definition: tinyxml2.h:981
XMLNode * LinkEndChild(XMLNode *addThis)
Definition: tinyxml2.h:781
XMLAttribute * FindAttribute(const char *name)
Definition: tinyxml2.h:1492
XMLElement * FirstChildElement(const char *name=0)
Definition: tinyxml2.h:718
void SetAttribute(const char *name, bool value)
Sets the named attribute to value.
Definition: tinyxml2.h:1332
void SetAttribute(const char *name, float value)
Sets the named attribute to value.
Definition: tinyxml2.h:1342
const char * GetErrorStr1() const
Return a possibly helpful diagnostic location or string.
Definition: tinyxml2.h:1687
#define SIZE
Definition: t_vb_render.c:51
const XMLConstHandle FirstChildElement(const char *name=0) const
Definition: tinyxml2.h:1893
#define TIXMLASSERT(x)
Definition: tinyxml2.h:88
DynArray< const char *, 10 > _stack
Definition: tinyxml2.h:2073
XMLNode * NextSibling()
Definition: tinyxml2.h:761
XMLError QueryIntAttribute(const char *name, int *value) const
Definition: tinyxml2.h:1238
GLenum GLenum GLenum input
Definition: glext.h:9031
XMLNode * ToNode()
Safe cast to XMLNode. This can return null.
Definition: tinyxml2.h:1843
const GLdouble * v
Definition: gl.h:2040
void Trace(const char *name)
Definition: tinyxml2.h:379
XMLHandle NextSibling()
Get the next sibling of this handle.
Definition: tinyxml2.h:1834
unsigned UnsignedValue() const
Query as an unsigned integer. See IntValue()
Definition: tinyxml2.h:1069
void PopArr(int count)
Definition: tinyxml2.h:223
GLuint start
Definition: gl.h:1545
#define f
Definition: ke_i.h:83
XMLError QueryUnsignedValue(unsigned int *value) const
See QueryIntValue.
Definition: tinyxml2.cpp:1295
XMLText(XMLDocument *doc)
Definition: tinyxml2.h:921
static bool IsNameStartChar(unsigned char ch)
Definition: tinyxml2.h:537
const XMLElement * ToElement() const
Definition: tinyxml2.h:1919
XMLDocument * _document
Definition: tinyxml2.h:861
virtual XMLText * ToText()
Safely cast to Text, or null.
Definition: tinyxml2.h:635
void SetAttribute(const char *name, int value)
Sets the named attribute to value.
Definition: tinyxml2.h:1322
XMLError QueryBoolAttribute(const char *name, bool *value) const
See QueryIntAttribute()
Definition: tinyxml2.h:1254
bool HasBOM() const
Definition: tinyxml2.h:1595
XMLText * ToText()
Safe cast to XMLText. This can return null.
Definition: tinyxml2.h:1851
void operator=(StrPair &other)
int QueryAttribute(const char *name, unsigned int *value) const
Definition: tinyxml2.h:1300
const XMLNode * LastChild() const
Get the last child node, or null if none exists.
Definition: tinyxml2.h:723
T & operator[](int i)
Definition: tinyxml2.h:232
const XMLConstHandle LastChildElement(const char *name=0) const
Definition: tinyxml2.h:1899
XMLNode * LastChild()
Definition: tinyxml2.h:727
const XMLConstHandle NextSiblingElement(const char *name=0) const
Definition: tinyxml2.h:1911
virtual bool CompactMode(const XMLElement &)
Definition: tinyxml2.h:2063
XMLHandle PreviousSibling()
Get the previous sibling of this handle.
Definition: tinyxml2.h:1826
MemPoolT< sizeof(XMLText) > _textPool
Definition: tinyxml2.h:1724
XMLDeclaration * ToDeclaration()
Safe cast to XMLDeclaration. This can return null.
Definition: tinyxml2.h:1859
Definition: mem.c:156
bool NoChildren() const
Returns true if this node has no children.
Definition: tinyxml2.h:700
virtual const XMLDocument * ToDocument() const
Definition: tinyxml2.h:664
int CStrSize() const
Definition: tinyxml2.h:2050
virtual void Clear()=0
Definition: name.c:36
MemPoolT< sizeof(XMLElement) > _elementPool
Definition: tinyxml2.h:1722
const XMLAttribute * FirstAttribute() const
Return the first attribute in the list.
Definition: tinyxml2.h:1353
XMLUnknown * ToUnknown()
Safe cast to XMLUnknown. This can return null.
Definition: tinyxml2.h:1855
XMLHandle FirstChild()
Get the first child of this handle.
Definition: tinyxml2.h:1810
virtual const XMLUnknown * ToUnknown() const
Definition: tinyxml2.h:1016
XMLElement * ToElement()
Safe cast to XMLElement. This can return null.
Definition: tinyxml2.h:1847
XMLHandle PreviousSiblingElement(const char *name=0)
Get the previous sibling element of this handle.
Definition: tinyxml2.h:1830
float FloatAttribute(const char *name) const
See IntAttribute()
Definition: tinyxml2.h:1219
virtual bool Visit(const XMLDeclaration &)
Visit a declaration.
Definition: tinyxml2.h:468
float bval
Definition: cylfrac.c:48
virtual bool VisitEnter(const XMLDocument &)
Visit a document.
Definition: tinyxml2.h:450
XMLNode * _prev
Definition: tinyxml2.h:868
virtual const XMLElement * ToElement() const
Definition: tinyxml2.h:655
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
char * ParseText(char *in, const char *endTag, int strFlags)
Definition: tinyxml2.cpp:191
GLfloat GLfloat p
Definition: glext.h:8902
XMLError QueryBoolValue(bool *value) const
See QueryIntValue.
Definition: tinyxml2.cpp:1304
virtual XMLDocument * ToDocument()
Safely cast to a Document, or null.
Definition: tinyxml2.h:1528
virtual int ItemSize() const =0
Whitespace WhitespaceMode() const
Definition: tinyxml2.h:1588
float FloatValue() const
Query as a float. See IntValue()
Definition: tinyxml2.h:1087
virtual XMLDeclaration * ToDeclaration()
Safely cast to a Declaration, or null.
Definition: tinyxml2.h:647
virtual XMLElement * ToElement()
Safely cast to an Element, or null.
Definition: tinyxml2.h:631
virtual XMLComment * ToComment()
Safely cast to a Comment, or null.
Definition: tinyxml2.h:939
GLuint64EXT * result
Definition: glext.h:11304
#define memset(x, y, z)
Definition: compat.h:39
virtual const XMLComment * ToComment() const
Definition: tinyxml2.h:942
const XMLNode * NextSibling() const
Get the next (right) sibling node of this node.
Definition: tinyxml2.h:757
XMLHandle(const XMLHandle &ref)
Copy constructor.
Definition: tinyxml2.h:1800
virtual const XMLDocument * ToDocument() const
Definition: tinyxml2.h:1532
bool Empty() const
Definition: tinyxml2.h:144
#define printf
Definition: config.h:203
const char * CStr() const
Definition: tinyxml2.h:2042
const char * Name() const
Get the name of an element (which is the Value() of the node.)
Definition: tinyxml2.h:1149
void SetInternedStr(const char *str)
Definition: tinyxml2.h:148
Definition: fci.c:126