24 #ifndef TINYXML2_INCLUDED 25 #define TINYXML2_INCLUDED 27 #if defined(ANDROID_NDK) || defined(__BORLANDC__) || defined(__QNXNTO__) 56 #if defined( _DEBUG ) || defined (__DEBUG__) 63 # pragma warning(push) 64 # pragma warning(disable: 4251) 68 # ifdef TINYXML2_EXPORT 69 # define TINYXML2_LIB __declspec(dllexport) 70 # elif defined(TINYXML2_IMPORT) 71 # define TINYXML2_LIB __declspec(dllimport) 76 # define TINYXML2_LIB __attribute__((visibility("default"))) 83 # if defined(_MSC_VER) 84 # // "(void)0," is for suppressing C4127 warning in "assert(false)", "assert(true)" and the like 85 # define TIXMLASSERT( x ) if ( !((void)0,(x))) { __debugbreak(); } 86 # elif defined (ANDROID_NDK) 87 # include <android/log.h> 88 # define TIXMLASSERT( x ) if ( !(x)) { __android_log_assert( "assert", "grinliz", "ASSERT in '%s' at %d.", __FILE__, __LINE__ ); } 91 # define TIXMLASSERT assert 94 # define TIXMLASSERT( x ) {} 101 static const int TIXML2_MAJOR_VERSION = 5;
102 static const int TIXML2_MINOR_VERSION = 0;
103 static const int TIXML2_PATCH_VERSION = 1;
112 class XMLDeclaration;
126 NEEDS_ENTITY_PROCESSING = 0x01,
127 NEEDS_NEWLINE_NORMALIZATION = 0x02,
128 NEEDS_WHITESPACE_COLLAPSING = 0x04,
130 TEXT_ELEMENT = NEEDS_ENTITY_PROCESSING | NEEDS_NEWLINE_NORMALIZATION,
131 TEXT_ELEMENT_LEAVE_ENTITIES = NEEDS_NEWLINE_NORMALIZATION,
133 ATTRIBUTE_VALUE = NEEDS_ENTITY_PROCESSING | NEEDS_NEWLINE_NORMALIZATION,
134 ATTRIBUTE_VALUE_LEAVE_ENTITIES = NEEDS_NEWLINE_NORMALIZATION,
135 COMMENT = NEEDS_NEWLINE_NORMALIZATION
138 StrPair() : _flags( 0 ), _start( 0 ), _end( 0 ) {}
141 void Set(
char* start,
char* end,
int flags ) {
142 TIXMLASSERT( start );
147 _flags = flags | NEEDS_FLUSH;
150 const char* GetStr();
153 return _start == _end;
156 void SetInternedStr(
const char* str ) {
158 _start =
const_cast<char*
>(str);
161 void SetStr(
const char* str,
int flags=0 );
163 char* ParseText(
char* in,
const char* endTag,
int strFlags,
int* curLineNumPtr );
164 char* ParseName(
char* in );
166 void TransferTo( StrPair* other );
170 void CollapseWhitespace();
181 StrPair(
const StrPair& other );
182 void operator=( StrPair& other );
191 template <
class T,
int INITIAL_SIZE>
197 _allocated = INITIAL_SIZE;
202 if ( _mem != _pool ) {
212 TIXMLASSERT( _size < INT_MAX );
213 EnsureCapacity( _size+1 );
218 T* PushArr(
int count ) {
219 TIXMLASSERT( count >= 0 );
220 TIXMLASSERT( _size <= INT_MAX - count );
221 EnsureCapacity( _size+count );
222 T* ret = &_mem[_size];
228 TIXMLASSERT( _size > 0 );
233 void PopArr(
int count ) {
234 TIXMLASSERT( _size >= count );
242 T& operator[](
int i) {
243 TIXMLASSERT( i>= 0 && i < _size );
247 const T& operator[](
int i)
const {
248 TIXMLASSERT( i>= 0 && i < _size );
252 const T& PeekTop()
const {
253 TIXMLASSERT( _size > 0 );
254 return _mem[ _size - 1];
258 TIXMLASSERT( _size >= 0 );
262 int Capacity()
const {
263 TIXMLASSERT( _allocated >= INITIAL_SIZE );
267 void SwapRemove(
int i) {
268 TIXMLASSERT(i >= 0 && i < _size);
269 TIXMLASSERT(_size > 0);
270 _mem[i] = _mem[_size - 1];
274 const T* Mem()
const {
285 DynArray(
const DynArray& );
286 void operator=(
const DynArray& );
288 void EnsureCapacity(
int cap ) {
289 TIXMLASSERT( cap > 0 );
290 if ( cap > _allocated ) {
291 TIXMLASSERT( cap <= INT_MAX / 2 );
292 int newAllocated = cap * 2;
293 T* newMem =
new T[newAllocated];
294 TIXMLASSERT( newAllocated >= _size );
295 memcpy( newMem, _mem,
sizeof(T)*_size );
296 if ( _mem != _pool ) {
300 _allocated = newAllocated;
305 T _pool[INITIAL_SIZE];
319 virtual ~MemPool() {}
321 virtual int ItemSize()
const = 0;
322 virtual void* Alloc() = 0;
323 virtual void Free(
void* ) = 0;
324 virtual void SetTracked() = 0;
325 virtual void Clear() = 0;
332 template<
int ITEM_SIZE >
333 class MemPoolT :
public MemPool
336 MemPoolT() : _root(0), _currentAllocs(0), _nAllocs(0), _maxAllocs(0), _nUntracked(0) {}
343 while( !_blockPtrs.Empty()) {
344 Block* b = _blockPtrs.Pop();
354 virtual int ItemSize()
const {
357 int CurrentAllocs()
const {
358 return _currentAllocs;
361 virtual void* Alloc() {
364 Block* block =
new Block();
365 _blockPtrs.Push( block );
367 Item* blockItems = block->items;
368 for(
int i = 0; i < ITEMS_PER_BLOCK - 1; ++i ) {
369 blockItems[i].next = &(blockItems[i + 1]);
371 blockItems[ITEMS_PER_BLOCK - 1].next = 0;
374 Item*
const result = _root;
375 TIXMLASSERT( result != 0 );
379 if ( _currentAllocs > _maxAllocs ) {
380 _maxAllocs = _currentAllocs;
387 virtual void Free(
void* mem ) {
392 Item* item =
static_cast<Item*
>( mem );
394 memset( item, 0xfe,
sizeof( *item ) );
399 void Trace(
const char* name ) {
400 printf(
"Mempool %s watermark=%d [%dk] current=%d size=%d nAlloc=%d blocks=%d\n",
401 name, _maxAllocs, _maxAllocs * ITEM_SIZE / 1024, _currentAllocs,
402 ITEM_SIZE, _nAllocs, _blockPtrs.Size() );
409 int Untracked()
const {
424 enum { ITEMS_PER_BLOCK = (4 * 1024) / ITEM_SIZE };
427 MemPoolT(
const MemPoolT& );
428 void operator=(
const MemPoolT& );
432 char itemData[ITEM_SIZE];
435 Item items[ITEMS_PER_BLOCK];
437 DynArray< Block*, 10 > _blockPtrs;
512 XML_WRONG_ATTRIBUTE_TYPE,
513 XML_ERROR_FILE_NOT_FOUND,
514 XML_ERROR_FILE_COULD_NOT_BE_OPENED,
515 XML_ERROR_FILE_READ_ERROR,
516 UNUSED_XML_ERROR_ELEMENT_MISMATCH,
517 XML_ERROR_PARSING_ELEMENT,
518 XML_ERROR_PARSING_ATTRIBUTE,
519 UNUSED_XML_ERROR_IDENTIFYING_TAG,
520 XML_ERROR_PARSING_TEXT,
521 XML_ERROR_PARSING_CDATA,
522 XML_ERROR_PARSING_COMMENT,
523 XML_ERROR_PARSING_DECLARATION,
524 XML_ERROR_PARSING_UNKNOWN,
525 XML_ERROR_EMPTY_DOCUMENT,
526 XML_ERROR_MISMATCHED_ELEMENT,
528 XML_CAN_NOT_CONVERT_TEXT,
538 class TINYXML2_LIB XMLUtil
541 static const char* SkipWhiteSpace(
const char* p,
int* curLineNumPtr ) {
544 while( IsWhiteSpace(*p) ) {
545 if (curLineNumPtr && *p ==
'\n') {
553 static char* SkipWhiteSpace(
char* p,
int* curLineNumPtr ) {
554 return const_cast<char*
>( SkipWhiteSpace( const_cast<const char*>(p), curLineNumPtr ) );
559 static bool IsWhiteSpace(
char p ) {
560 return !IsUTF8Continuation(p) && isspace( static_cast<unsigned char>(p) );
563 inline static bool IsNameStartChar(
unsigned char ch ) {
568 if ( isalpha( ch ) ) {
571 return ch ==
':' || ch ==
'_';
574 inline static bool IsNameChar(
unsigned char ch ) {
575 return IsNameStartChar( ch )
581 inline static bool StringEqual(
const char* p,
const char* q,
int nChar=INT_MAX ) {
587 TIXMLASSERT( nChar >= 0 );
588 return strncmp( p, q, nChar ) == 0;
591 inline static bool IsUTF8Continuation(
char p ) {
592 return ( p & 0x80 ) != 0;
595 static const char* ReadBOM(
const char* p,
bool* hasBOM );
598 static const char* GetCharacterRef(
const char* p,
char* value,
int* length );
599 static void ConvertUTF32ToUTF8(
unsigned long input,
char* output,
int* length );
602 static void ToStr(
int v,
char* buffer,
int bufferSize );
603 static void ToStr(
unsigned v,
char* buffer,
int bufferSize );
604 static void ToStr(
bool v,
char* buffer,
int bufferSize );
605 static void ToStr(
float v,
char* buffer,
int bufferSize );
606 static void ToStr(
double v,
char* buffer,
int bufferSize );
607 static void ToStr(int64_t v,
char* buffer,
int bufferSize);
610 static bool ToInt(
const char* str,
int* value );
611 static bool ToUnsigned(
const char* str,
unsigned* value );
612 static bool ToBool(
const char* str,
bool* value );
613 static bool ToFloat(
const char* str,
float* value );
614 static bool ToDouble(
const char* str,
double* value );
615 static bool ToInt64(
const char* str, int64_t* value);
622 static void SetBoolSerialization(
const char* writeTrue,
const char* writeFalse);
625 static const char* writeBoolTrue;
626 static const char* writeBoolFalse;
663 TIXMLASSERT( _document );
668 TIXMLASSERT( _document );
700 virtual const XMLText* ToText()
const {
725 const char* Value()
const;
730 void SetValue(
const char* val,
bool staticMem=
false );
761 const XMLElement* FirstChildElement(
const char* name = 0 )
const;
763 XMLElement* FirstChildElement(
const char* name = 0 ) {
764 return const_cast<XMLElement*
>(
const_cast<const XMLNode*
>(
this)->FirstChildElement( name ));
779 const XMLElement* LastChildElement(
const char* name = 0 )
const;
781 XMLElement* LastChildElement(
const char* name = 0 ) {
782 return const_cast<XMLElement*
>(
const_cast<const XMLNode*
>(
this)->LastChildElement(name) );
795 const XMLElement* PreviousSiblingElement(
const char* name = 0 )
const ;
797 XMLElement* PreviousSiblingElement(
const char* name = 0 ) {
798 return const_cast<XMLElement*
>(
const_cast<const XMLNode*
>(
this)->PreviousSiblingElement( name ) );
811 const XMLElement* NextSiblingElement(
const char* name = 0 )
const;
813 XMLElement* NextSiblingElement(
const char* name = 0 ) {
814 return const_cast<XMLElement*
>(
const_cast<const XMLNode*
>(
this)->NextSiblingElement( name ) );
827 return InsertEndChild( addThis );
850 void DeleteChildren();
855 void DeleteChild(
XMLNode* node );
889 virtual bool ShallowEqual(
const XMLNode* compare )
const = 0;
913 virtual bool Accept(
XMLVisitor* visitor )
const = 0;
933 virtual char* ParseDeep(
char* p, StrPair* parentEndTag,
int* curLineNumPtr);
937 mutable StrPair _value;
951 static void DeleteNode(
XMLNode* node );
952 void InsertChildPreamble(
XMLNode* insertThis )
const;
953 const XMLElement* ToElementWithName(
const char* name )
const;
976 virtual bool Accept(
XMLVisitor* visitor )
const;
981 virtual const XMLText* ToText()
const {
995 virtual bool ShallowEqual(
const XMLNode* compare )
const;
1001 char* ParseDeep(
char* p, StrPair* parentEndTag,
int* curLineNumPtr );
1019 virtual const XMLComment* ToComment()
const {
1023 virtual bool Accept(
XMLVisitor* visitor )
const;
1026 virtual bool ShallowEqual(
const XMLNode* compare )
const;
1032 char* ParseDeep(
char* p, StrPair* parentEndTag,
int* curLineNumPtr);
1062 virtual bool Accept(
XMLVisitor* visitor )
const;
1065 virtual bool ShallowEqual(
const XMLNode* compare )
const;
1071 char* ParseDeep(
char* p, StrPair* parentEndTag,
int* curLineNumPtr );
1093 virtual const XMLUnknown* ToUnknown()
const {
1097 virtual bool Accept(
XMLVisitor* visitor )
const;
1100 virtual bool ShallowEqual(
const XMLNode* compare )
const;
1106 char* ParseDeep(
char* p, StrPair* parentEndTag,
int* curLineNumPtr );
1126 const char* Name()
const;
1129 const char* Value()
const;
1149 int64_t Int64Value()
const {
1151 QueryInt64Value(&i);
1158 QueryUnsignedValue( &i );
1164 QueryBoolValue( &b );
1170 QueryDoubleValue( &d );
1176 QueryFloatValue( &f );
1184 XMLError QueryIntValue(
int* value )
const;
1186 XMLError QueryUnsignedValue(
unsigned int* value )
const;
1188 XMLError QueryInt64Value(int64_t* value)
const;
1190 XMLError QueryBoolValue(
bool* value )
const;
1192 XMLError QueryDoubleValue(
double* value )
const;
1194 XMLError QueryFloatValue(
float* value )
const;
1197 void SetAttribute(
const char* value );
1199 void SetAttribute(
int value );
1201 void SetAttribute(
unsigned value );
1203 void SetAttribute(int64_t value);
1205 void SetAttribute(
bool value );
1207 void SetAttribute(
double value );
1209 void SetAttribute(
float value );
1212 enum { BUF_SIZE = 200 };
1214 XMLAttribute() : _parseLineNum( 0 ), _next( 0 ), _memPool( 0 ) {}
1219 void SetName(
const char* name );
1221 char* ParseDeep(
char* p,
bool processEntities,
int* curLineNumPtr );
1223 mutable StrPair _name;
1224 mutable StrPair _value;
1244 void SetName(
const char* str,
bool staticMem=
false ) {
1245 SetValue( str, staticMem );
1251 virtual const XMLElement* ToElement()
const {
1254 virtual bool Accept(
XMLVisitor* visitor )
const;
1279 const char* Attribute(
const char* name,
const char* value=0 )
const;
1287 int IntAttribute(
const char* name,
int defaultValue = 0)
const;
1289 unsigned UnsignedAttribute(
const char* name,
unsigned defaultValue = 0)
const;
1291 int64_t Int64Attribute(
const char* name, int64_t defaultValue = 0)
const;
1293 bool BoolAttribute(
const char* name,
bool defaultValue =
false)
const;
1295 double DoubleAttribute(
const char* name,
double defaultValue = 0)
const;
1297 float FloatAttribute(
const char* name,
float defaultValue = 0)
const;
1315 return XML_NO_ATTRIBUTE;
1324 return XML_NO_ATTRIBUTE;
1333 return XML_NO_ATTRIBUTE;
1342 return XML_NO_ATTRIBUTE;
1350 return XML_NO_ATTRIBUTE;
1358 return XML_NO_ATTRIBUTE;
1382 return QueryIntAttribute( name, value );
1385 int QueryAttribute(
const char* name,
unsigned int* value )
const {
1386 return QueryUnsignedAttribute( name, value );
1389 int QueryAttribute(
const char* name, int64_t* value)
const {
1390 return QueryInt64Attribute(name, value);
1393 int QueryAttribute(
const char* name,
bool* value )
const {
1394 return QueryBoolAttribute( name, value );
1397 int QueryAttribute(
const char* name,
double* value )
const {
1398 return QueryDoubleAttribute( name, value );
1401 int QueryAttribute(
const char* name,
float* value )
const {
1402 return QueryFloatAttribute( name, value );
1446 void DeleteAttribute(
const char* name );
1450 return _rootAttribute;
1453 const XMLAttribute* FindAttribute(
const char* name )
const;
1483 const char* GetText()
const;
1519 void SetText(
const char* inText );
1521 void SetText(
int value );
1523 void SetText(
unsigned value );
1525 void SetText(int64_t value);
1527 void SetText(
bool value );
1529 void SetText(
double value );
1531 void SetText(
float value );
1559 XMLError QueryIntText(
int* ival )
const;
1561 XMLError QueryUnsignedText(
unsigned* uval )
const;
1563 XMLError QueryInt64Text(int64_t* uval)
const;
1565 XMLError QueryBoolText(
bool* bval )
const;
1567 XMLError QueryDoubleText(
double* dval )
const;
1569 XMLError QueryFloatText(
float* fval )
const;
1571 int IntText(
int defaultValue = 0)
const;
1574 unsigned UnsignedText(
unsigned defaultValue = 0)
const;
1576 int64_t Int64Text(int64_t defaultValue = 0)
const;
1578 bool BoolText(
bool defaultValue =
false)
const;
1580 double DoubleText(
double defaultValue = 0)
const;
1582 float FloatText(
float defaultValue = 0)
const;
1585 enum ElementClosingType {
1590 ElementClosingType ClosingType()
const {
1591 return _closingType;
1594 virtual bool ShallowEqual(
const XMLNode* compare )
const;
1597 char* ParseDeep(
char* p, StrPair* parentEndTag,
int* curLineNumPtr );
1608 XMLAttribute* FindOrCreateAttribute(
const char* name );
1610 char* ParseAttributes(
char* p,
int* curLineNumPtr );
1611 static void DeleteAttribute(
XMLAttribute* attribute );
1614 enum { BUF_SIZE = 200 };
1615 ElementClosingType _closingType;
1624 PRESERVE_WHITESPACE,
1639 XMLDocument(
bool processEntities =
true, Whitespace whitespaceMode = PRESERVE_WHITESPACE );
1643 TIXMLASSERT(
this == _document );
1647 TIXMLASSERT(
this == _document );
1661 XMLError Parse(
const char* xml,
size_t nBytes=(
size_t)(-1) );
1668 XMLError LoadFile(
const char* filename );
1681 XMLError LoadFile( FILE* );
1688 XMLError SaveFile(
const char* filename,
bool compact =
false );
1697 XMLError SaveFile( FILE* fp,
bool compact =
false );
1699 bool ProcessEntities()
const {
1700 return _processEntities;
1702 Whitespace WhitespaceMode()
const {
1703 return _whitespaceMode;
1722 return FirstChildElement();
1725 return FirstChildElement();
1743 virtual bool Accept(
XMLVisitor* visitor )
const;
1756 XMLComment* NewComment(
const char* comment );
1762 XMLText* NewText(
const char* text );
1786 void DeleteNode(
XMLNode* node );
1788 void SetError( XMLError error,
const char* str1,
const char* str2,
int lineNum );
1791 SetError(XML_SUCCESS, 0, 0, 0);
1796 return _errorID != XML_SUCCESS;
1802 const char* ErrorName()
const;
1803 static const char* ErrorIDToName(XMLError errorID);
1806 const char* GetErrorStr1()
const;
1809 const char* GetErrorStr2()
const;
1814 return _errorLineNum;
1817 void PrintError()
const;
1832 char* Identify(
char* p,
XMLNode** node );
1849 bool _processEntities;
1851 Whitespace _whitespaceMode;
1852 mutable StrPair _errorStr1;
1853 mutable StrPair _errorStr2;
1856 int _parseCurLineNum;
1863 DynArray<XMLNode*, 10> _unlinked;
1865 MemPoolT< sizeof(XMLElement) > _elementPool;
1866 MemPoolT< sizeof(XMLAttribute) > _attributePool;
1867 MemPoolT< sizeof(XMLText) > _textPool;
1868 MemPoolT< sizeof(XMLComment) > _commentPool;
1870 static const char* _errorNames[XML_ERROR_COUNT];
1874 template<
class NodeType,
int PoolElementSize>
1875 NodeType* CreateUnlinkedNode( MemPoolT<PoolElementSize>& pool );
1878 template<
class NodeType,
int PoolElementSize>
1879 inline NodeType* XMLDocument::CreateUnlinkedNode( MemPoolT<PoolElementSize>& pool )
1881 TIXMLASSERT(
sizeof( NodeType ) == PoolElementSize );
1882 TIXMLASSERT(
sizeof( NodeType ) == pool.ItemSize() );
1883 NodeType* returnNode =
new (pool.Alloc()) NodeType(
this );
1884 TIXMLASSERT( returnNode );
1885 returnNode->_memPool = &pool;
1887 _unlinked.Push(returnNode);
1969 return XMLHandle( _node ? _node->FirstChild() : 0 );
1973 return XMLHandle( _node ? _node->FirstChildElement( name ) : 0 );
1977 return XMLHandle( _node ? _node->LastChild() : 0 );
1981 return XMLHandle( _node ? _node->LastChildElement( name ) : 0 );
1985 return XMLHandle( _node ? _node->PreviousSibling() : 0 );
1989 return XMLHandle( _node ? _node->PreviousSiblingElement( name ) : 0 );
1993 return XMLHandle( _node ? _node->NextSibling() : 0 );
1997 return XMLHandle( _node ? _node->NextSiblingElement( name ) : 0 );
2006 return ( _node ? _node->ToElement() : 0 );
2010 return ( _node ? _node->ToText() : 0 );
2014 return ( _node ? _node->ToUnknown() : 0 );
2018 return ( _node ? _node->ToDeclaration() : 0 );
2051 const XMLConstHandle FirstChildElement(
const char* name = 0 )
const {
2052 return XMLConstHandle( _node ? _node->FirstChildElement( name ) : 0 );
2057 const XMLConstHandle LastChildElement(
const char* name = 0 )
const {
2058 return XMLConstHandle( _node ? _node->LastChildElement( name ) : 0 );
2063 const XMLConstHandle PreviousSiblingElement(
const char* name = 0 )
const {
2064 return XMLConstHandle( _node ? _node->PreviousSiblingElement( name ) : 0 );
2069 const XMLConstHandle NextSiblingElement(
const char* name = 0 )
const {
2070 return XMLConstHandle( _node ? _node->NextSiblingElement( name ) : 0 );
2074 const XMLNode* ToNode()
const {
2078 return ( _node ? _node->ToElement() : 0 );
2080 const XMLText* ToText()
const {
2081 return ( _node ? _node->ToText() : 0 );
2084 return ( _node ? _node->ToUnknown() : 0 );
2087 return ( _node ? _node->ToDeclaration() : 0 );
2146 XMLPrinter( FILE* file=0,
bool compact =
false,
int depth = 0 );
2150 void PushHeader(
bool writeBOM,
bool writeDeclaration );
2154 void OpenElement(
const char* name,
bool compactMode=
false );
2156 void PushAttribute(
const char* name,
const char* value );
2157 void PushAttribute(
const char* name,
int value );
2158 void PushAttribute(
const char* name,
unsigned value );
2159 void PushAttribute(
const char* name, int64_t value);
2160 void PushAttribute(
const char* name,
bool value );
2161 void PushAttribute(
const char* name,
double value );
2163 virtual void CloseElement(
bool compactMode=
false );
2166 void PushText(
const char* text,
bool cdata=
false );
2168 void PushText(
int value );
2170 void PushText(
unsigned value );
2172 void PushText(int64_t value);
2174 void PushText(
bool value );
2176 void PushText(
float value );
2178 void PushText(
double value );
2181 void PushComment(
const char* comment );
2183 void PushDeclaration(
const char* value );
2184 void PushUnknown(
const char* value );
2192 virtual bool VisitExit(
const XMLElement& element );
2194 virtual bool Visit(
const XMLText& text );
2195 virtual bool Visit(
const XMLComment& comment );
2197 virtual bool Visit(
const XMLUnknown& unknown );
2204 return _buffer.Mem();
2212 return _buffer.Size();
2221 _firstElement =
true;
2225 virtual bool CompactMode(
const XMLElement& ) {
return _compactMode; }
2230 virtual void PrintSpace(
int depth );
2231 void Print(
const char* format, ... );
2233 void SealElementIfJustOpened();
2234 bool _elementJustOpened;
2235 DynArray< const char*, 10 > _stack;
2238 void PrintString(
const char*,
bool restrictedEntitySet );
2244 bool _processEntities;
2251 bool _entityFlag[ENTITY_RANGE];
2252 bool _restrictedEntityFlag[ENTITY_RANGE];
2254 DynArray< char, 20 > _buffer;
2260 #if defined(_MSC_VER) 2261 # pragma warning(pop) 2264 #endif // TINYXML2_INCLUDED XMLError QueryInt64Attribute(const char *name, int64_t *value) const
See QueryIntAttribute()
Definition: tinyxml2.h:1330
XMLError QueryIntValue(int *value) const
XMLError QueryBoolAttribute(const char *name, bool *value) const
See QueryIntAttribute()
Definition: tinyxml2.h:1339
virtual bool VisitExit(const XMLDocument &)
Visit a document.
Definition: tinyxml2.h:477
virtual XMLNode * ShallowClone(XMLDocument *) const
Definition: tinyxml2.h:1837
virtual bool ShallowEqual(const XMLNode *) const
Definition: tinyxml2.h:1840
XMLHandle FirstChildElement(const char *name=0)
Get the first child element of this handle.
Definition: tinyxml2.h:1972
XMLText * ToText()
Safe cast to XMLText. This can return null.
Definition: tinyxml2.h:2009
XMLError QueryFloatValue(float *value) const
See QueryIntValue.
const char * CStr() const
Definition: tinyxml2.h:2203
XMLError ErrorID() const
Return the errorID.
Definition: tinyxml2.h:1799
XMLElement * ToElement()
Safe cast to XMLElement. This can return null.
Definition: tinyxml2.h:2005
virtual XMLElement * ToElement()
Safely cast to an Element, or null.
Definition: tinyxml2.h:673
virtual XMLText * ToText()
Safely cast to Text, or null.
Definition: tinyxml2.h:677
XMLError QueryUnsignedAttribute(const char *name, unsigned int *value) const
See QueryIntAttribute()
Definition: tinyxml2.h:1321
int CStrSize() const
Definition: tinyxml2.h:2211
float FloatValue() const
Query as a float. See IntValue()
Definition: tinyxml2.h:1174
virtual XMLDocument * ToDocument()
Safely cast to a Document, or null.
Definition: tinyxml2.h:1642
XMLUnknown * ToUnknown()
Safe cast to XMLUnknown. This can return null.
Definition: tinyxml2.h:2013
const char * Name() const
Get the name of an element (which is the Value() of the node.)
Definition: tinyxml2.h:1240
XMLHandle(const XMLHandle &ref)
Copy constructor.
Definition: tinyxml2.h:1958
XMLHandle FirstChild()
Get the first child of this handle.
Definition: tinyxml2.h:1968
void SetCData(bool isCData)
Declare whether this should be CDATA or standard text.
Definition: tinyxml2.h:986
void SetUserData(void *userData)
Definition: tinyxml2.h:920
const XMLNode * NextSibling() const
Get the next (right) sibling node of this node.
Definition: tinyxml2.h:802
unsigned UnsignedValue() const
Query as an unsigned integer. See IntValue()
Definition: tinyxml2.h:1156
XMLHandle LastChildElement(const char *name=0)
Get the last child element of this handle.
Definition: tinyxml2.h:1980
XMLHandle LastChild()
Get the last child of this handle.
Definition: tinyxml2.h:1976
Definition: tinyxml2.h:1946
Definition: tinyxml2.h:1051
XMLElement * RootElement()
Definition: tinyxml2.h:1721
int QueryAttribute(const char *name, int *value) const
Definition: tinyxml2.h:1381
virtual XMLText * ToText()
Safely cast to Text, or null.
Definition: tinyxml2.h:978
XMLHandle(XMLNode &node)
Create a handle from a node.
Definition: tinyxml2.h:1954
void SetName(const char *str, bool staticMem=false)
Set the name of the element.
Definition: tinyxml2.h:1244
void SetBOM(bool useBOM)
Definition: tinyxml2.h:1714
XMLHandle(XMLNode *node)
Create a handle from any node (at any depth of the tree.) This can be a null pointer.
Definition: tinyxml2.h:1950
void ClearBuffer()
Definition: tinyxml2.h:2218
virtual XMLElement * ToElement()
Safely cast to an Element, or null.
Definition: tinyxml2.h:1248
bool HasBOM() const
Definition: tinyxml2.h:1709
Definition: tinyxml2.h:105
XMLError QueryFloatAttribute(const char *name, float *value) const
See QueryIntAttribute()
Definition: tinyxml2.h:1355
XMLError QueryUnsignedValue(unsigned int *value) const
See QueryIntValue.
XMLNode * ToNode()
Safe cast to XMLNode. This can return null.
Definition: tinyxml2.h:2001
bool BoolValue() const
Query as a boolean. See IntValue()
Definition: tinyxml2.h:1162
const XMLNode * FirstChild() const
Get the first child node, or null if none exists.
Definition: tinyxml2.h:750
virtual XMLDeclaration * ToDeclaration()
Safely cast to a Declaration, or null.
Definition: tinyxml2.h:1055
virtual bool Visit(const XMLDeclaration &)
Visit a declaration.
Definition: tinyxml2.h:491
virtual bool Visit(const XMLUnknown &)
Visit an unknown node.
Definition: tinyxml2.h:503
void SetAttribute(const char *name, unsigned value)
Sets the named attribute to value.
Definition: tinyxml2.h:1416
XMLError QueryDoubleAttribute(const char *name, double *value) const
See QueryIntAttribute()
Definition: tinyxml2.h:1347
Definition: tinyxml2.h:1235
XMLError QueryInt64Value(int64_t *value) const
See QueryIntValue.
XMLHandle NextSibling()
Get the next sibling of this handle.
Definition: tinyxml2.h:1992
int GetLineNum() const
Gets the line number the attribute is in, if the document was parsed from a file. ...
Definition: tinyxml2.h:1132
int IntValue() const
Definition: tinyxml2.h:1143
virtual XMLUnknown * ToUnknown()
Safely cast to an Unknown, or null.
Definition: tinyxml2.h:1090
bool CData() const
Returns true if this is a CDATA text element.
Definition: tinyxml2.h:990
XMLHandle PreviousSibling()
Get the previous sibling of this handle.
Definition: tinyxml2.h:1984
Definition: tinyxml2.h:2030
XMLHandle & operator=(const XMLHandle &ref)
Assignment.
Definition: tinyxml2.h:1962
virtual bool VisitExit(const XMLDocument &)
Visit a document.
Definition: tinyxml2.h:2187
virtual bool VisitEnter(const XMLElement &, const XMLAttribute *)
Visit an element.
Definition: tinyxml2.h:482
bool Error() const
Return true if there was an error parsing the document.
Definition: tinyxml2.h:1795
virtual bool VisitEnter(const XMLDocument &)
Visit a document.
Definition: tinyxml2.h:473
Definition: tinyxml2.h:1086
virtual XMLDocument * ToDocument()
Safely cast to a Document, or null.
Definition: tinyxml2.h:685
const XMLNode * LastChild() const
Get the last child node, or null if none exists.
Definition: tinyxml2.h:768
Definition: tinyxml2.h:1121
void SetAttribute(const char *name, bool value)
Sets the named attribute to value.
Definition: tinyxml2.h:1428
XMLDeclaration * ToDeclaration()
Safe cast to XMLDeclaration. This can return null.
Definition: tinyxml2.h:2017
void SetAttribute(const char *value)
Set the attribute to a string value.
void SetAttribute(const char *name, const char *value)
Sets the named attribute to value.
Definition: tinyxml2.h:1406
virtual bool VisitExit(const XMLElement &)
Visit an element.
Definition: tinyxml2.h:486
Definition: tinyxml2.h:2137
Definition: tinyxml2.h:1634
void * GetUserData() const
Definition: tinyxml2.h:927
int GetErrorLineNum() const
Return the line where the error occured, or zero if unknown.
Definition: tinyxml2.h:1812
void SetAttribute(const char *name, int64_t value)
Sets the named attribute to value.
Definition: tinyxml2.h:1422
void SetAttribute(const char *name, double value)
Sets the named attribute to value.
Definition: tinyxml2.h:1433
XMLError QueryDoubleValue(double *value) const
See QueryIntValue.
const XMLNode * Parent() const
Get the parent of this node on the DOM.
Definition: tinyxml2.h:736
virtual bool Visit(const XMLComment &)
Visit a comment node.
Definition: tinyxml2.h:499
XMLError QueryBoolValue(bool *value) const
See QueryIntValue.
const XMLNode * PreviousSibling() const
Get the previous (left) sibling node of this node.
Definition: tinyxml2.h:786
XMLHandle NextSiblingElement(const char *name=0)
Get the next sibling element of this handle.
Definition: tinyxml2.h:1996
Definition: tinyxml2.h:655
XMLError QueryIntAttribute(const char *name, int *value) const
Definition: tinyxml2.h:1312
int GetLineNum() const
Gets the line number the node is in, if the document was parsed from a file.
Definition: tinyxml2.h:733
virtual bool Visit(const XMLText &)
Visit a text node.
Definition: tinyxml2.h:495
Definition: tinyxml2.h:972
Definition: tinyxml2.h:467
XMLDocument * GetDocument()
Get the XMLDocument that owns this XMLNode.
Definition: tinyxml2.h:667
virtual XMLUnknown * ToUnknown()
Safely cast to an Unknown, or null.
Definition: tinyxml2.h:693
void SetAttribute(const char *name, float value)
Sets the named attribute to value.
Definition: tinyxml2.h:1438
const XMLAttribute * Next() const
The next attribute in the list.
Definition: tinyxml2.h:1135
bool NoChildren() const
Returns true if this node has no children.
Definition: tinyxml2.h:745
double DoubleValue() const
Query as a double. See IntValue()
Definition: tinyxml2.h:1168
virtual XMLDeclaration * ToDeclaration()
Safely cast to a Declaration, or null.
Definition: tinyxml2.h:689
const XMLDocument * GetDocument() const
Get the XMLDocument that owns this XMLNode.
Definition: tinyxml2.h:662
XMLHandle PreviousSiblingElement(const char *name=0)
Get the previous sibling element of this handle.
Definition: tinyxml2.h:1988
void SetAttribute(const char *name, int value)
Sets the named attribute to value.
Definition: tinyxml2.h:1411
const XMLAttribute * FirstAttribute() const
Return the first attribute in the list.
Definition: tinyxml2.h:1449
virtual XMLComment * ToComment()
Safely cast to a Comment, or null.
Definition: tinyxml2.h:681