blob: 1f4d719ee870f3964ff6cf7c3798ce640ad860cb [file] [log] [blame]
U-Lama\Leee13c3e62011-12-28 14:36:55 -08001#ifndef TINYXML2_INCLUDED
2#define TINYXML2_INCLUDED
3
Lee Thomason2c85a712012-01-31 08:24:24 -08004/*
5 TODO
6 - const and non-const versions of API
7 - memory pool the class construction
8 - attribute accessors
9 - node navigation
10 - handles
11 - visit pattern - change streamer?
12 - make constructors protected
13 - hide copy constructor
14 - hide = operator
Lee Thomasond1983222012-02-06 08:41:24 -080015 - #define to remove mem-pooling, and make thread safe
16 - UTF8 support: isAlpha, etc.
17
18 (No reason to ever cast to base)
19 XMLBase -> Utility
20
21 XMLNode
22 Document
23 Pooled
24 Element
25 Text
Lee Thomason2c85a712012-01-31 08:24:24 -080026*/
27
U-Lama\Lee4cee6112011-12-31 14:58:18 -080028#include <limits.h>
Lee Thomasonce0763e2012-01-11 15:43:54 -080029#include <ctype.h>
30#include <stdio.h>
Lee Thomason2c85a712012-01-31 08:24:24 -080031#include <memory.h>
U-Lama\Lee4cee6112011-12-31 14:58:18 -080032
33#if defined( _DEBUG ) || defined( DEBUG ) || defined (__DEBUG__)
34 #ifndef DEBUG
35 #define DEBUG
36 #endif
37#endif
38
39
40#if defined(DEBUG)
41 #if defined(_MSC_VER)
42 #define TIXMLASSERT( x ) if ( !(x)) { _asm { int 3 } } //if ( !(x)) WinDebugBreak()
43 #elif defined (ANDROID_NDK)
44 #include <android/log.h>
45 #define TIXMLASSERT( x ) if ( !(x)) { __android_log_assert( "assert", "grinliz", "ASSERT in '%s' at %d.", __FILE__, __LINE__ ); }
46 #else
47 #include <assert.h>
48 #define TIXMLASSERT assert
49 #endif
50#else
51 #define TIXMLASSERT( x ) {}
52#endif
53
U-Lama\Leee13c3e62011-12-28 14:36:55 -080054
55namespace tinyxml2
56{
Lee Thomasonce0763e2012-01-11 15:43:54 -080057class XMLDocument;
Lee Thomason8a5dfee2012-01-18 17:43:40 -080058class XMLElement;
59class XMLAttribute;
60class XMLComment;
61class XMLNode;
Lee Thomason5492a1c2012-01-23 15:32:10 -080062class XMLText;
U-Lama\Leee13c3e62011-12-28 14:36:55 -080063
Lee Thomason5cae8972012-01-24 18:03:07 -080064class XMLStreamer;
65
Lee Thomason39ede242012-01-20 11:27:56 -080066class StrPair
67{
Lee Thomasond34f52c2012-01-20 12:55:24 -080068public:
Lee Thomason39ede242012-01-20 11:27:56 -080069 enum {
Lee Thomasone4422302012-01-20 17:59:50 -080070 NEEDS_ENTITY_PROCESSING = 0x01,
Lee Thomason18d68bd2012-01-26 18:17:26 -080071 NEEDS_NEWLINE_NORMALIZATION = 0x02,
72
73 TEXT_ELEMENT = NEEDS_ENTITY_PROCESSING | NEEDS_NEWLINE_NORMALIZATION,
74 ATTRIBUTE_NAME = 0,
75 ATTRIBUTE_VALUE = NEEDS_ENTITY_PROCESSING | NEEDS_NEWLINE_NORMALIZATION,
76 COMMENT = NEEDS_NEWLINE_NORMALIZATION,
Lee Thomason39ede242012-01-20 11:27:56 -080077 };
78
79 StrPair() : flags( 0 ), start( 0 ), end( 0 ) {}
Lee Thomasone4422302012-01-20 17:59:50 -080080 void Set( char* start, char* end, int flags ) {
Lee Thomason39ede242012-01-20 11:27:56 -080081 this->start = start; this->end = end; this->flags = flags | NEEDS_FLUSH;
82 }
83 const char* GetStr();
Lee Thomasone4422302012-01-20 17:59:50 -080084 bool Empty() const { return start == end; }
Lee Thomason39ede242012-01-20 11:27:56 -080085
Lee Thomason2c85a712012-01-31 08:24:24 -080086 void SetInternedStr( const char* str ) { this->start = (char*) str; this->end = 0; this->flags = 0; }
87
Lee Thomason39ede242012-01-20 11:27:56 -080088private:
Lee Thomasone4422302012-01-20 17:59:50 -080089 enum {
90 NEEDS_FLUSH = 0x100
91 };
92
Lee Thomason39ede242012-01-20 11:27:56 -080093 // After parsing, if *end != 0, it can be set to zero.
94 int flags;
Lee Thomasone4422302012-01-20 17:59:50 -080095 char* start;
Lee Thomason39ede242012-01-20 11:27:56 -080096 char* end;
97};
98
U-Lama\Lee560bd472011-12-28 19:42:49 -080099
Lee Thomason2c85a712012-01-31 08:24:24 -0800100template <class T, int INIT>
101class DynArray
102{
103public:
104 DynArray< T, INIT >()
105 {
106 mem = pool;
107 allocated = INIT;
108 size = 0;
109 }
110 ~DynArray()
111 {
112 if ( mem != pool ) {
113 delete mem;
114 }
115 }
116 void Push( T t )
117 {
118 EnsureCapacity( size+1 );
119 mem[size++] = t;
120 }
121
122 T* PushArr( int count )
123 {
124 EnsureCapacity( size+count );
125 T* ret = &mem[size];
126 size += count;
127 return ret;
128 }
129 T Pop() {
130 return mem[--size];
131 }
132 void PopArr( int count )
133 {
134 TIXMLASSERT( size >= count );
135 size -= count;
136 }
137
138 bool Empty() const { return size == 0; }
139 T& operator[](int i) { TIXMLASSERT( i>= 0 && i < size ); return mem[i]; }
140 const T& operator[](int i) const { TIXMLASSERT( i>= 0 && i < size ); return mem[i]; }
141 int Size() const { return size; }
142 const T* Mem() const { return mem; }
143 T* Mem() { return mem; }
144
145
146private:
147 void EnsureCapacity( int cap ) {
148 if ( cap > allocated ) {
149 int newAllocated = cap * 2;
150 T* newMem = new T[newAllocated];
151 memcpy( newMem, mem, sizeof(T)*size ); // warning: not using constructors, only works for PODs
152 if ( mem != pool ) delete [] mem;
153 mem = newMem;
154 allocated = newAllocated;
155 }
156 }
157
158 T* mem;
159 T pool[INIT];
160 int allocated; // objects allocated
161 int size; // number objects in use
162};
163
Lee Thomasond1983222012-02-06 08:41:24 -0800164class MemPool
165{
166public:
167 MemPool() {}
168 virtual ~MemPool() {}
169
170 virtual int ItemSize() const = 0;
171 virtual void* Alloc() = 0;
172 virtual void Free( void* ) = 0;
173};
174
175template< int SIZE >
176class MemPoolT : public MemPool
177{
178public:
179 MemPoolT() : root( 0 ), nAlloc( 0 ) {}
180 ~MemPoolT() {
181 // Delete the blocks.
182 for( int i=0; i<blockPtrs.Size(); ++i ) {
183 delete blockPtrs[i];
184 }
185 }
186
187 virtual int ItemSize() const { return SIZE; }
188 int NAlloc() const { return nAlloc; }
189
190 virtual void* Alloc() {
191 if ( !root ) {
192 // Need a new block.
193 Block* block = new Block();
194 blockPtrs.Push( block );
195
196 for( int i=0; i<COUNT-1; ++i ) {
197 block->chunk[i].next = &block->chunk[i+1];
198 }
199 block->chunk[COUNT-1].next = 0;
200 root = block->chunk;
201 }
202 void* result = root;
203 root = root->next;
204 ++nAlloc;
205 return result;
206 }
207 virtual void Free( void* mem ) {
208 if ( !mem ) return;
209 --nAlloc;
210 Chunk* chunk = (Chunk*)mem;
211 memset( chunk, 0xfe, sizeof(Chunk) );
212 chunk->next = root;
213 root = chunk;
214 }
215
216private:
217 enum { COUNT = 1024/SIZE };
218 union Chunk {
219 Chunk* next;
220 char mem[SIZE];
221 };
222 struct Block {
223 Chunk chunk[COUNT];
224 };
225 DynArray< Block*, 10 > blockPtrs;
226 Chunk* root;
227 int nAlloc;
228};
229
Lee Thomason2c85a712012-01-31 08:24:24 -0800230
231/*
232class StringStack
233{
234public:
235 StringStack();
236 virtual ~StringStack();
237
238 void Push( const char* str );
239 const char* Pop();
240
241 int NumPositive() const { return nPositive; }
242
243private:
244 DynArray< char, 50 > mem;
245 int nPositive; // number of strings with len > 0
246};
247*/
248
249/*
250class StringPool
251{
252public:
253 enum { INIT_SIZE=20 };
254
255 StringPool() : size( 0 ) {
256 const char** mem = pool.PushArr( INIT_SIZE );
257 memset( (void*)mem, 0, sizeof(char)*INIT_SIZE );
258 }
259 ~StringPool() {}
260
261 const char* Intern( const char* str );
262
263private:
264 // FNV hash
265 int Hash( const char* s ) {
266 #define FNV_32_PRIME ((int)0x01000193)
267 int hval = 0;
268 while (*s) {
269 hval *= FNV_32_PRIME;
270 hval ^= (int)*s++;
271 }
272 return hval;
273 }
274
275 int size;
276 DynArray< const char*, INIT_SIZE > pool; // the hash table
277 StringStack store; // memory for the interned strings
278};
279*/
280
Lee Thomason8a5dfee2012-01-18 17:43:40 -0800281class XMLBase
U-Lama\Leee13c3e62011-12-28 14:36:55 -0800282{
283public:
Lee Thomasond1983222012-02-06 08:41:24 -0800284
285public:
Lee Thomason8a5dfee2012-01-18 17:43:40 -0800286 XMLBase() {}
287 virtual ~XMLBase() {}
U-Lama\Lee4cee6112011-12-31 14:58:18 -0800288
Lee Thomason3f57d272012-01-11 15:30:03 -0800289 static const char* SkipWhiteSpace( const char* p ) { while( isspace( *p ) ) { ++p; } return p; }
290 static char* SkipWhiteSpace( char* p ) { while( isspace( *p ) ) { ++p; } return p; }
U-Lama\Lee4cee6112011-12-31 14:58:18 -0800291
292 inline static bool StringEqual( const char* p, const char* q, int nChar=INT_MAX ) {
293 int n = 0;
Lee Thomasond34f52c2012-01-20 12:55:24 -0800294 if ( p == q ) {
295 return true;
296 }
U-Lama\Lee4cee6112011-12-31 14:58:18 -0800297 while( *p && *q && *p == *q && n<nChar ) {
298 ++p; ++q; ++n;
299 }
300 if ( (n == nChar) || ( *p == 0 && *q == 0 ) ) {
301 return true;
302 }
303 return false;
304 }
Lee Thomason8a5dfee2012-01-18 17:43:40 -0800305 inline static int IsUTF8Continuation( unsigned char p ) { return p & 0x80; }
306 inline static int IsAlphaNum( unsigned char anyByte ) { return ( anyByte <= 127 ) ? isalnum( anyByte ) : 1; }
307 inline static int IsAlpha( unsigned char anyByte ) { return ( anyByte <= 127 ) ? isalpha( anyByte ) : 1; }
U-Lama\Lee4cee6112011-12-31 14:58:18 -0800308
Lee Thomasond1983222012-02-06 08:41:24 -0800309 static char* ParseText( char* in, StrPair* pair, const char* endTag, int strFlags );
310 static char* ParseName( char* in, StrPair* pair );
311
312private:
Lee Thomason8a5dfee2012-01-18 17:43:40 -0800313};
314
Lee Thomason5cae8972012-01-24 18:03:07 -0800315
Lee Thomasond1983222012-02-06 08:41:24 -0800316class XMLNode
Lee Thomason8a5dfee2012-01-18 17:43:40 -0800317{
318 friend class XMLDocument;
319 friend class XMLElement;
320public:
Lee Thomasond1983222012-02-06 08:41:24 -0800321 //void* operator new( size_t size, MemPool* pool );
322 //void operator delete( void* mem, MemPool* pool );
Lee Thomason8a5dfee2012-01-18 17:43:40 -0800323
324 XMLNode* InsertEndChild( XMLNode* addThis );
Lee Thomason5cae8972012-01-24 18:03:07 -0800325 virtual void Print( XMLStreamer* streamer );
Lee Thomason8a5dfee2012-01-18 17:43:40 -0800326
Lee Thomason2c85a712012-01-31 08:24:24 -0800327 const char* Value() const { return value.GetStr(); }
328 void SetValue( const char* val ) { value.SetInternedStr( val ); }
329
Lee Thomason5492a1c2012-01-23 15:32:10 -0800330 virtual XMLElement* ToElement() { return 0; }
331 virtual XMLText* ToText() { return 0; }
332 virtual XMLComment* ToComment() { return 0; }
Lee Thomason3f57d272012-01-11 15:30:03 -0800333
Lee Thomason2c85a712012-01-31 08:24:24 -0800334 XMLNode* FirstChild() { return firstChild; }
335 XMLElement* FirstChildElement( const char* value=0 );
336
Lee Thomason67d61312012-01-24 16:01:51 -0800337 // fixme: guarentee null terminator to avoid internal checks
338 virtual char* ParseDeep( char* );
339
340 void SetTextParent() { isTextParent = true; }
341 bool IsTextParent() const { return isTextParent; }
342 virtual bool IsClosingElement() const { return false; }
Lee Thomason3f57d272012-01-11 15:30:03 -0800343
Lee Thomason8a5dfee2012-01-18 17:43:40 -0800344protected:
345 XMLNode( XMLDocument* );
Lee Thomasond1983222012-02-06 08:41:24 -0800346 virtual ~XMLNode();
347
Lee Thomason18d68bd2012-01-26 18:17:26 -0800348 void ClearChildren();
Lee Thomason8a5dfee2012-01-18 17:43:40 -0800349
Lee Thomason3f57d272012-01-11 15:30:03 -0800350 XMLDocument* document;
351 XMLNode* parent;
Lee Thomason67d61312012-01-24 16:01:51 -0800352 bool isTextParent;
Lee Thomason2c85a712012-01-31 08:24:24 -0800353 mutable StrPair value;
Lee Thomason3f57d272012-01-11 15:30:03 -0800354
355 XMLNode* firstChild;
356 XMLNode* lastChild;
357
358 XMLNode* prev;
359 XMLNode* next;
360
U-Lama\Lee4cee6112011-12-31 14:58:18 -0800361private:
Lee Thomasond1983222012-02-06 08:41:24 -0800362 MemPool* memPool;
Lee Thomason18d68bd2012-01-26 18:17:26 -0800363 void Unlink( XMLNode* child );
U-Lama\Lee4cee6112011-12-31 14:58:18 -0800364};
365
366
Lee Thomason5492a1c2012-01-23 15:32:10 -0800367class XMLText : public XMLNode
368{
Lee Thomason2c85a712012-01-31 08:24:24 -0800369 friend class XMLBase;
370 friend class XMLDocument;
Lee Thomason5492a1c2012-01-23 15:32:10 -0800371public:
Lee Thomason5cae8972012-01-24 18:03:07 -0800372 virtual void Print( XMLStreamer* streamer );
Lee Thomason5492a1c2012-01-23 15:32:10 -0800373 const char* Value() { return value.GetStr(); }
Lee Thomason2c85a712012-01-31 08:24:24 -0800374 void SetValue( const char* );
375
Lee Thomason5492a1c2012-01-23 15:32:10 -0800376 virtual XMLText* ToText() { return this; }
377
378 char* ParseDeep( char* );
379
380protected:
Lee Thomason2c85a712012-01-31 08:24:24 -0800381 XMLText( XMLDocument* doc ) : XMLNode( doc ) {}
Lee Thomasond1983222012-02-06 08:41:24 -0800382 virtual ~XMLText() {}
Lee Thomason5492a1c2012-01-23 15:32:10 -0800383
384private:
Lee Thomason5492a1c2012-01-23 15:32:10 -0800385};
386
387
U-Lama\Lee4cee6112011-12-31 14:58:18 -0800388class XMLComment : public XMLNode
389{
Lee Thomason2c85a712012-01-31 08:24:24 -0800390 friend class XMLBase;
391 friend class XMLDocument;
Lee Thomason3f57d272012-01-11 15:30:03 -0800392public:
Lee Thomason5cae8972012-01-24 18:03:07 -0800393 virtual void Print( XMLStreamer* );
Lee Thomason5492a1c2012-01-23 15:32:10 -0800394 virtual XMLComment* ToComment() { return this; }
Lee Thomasonce0763e2012-01-11 15:43:54 -0800395
Lee Thomasond34f52c2012-01-20 12:55:24 -0800396 const char* Value() { return value.GetStr(); }
Lee Thomason8a5dfee2012-01-18 17:43:40 -0800397
Lee Thomasonce0763e2012-01-11 15:43:54 -0800398 char* ParseDeep( char* );
399
Lee Thomason8a5dfee2012-01-18 17:43:40 -0800400protected:
Lee Thomason2c85a712012-01-31 08:24:24 -0800401 XMLComment( XMLDocument* doc );
Lee Thomasond1983222012-02-06 08:41:24 -0800402 virtual ~XMLComment();
Lee Thomason8a5dfee2012-01-18 17:43:40 -0800403
Lee Thomason3f57d272012-01-11 15:30:03 -0800404private:
U-Lama\Lee4cee6112011-12-31 14:58:18 -0800405};
U-Lama\Leee13c3e62011-12-28 14:36:55 -0800406
407
Lee Thomason8a5dfee2012-01-18 17:43:40 -0800408class XMLAttribute : public XMLBase
409{
410 friend class XMLElement;
411public:
Lee Thomason5cae8972012-01-24 18:03:07 -0800412 virtual void Print( XMLStreamer* streamer );
Lee Thomason8a5dfee2012-01-18 17:43:40 -0800413
414private:
Lee Thomasond1983222012-02-06 08:41:24 -0800415 XMLAttribute( XMLElement* element ) : next( 0 ) {}
416 virtual ~XMLAttribute() {}
Lee Thomason8a5dfee2012-01-18 17:43:40 -0800417 char* ParseDeep( char* p );
418
Lee Thomason22aead12012-01-23 13:29:35 -0800419 StrPair name;
Lee Thomasond34f52c2012-01-20 12:55:24 -0800420 StrPair value;
Lee Thomason8a5dfee2012-01-18 17:43:40 -0800421 XMLAttribute* next;
422};
423
424
425class XMLElement : public XMLNode
426{
Lee Thomason2c85a712012-01-31 08:24:24 -0800427 friend class XMLBase;
428 friend class XMLDocument;
Lee Thomason8a5dfee2012-01-18 17:43:40 -0800429public:
Lee Thomason2c85a712012-01-31 08:24:24 -0800430 const char* Name() const { return Value(); }
431 void SetName( const char* str ) { SetValue( str ); }
432
Lee Thomason5cae8972012-01-24 18:03:07 -0800433 virtual void Print( XMLStreamer* );
Lee Thomason8a5dfee2012-01-18 17:43:40 -0800434
435 virtual XMLElement* ToElement() { return this; }
Lee Thomason8a5dfee2012-01-18 17:43:40 -0800436
Lee Thomason2c85a712012-01-31 08:24:24 -0800437 // internal:
438 virtual bool IsClosingElement() const { return closing; }
Lee Thomason8a5dfee2012-01-18 17:43:40 -0800439 char* ParseDeep( char* p );
440
441protected:
Lee Thomason2c85a712012-01-31 08:24:24 -0800442 XMLElement( XMLDocument* doc );
Lee Thomasond1983222012-02-06 08:41:24 -0800443 virtual ~XMLElement();
Lee Thomason8a5dfee2012-01-18 17:43:40 -0800444
445private:
Lee Thomason67d61312012-01-24 16:01:51 -0800446 char* ParseAttributes( char* p, bool *closedElement );
447
Lee Thomason8a5dfee2012-01-18 17:43:40 -0800448 bool closing;
449 XMLAttribute* rootAttribute;
450 XMLAttribute* lastAttribute;
451};
452
453
Lee Thomason67d61312012-01-24 16:01:51 -0800454class XMLDocument : public XMLNode
U-Lama\Leee13c3e62011-12-28 14:36:55 -0800455{
Lee Thomasond1983222012-02-06 08:41:24 -0800456 friend class XMLElement;
U-Lama\Leee13c3e62011-12-28 14:36:55 -0800457public:
Lee Thomason18d68bd2012-01-26 18:17:26 -0800458 XMLDocument();
Lee Thomason3f57d272012-01-11 15:30:03 -0800459 ~XMLDocument();
U-Lama\Leee13c3e62011-12-28 14:36:55 -0800460
Lee Thomason7c913cd2012-01-26 18:32:34 -0800461 int Parse( const char* );
462 int Load( const char* );
463 int Load( FILE* );
Lee Thomason18d68bd2012-01-26 18:17:26 -0800464
Lee Thomason5cae8972012-01-24 18:03:07 -0800465 void Print( XMLStreamer* streamer=0 );
U-Lama\Leee13c3e62011-12-28 14:36:55 -0800466
Lee Thomason2c85a712012-01-31 08:24:24 -0800467 XMLElement* NewElement( const char* name );
468
Lee Thomason8a5dfee2012-01-18 17:43:40 -0800469 enum {
Lee Thomason18d68bd2012-01-26 18:17:26 -0800470 NO_ERROR = 0,
Lee Thomason8a5dfee2012-01-18 17:43:40 -0800471 ERROR_ELEMENT_MISMATCH,
472 ERROR_PARSING_ELEMENT,
473 ERROR_PARSING_ATTRIBUTE
474 };
Lee Thomason67d61312012-01-24 16:01:51 -0800475 void SetError( int error, const char* str1, const char* str2 );
Lee Thomason18d68bd2012-01-26 18:17:26 -0800476
Lee Thomason7c913cd2012-01-26 18:32:34 -0800477 bool Error() const { return errorID != NO_ERROR; }
Lee Thomason18d68bd2012-01-26 18:17:26 -0800478 int GetErrorID() const { return errorID; }
479 const char* GetErrorStr1() const { return errorStr1; }
480 const char* GetErrorStr2() const { return errorStr2; }
Lee Thomason8a5dfee2012-01-18 17:43:40 -0800481
Lee Thomasond1983222012-02-06 08:41:24 -0800482 char* Identify( char* p, XMLNode** node );
Lee Thomason2c85a712012-01-31 08:24:24 -0800483
Lee Thomason3f57d272012-01-11 15:30:03 -0800484private:
Lee Thomasond1983222012-02-06 08:41:24 -0800485
Lee Thomason3f57d272012-01-11 15:30:03 -0800486 XMLDocument( const XMLDocument& ); // intentionally not implemented
Lee Thomason18d68bd2012-01-26 18:17:26 -0800487 void InitDocument();
488
Lee Thomason7c913cd2012-01-26 18:32:34 -0800489 int errorID;
Lee Thomason18d68bd2012-01-26 18:17:26 -0800490 const char* errorStr1;
491 const char* errorStr2;
492 char* charBuffer;
Lee Thomason2c85a712012-01-31 08:24:24 -0800493 //StringStack stringPool;
Lee Thomasond1983222012-02-06 08:41:24 -0800494
495 MemPoolT< sizeof(XMLElement) > elementPool;
496 MemPoolT< sizeof(XMLAttribute) > attributePool;
497 MemPoolT< sizeof(XMLText) > textPool;
498 MemPoolT< sizeof(XMLComment) > commentPool;
Lee Thomason5cae8972012-01-24 18:03:07 -0800499};
500
Lee Thomason7c913cd2012-01-26 18:32:34 -0800501
Lee Thomason5cae8972012-01-24 18:03:07 -0800502class XMLStreamer
503{
504public:
505 XMLStreamer( FILE* file );
506 ~XMLStreamer() {}
507
508 void OpenElement( const char* name, bool textParent );
509 void PushAttribute( const char* name, const char* value );
510 void CloseElement();
511
512 void PushText( const char* text );
513 void PushComment( const char* comment );
514
515private:
516 void SealElement();
517 void PrintSpace( int depth );
Lee Thomason857b8682012-01-25 17:50:25 -0800518 void PrintString( const char* ); // prints out, after detecting entities.
Lee Thomason2c85a712012-01-31 08:24:24 -0800519 bool TextOnStack() const {
520 for( int i=0; i<text.Size(); ++i ) {
521 if ( text[i] == 'T' )
522 return true;
523 }
524 return false;
525 }
Lee Thomason5cae8972012-01-24 18:03:07 -0800526
527 FILE* fp;
528 int depth;
529 bool elementJustOpened;
Lee Thomason857b8682012-01-25 17:50:25 -0800530 enum {
Lee Thomason951d8832012-01-26 08:47:06 -0800531 ENTITY_RANGE = 64
Lee Thomason857b8682012-01-25 17:50:25 -0800532 };
533 bool entityFlag[ENTITY_RANGE];
Lee Thomason5cae8972012-01-24 18:03:07 -0800534
Lee Thomason2c85a712012-01-31 08:24:24 -0800535 DynArray< const char*, 10 > stack;
536 DynArray< char, 10 > text;
Lee Thomason5cae8972012-01-24 18:03:07 -0800537};
538
539
U-Lama\Leee13c3e62011-12-28 14:36:55 -0800540}; // tinyxml2
541
U-Lama\Lee560bd472011-12-28 19:42:49 -0800542
543
U-Lama\Leee13c3e62011-12-28 14:36:55 -0800544#endif // TINYXML2_INCLUDED