24 #ifndef TINYXML2_INCLUDED
25 #define TINYXML2_INCLUDED
27 #if defined(ANDROID_NDK) || defined(__BORLANDC__) || defined(__QNXNTO__)
52 #if defined( _DEBUG ) || defined( DEBUG ) || defined (__DEBUG__)
59 # pragma warning(push)
60 # pragma warning(disable: 4251)
64 # ifdef TINYXML2_EXPORT
65 # define TINYXML2_LIB __declspec(dllexport)
66 # elif defined(TINYXML2_IMPORT)
67 # define TINYXML2_LIB __declspec(dllimport)
77 # if defined(_MSC_VER)
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__ ); }
85 # define TIXMLASSERT assert
88 # define TIXMLASSERT( x ) {}
95 static const int TIXML2_MAJOR_VERSION = 3;
96 static const int TIXML2_MINOR_VERSION = 0;
97 static const int TIXML2_PATCH_VERSION = 0;
106 class XMLDeclaration;
120 NEEDS_ENTITY_PROCESSING = 0x01,
121 NEEDS_NEWLINE_NORMALIZATION = 0x02,
122 NEEDS_WHITESPACE_COLLAPSING = 0x04,
124 TEXT_ELEMENT = NEEDS_ENTITY_PROCESSING | NEEDS_NEWLINE_NORMALIZATION,
125 TEXT_ELEMENT_LEAVE_ENTITIES = NEEDS_NEWLINE_NORMALIZATION,
127 ATTRIBUTE_VALUE = NEEDS_ENTITY_PROCESSING | NEEDS_NEWLINE_NORMALIZATION,
128 ATTRIBUTE_VALUE_LEAVE_ENTITIES = NEEDS_NEWLINE_NORMALIZATION,
129 COMMENT = NEEDS_NEWLINE_NORMALIZATION
132 StrPair() : _flags( 0 ), _start( 0 ), _end( 0 ) {}
135 void Set(
char* start,
char* end,
int flags ) {
139 _flags = flags | NEEDS_FLUSH;
142 const char* GetStr();
145 return _start == _end;
148 void SetInternedStr(
const char* str ) {
150 _start =
const_cast<char*
>(str);
153 void SetStr(
const char* str,
int flags=0 );
155 char* ParseText(
char* in,
const char* endTag,
int strFlags );
156 char* ParseName(
char* in );
158 void TransferTo(
StrPair* other );
162 void CollapseWhitespace();
175 void operator=(
StrPair& other );
184 template <
class T,
int INITIAL_SIZE>
190 _allocated = INITIAL_SIZE;
195 if ( _mem != _pool ) {
205 TIXMLASSERT( _size < INT_MAX );
206 EnsureCapacity( _size+1 );
210 T* PushArr(
int count ) {
211 TIXMLASSERT( count >= 0 );
212 TIXMLASSERT( _size <= INT_MAX - count );
213 EnsureCapacity( _size+count );
214 T* ret = &_mem[_size];
220 TIXMLASSERT( _size > 0 );
221 return _mem[--_size];
224 void PopArr(
int count ) {
225 TIXMLASSERT( _size >= count );
233 T& operator[](
int i) {
234 TIXMLASSERT( i>= 0 && i < _size );
238 const T& operator[](
int i)
const {
239 TIXMLASSERT( i>= 0 && i < _size );
243 const T& PeekTop()
const {
244 TIXMLASSERT( _size > 0 );
245 return _mem[ _size - 1];
249 TIXMLASSERT( _size >= 0 );
253 int Capacity()
const {
254 TIXMLASSERT( _allocated >= INITIAL_SIZE );
258 const T* Mem()
const {
272 void EnsureCapacity(
int cap ) {
273 TIXMLASSERT( cap > 0 );
274 if ( cap > _allocated ) {
275 TIXMLASSERT( cap <= INT_MAX / 2 );
276 int newAllocated = cap * 2;
277 T* newMem =
new T[newAllocated];
278 memcpy( newMem, _mem,
sizeof(T)*_size );
279 if ( _mem != _pool ) {
283 _allocated = newAllocated;
288 T _pool[INITIAL_SIZE];
304 virtual int ItemSize()
const = 0;
305 virtual void* Alloc() = 0;
306 virtual void Free(
void* ) = 0;
307 virtual void SetTracked() = 0;
308 virtual void Clear() = 0;
319 MemPoolT() : _root(0), _currentAllocs(0), _nAllocs(0), _maxAllocs(0), _nUntracked(0) {}
326 while( !_blockPtrs.Empty()) {
327 Block* b = _blockPtrs.Pop();
337 virtual int ItemSize()
const {
340 int CurrentAllocs()
const {
341 return _currentAllocs;
344 virtual void* Alloc() {
347 Block* block =
new Block();
348 _blockPtrs.Push( block );
350 for(
int i=0; i<COUNT-1; ++i ) {
351 block->chunk[i].next = &block->chunk[i+1];
353 block->chunk[COUNT-1].next = 0;
354 _root = block->chunk;
356 void* result = _root;
360 if ( _currentAllocs > _maxAllocs ) {
361 _maxAllocs = _currentAllocs;
368 virtual void Free(
void* mem ) {
373 Chunk* chunk =
static_cast<Chunk*
>( mem );
375 memset( chunk, 0xfe,
sizeof(Chunk) );
380 void Trace(
const char* name ) {
381 printf(
"Mempool %s watermark=%d [%dk] current=%d size=%d nAlloc=%d blocks=%d\n",
382 name, _maxAllocs, _maxAllocs*SIZE/1024, _currentAllocs, SIZE, _nAllocs, _blockPtrs.Size() );
389 int Untracked()
const {
402 enum { COUNT = (4*1024)/SIZE };
491 XML_WRONG_ATTRIBUTE_TYPE,
492 XML_ERROR_FILE_NOT_FOUND,
493 XML_ERROR_FILE_COULD_NOT_BE_OPENED,
494 XML_ERROR_FILE_READ_ERROR,
495 XML_ERROR_ELEMENT_MISMATCH,
496 XML_ERROR_PARSING_ELEMENT,
497 XML_ERROR_PARSING_ATTRIBUTE,
498 XML_ERROR_IDENTIFYING_TAG,
499 XML_ERROR_PARSING_TEXT,
500 XML_ERROR_PARSING_CDATA,
501 XML_ERROR_PARSING_COMMENT,
502 XML_ERROR_PARSING_DECLARATION,
503 XML_ERROR_PARSING_UNKNOWN,
504 XML_ERROR_EMPTY_DOCUMENT,
505 XML_ERROR_MISMATCHED_ELEMENT,
507 XML_CAN_NOT_CONVERT_TEXT,
520 static const char* SkipWhiteSpace(
const char* p ) {
522 while( IsWhiteSpace(*p) ) {
528 static char* SkipWhiteSpace(
char* p ) {
529 return const_cast<char*
>( SkipWhiteSpace(
const_cast<const char*
>(p) ) );
534 static bool IsWhiteSpace(
char p ) {
535 return !IsUTF8Continuation(p) && isspace(
static_cast<unsigned char>(p) );
538 inline static bool IsNameStartChar(
unsigned char ch ) {
543 if ( isalpha( ch ) ) {
546 return ch ==
':' || ch ==
'_';
549 inline static bool IsNameChar(
unsigned char ch ) {
550 return IsNameStartChar( ch )
556 inline static bool StringEqual(
const char* p,
const char* q,
int nChar=INT_MAX ) {
561 while( *p && *q && *p == *q && n<nChar ) {
566 if ( (n == nChar) || ( *p == 0 && *q == 0 ) ) {
572 inline static bool IsUTF8Continuation(
char p ) {
573 return ( p & 0x80 ) != 0;
576 static const char* ReadBOM(
const char* p,
bool* hasBOM );
579 static const char* GetCharacterRef(
const char* p,
char* value,
int* length );
580 static void ConvertUTF32ToUTF8(
unsigned long input,
char* output,
int* length );
583 static void ToStr(
int v,
char* buffer,
int bufferSize );
584 static void ToStr(
unsigned v,
char* buffer,
int bufferSize );
585 static void ToStr(
bool v,
char* buffer,
int bufferSize );
586 static void ToStr(
float v,
char* buffer,
int bufferSize );
587 static void ToStr(
double v,
char* buffer,
int bufferSize );
590 static bool ToInt(
const char* str,
int* value );
591 static bool ToUnsigned(
const char* str,
unsigned* value );
592 static bool ToBool(
const char* str,
bool* value );
593 static bool ToFloat(
const char* str,
float* value );
594 static bool ToDouble(
const char* str,
double* value );
631 TIXMLASSERT( _document );
636 TIXMLASSERT( _document );
668 virtual const XMLText* ToText()
const {
671 virtual const XMLComment* ToComment()
const {
674 virtual const XMLDocument* ToDocument()
const {
677 virtual const XMLDeclaration* ToDeclaration()
const {
680 virtual const XMLUnknown* ToUnknown()
const {
693 const char* Value()
const;
698 void SetValue(
const char* val,
bool staticMem=
false );
726 const XMLElement* FirstChildElement(
const char* name = 0 )
const;
728 XMLElement* FirstChildElement(
const char* name = 0 ) {
729 return const_cast<XMLElement*
>(
const_cast<const XMLNode*
>(
this)->FirstChildElement( name ));
744 const XMLElement* LastChildElement(
const char* name = 0 )
const;
746 XMLElement* LastChildElement(
const char* name = 0 ) {
747 return const_cast<XMLElement*
>(
const_cast<const XMLNode*
>(
this)->LastChildElement(name) );
760 const XMLElement* PreviousSiblingElement(
const char* name = 0 )
const ;
762 XMLElement* PreviousSiblingElement(
const char* name = 0 ) {
763 return const_cast<XMLElement*
>(
const_cast<const XMLNode*
>(
this)->PreviousSiblingElement( name ) );
776 const XMLElement* NextSiblingElement(
const char* name = 0 )
const;
778 XMLElement* NextSiblingElement(
const char* name = 0 ) {
779 return const_cast<XMLElement*
>(
const_cast<const XMLNode*
>(
this)->NextSiblingElement( name ) );
789 XMLNode* InsertEndChild( XMLNode* addThis );
791 XMLNode* LinkEndChild( XMLNode* addThis ) {
792 return InsertEndChild( addThis );
801 XMLNode* InsertFirstChild( XMLNode* addThis );
810 XMLNode* InsertAfterChild( XMLNode* afterThis, XMLNode* addThis );
815 void DeleteChildren();
820 void DeleteChild( XMLNode* node );
869 virtual char* ParseDeep(
char*,
StrPair* );
884 static void DeleteNode(
XMLNode* node );
885 void InsertChildPreamble(
XMLNode* insertThis )
const;
906 friend class XMLBase;
909 virtual bool Accept(
XMLVisitor* visitor )
const;
914 virtual const XMLText* ToText()
const {
928 virtual bool ShallowEqual(
const XMLNode* compare )
const;
932 virtual ~XMLText() {}
934 char* ParseDeep(
char*, StrPair* endTag );
939 XMLText(
const XMLText& );
940 XMLText& operator=(
const XMLText& );
956 virtual bool Accept( XMLVisitor* visitor )
const;
958 virtual XMLNode* ShallowClone( XMLDocument* document )
const;
959 virtual bool ShallowEqual(
const XMLNode* compare )
const;
962 XMLComment( XMLDocument* doc );
963 virtual ~XMLComment();
965 char* ParseDeep(
char*, StrPair* endTag );
968 XMLComment(
const XMLComment& );
969 XMLComment& operator=(
const XMLComment& );
995 virtual bool Accept( XMLVisitor* visitor )
const;
997 virtual XMLNode* ShallowClone( XMLDocument* document )
const;
998 virtual bool ShallowEqual(
const XMLNode* compare )
const;
1001 XMLDeclaration( XMLDocument* doc );
1002 virtual ~XMLDeclaration();
1004 char* ParseDeep(
char*, StrPair* endTag );
1007 XMLDeclaration(
const XMLDeclaration& );
1008 XMLDeclaration& operator=(
const XMLDeclaration& );
1026 virtual const XMLUnknown* ToUnknown()
const {
1030 virtual bool Accept( XMLVisitor* visitor )
const;
1032 virtual XMLNode* ShallowClone( XMLDocument* document )
const;
1033 virtual bool ShallowEqual(
const XMLNode* compare )
const;
1036 XMLUnknown( XMLDocument* doc );
1037 virtual ~XMLUnknown();
1039 char* ParseDeep(
char*, StrPair* endTag );
1042 XMLUnknown(
const XMLUnknown& );
1043 XMLUnknown& operator=(
const XMLUnknown& );
1059 const char* Name()
const;
1062 const char* Value()
const;
1075 QueryIntValue( &i );
1081 QueryUnsignedValue( &i );
1087 QueryBoolValue( &b );
1093 QueryDoubleValue( &d );
1099 QueryFloatValue( &f );
1107 XMLError QueryIntValue(
int* value )
const;
1109 XMLError QueryUnsignedValue(
unsigned int* value )
const;
1111 XMLError QueryBoolValue(
bool* value )
const;
1113 XMLError QueryDoubleValue(
double* value )
const;
1115 XMLError QueryFloatValue(
float* value )
const;
1118 void SetAttribute(
const char* value );
1120 void SetAttribute(
int value );
1122 void SetAttribute(
unsigned value );
1124 void SetAttribute(
bool value );
1126 void SetAttribute(
double value );
1128 void SetAttribute(
float value );
1131 enum { BUF_SIZE = 200 };
1133 XMLAttribute() : _next( 0 ), _memPool( 0 ) {}
1134 virtual ~XMLAttribute() {}
1136 XMLAttribute(
const XMLAttribute& );
1137 void operator=(
const XMLAttribute& );
1138 void SetName(
const char* name );
1140 char* ParseDeep(
char* p,
bool processEntities );
1142 mutable StrPair _name;
1143 mutable StrPair _value;
1144 XMLAttribute* _next;
1155 friend class XMLBase;
1163 void SetName(
const char* str,
bool staticMem=
false ) {
1164 SetValue( str, staticMem );
1170 virtual const XMLElement* ToElement()
const {
1173 virtual bool Accept( XMLVisitor* visitor )
const;
1198 const char* Attribute(
const char* name,
const char* value=0 )
const;
1207 QueryIntAttribute( name, &i );
1213 QueryUnsignedAttribute( name, &i );
1219 QueryBoolAttribute( name, &b );
1225 QueryDoubleAttribute( name, &d );
1231 QueryFloatAttribute( name, &f );
1251 return XML_NO_ATTRIBUTE;
1259 return XML_NO_ATTRIBUTE;
1267 return XML_NO_ATTRIBUTE;
1275 return XML_NO_ATTRIBUTE;
1283 return XML_NO_ATTRIBUTE;
1307 return QueryIntAttribute( name, value );
1310 int QueryAttribute(
const char* name,
unsigned int* value )
const {
1311 return QueryUnsignedAttribute( name, value );
1314 int QueryAttribute(
const char* name,
bool* value )
const {
1315 return QueryBoolAttribute( name, value );
1318 int QueryAttribute(
const char* name,
double* value )
const {
1319 return QueryDoubleAttribute( name, value );
1322 int QueryAttribute(
const char* name,
float* value )
const {
1323 return QueryFloatAttribute( name, value );
1360 void DeleteAttribute(
const char* name );
1364 return _rootAttribute;
1367 const XMLAttribute* FindAttribute(
const char* name )
const;
1397 const char* GetText()
const;
1433 void SetText(
const char* inText );
1435 void SetText(
int value );
1437 void SetText(
unsigned value );
1439 void SetText(
bool value );
1441 void SetText(
double value );
1443 void SetText(
float value );
1471 XMLError QueryIntText(
int* ival )
const;
1473 XMLError QueryUnsignedText(
unsigned* uval )
const;
1475 XMLError QueryBoolText(
bool* bval )
const;
1477 XMLError QueryDoubleText(
double* dval )
const;
1479 XMLError QueryFloatText(
float* fval )
const;
1487 int ClosingType()
const {
1488 return _closingType;
1490 virtual XMLNode* ShallowClone( XMLDocument* document )
const;
1491 virtual bool ShallowEqual(
const XMLNode* compare )
const;
1494 char* ParseDeep(
char* p, StrPair* endTag );
1497 XMLElement( XMLDocument* doc );
1498 virtual ~XMLElement();
1499 XMLElement(
const XMLElement& );
1500 void operator=(
const XMLElement& );
1502 XMLAttribute* FindAttribute(
const char* name ) {
1503 return const_cast<XMLAttribute*
>(
const_cast<const XMLElement*
>(
this)->FindAttribute( name ));
1505 XMLAttribute* FindOrCreateAttribute(
const char* name );
1507 char* ParseAttributes(
char* p );
1508 static void DeleteAttribute( XMLAttribute* attribute );
1510 enum { BUF_SIZE = 200 };
1515 XMLAttribute* _rootAttribute;
1520 PRESERVE_WHITESPACE,
1535 XMLDocument(
bool processEntities =
true, Whitespace = PRESERVE_WHITESPACE );
1539 TIXMLASSERT(
this == _document );
1543 TIXMLASSERT(
this == _document );
1557 XMLError Parse(
const char* xml,
size_t nBytes=(
size_t)(-1) );
1564 XMLError LoadFile(
const char* filename );
1577 XMLError LoadFile( FILE* );
1584 XMLError SaveFile(
const char* filename,
bool compact =
false );
1593 XMLError SaveFile( FILE* fp,
bool compact =
false );
1595 bool ProcessEntities()
const {
1596 return _processEntities;
1598 Whitespace WhitespaceMode()
const {
1618 return FirstChildElement();
1621 return FirstChildElement();
1638 void Print( XMLPrinter* streamer=0 )
const;
1639 virtual bool Accept( XMLVisitor* visitor )
const;
1646 XMLElement* NewElement(
const char* name );
1652 XMLComment* NewComment(
const char* comment );
1658 XMLText* NewText(
const char* text );
1670 XMLDeclaration* NewDeclaration(
const char* text=0 );
1676 XMLUnknown* NewUnknown(
const char* text );
1682 void DeleteNode( XMLNode* node );
1684 void SetError( XMLError error,
const char* str1,
const char* str2 );
1688 return _errorID != XML_NO_ERROR;
1694 const char* ErrorName()
const;
1705 void PrintError()
const;
1711 char* Identify(
char* p,
XMLNode** node );
1725 bool _processEntities;
1727 Whitespace _whitespace;
1728 const char* _errorStr1;
1729 const char* _errorStr2;
1737 static const char* _errorNames[XML_ERROR_COUNT];
1821 return XMLHandle( _node ? _node->FirstChild() : 0 );
1825 return XMLHandle( _node ? _node->FirstChildElement( name ) : 0 );
1829 return XMLHandle( _node ? _node->LastChild() : 0 );
1833 return XMLHandle( _node ? _node->LastChildElement( name ) : 0 );
1837 return XMLHandle( _node ? _node->PreviousSibling() : 0 );
1841 return XMLHandle( _node ? _node->PreviousSiblingElement( name ) : 0 );
1845 return XMLHandle( _node ? _node->NextSibling() : 0 );
1849 return XMLHandle( _node ? _node->NextSiblingElement( name ) : 0 );
1858 return ( ( _node == 0 ) ? 0 : _node->ToElement() );
1862 return ( ( _node == 0 ) ? 0 : _node->ToText() );
1866 return ( ( _node == 0 ) ? 0 : _node->ToUnknown() );
1870 return ( ( _node == 0 ) ? 0 : _node->ToDeclaration() );
1903 const XMLConstHandle FirstChildElement(
const char* name = 0 )
const {
1904 return XMLConstHandle( _node ? _node->FirstChildElement( name ) : 0 );
1909 const XMLConstHandle LastChildElement(
const char* name = 0 )
const {
1910 return XMLConstHandle( _node ? _node->LastChildElement( name ) : 0 );
1915 const XMLConstHandle PreviousSiblingElement(
const char* name = 0 )
const {
1916 return XMLConstHandle( _node ? _node->PreviousSiblingElement( name ) : 0 );
1921 const XMLConstHandle NextSiblingElement(
const char* name = 0 )
const {
1922 return XMLConstHandle( _node ? _node->NextSiblingElement( name ) : 0 );
1926 const XMLNode* ToNode()
const {
1930 return ( ( _node == 0 ) ? 0 : _node->ToElement() );
1932 const XMLText* ToText()
const {
1933 return ( ( _node == 0 ) ? 0 : _node->ToText() );
1936 return ( ( _node == 0 ) ? 0 : _node->ToUnknown() );
1939 return ( ( _node == 0 ) ? 0 : _node->ToDeclaration() );
1998 XMLPrinter( FILE* file=0,
bool compact =
false,
int depth = 0 );
2002 void PushHeader(
bool writeBOM,
bool writeDeclaration );
2006 void OpenElement(
const char* name,
bool compactMode=
false );
2008 void PushAttribute(
const char* name,
const char* value );
2009 void PushAttribute(
const char* name,
int value );
2010 void PushAttribute(
const char* name,
unsigned value );
2011 void PushAttribute(
const char* name,
bool value );
2012 void PushAttribute(
const char* name,
double value );
2014 virtual void CloseElement(
bool compactMode=
false );
2017 void PushText(
const char* text,
bool cdata=
false );
2019 void PushText(
int value );
2021 void PushText(
unsigned value );
2023 void PushText(
bool value );
2025 void PushText(
float value );
2027 void PushText(
double value );
2030 void PushComment(
const char* comment );
2032 void PushDeclaration(
const char* value );
2033 void PushUnknown(
const char* value );
2041 virtual bool VisitExit(
const XMLElement& element );
2043 virtual bool Visit(
const XMLText& text );
2044 virtual bool Visit(
const XMLComment& comment );
2046 virtual bool Visit(
const XMLUnknown& unknown );
2053 return _buffer.Mem();
2061 return _buffer.Size();
2073 virtual bool CompactMode(
const XMLElement& ) {
return _compactMode; }
2078 virtual void PrintSpace(
int depth );
2079 void Print(
const char* format, ... );
2081 void SealElementIfJustOpened();
2082 bool _elementJustOpened;
2083 DynArray< const char*, 10 > _stack;
2086 void PrintString(
const char*,
bool restrictedEntitySet );
2092 bool _processEntities;
2099 bool _entityFlag[ENTITY_RANGE];
2100 bool _restrictedEntityFlag[ENTITY_RANGE];
2108 #if defined(_MSC_VER)
2109 # pragma warning(pop)
Definition: tinyxml2.h:186
Definition: tinyxml2.h:317
Definition: tinyxml2.h:299
Definition: tinyxml2.h:117
Definition: tinyxml2.h:1055
XMLError QueryFloatValue(float *value) const
See QueryIntValue.
Definition: tinyxml2.cpp:1311
unsigned UnsignedValue() const
Query as an unsigned integer. See IntValue()
Definition: tinyxml2.h:1079
float FloatValue() const
Query as a float. See IntValue()
Definition: tinyxml2.h:1097
XMLError QueryDoubleValue(double *value) const
See QueryIntValue.
Definition: tinyxml2.cpp:1320
void SetAttribute(const char *value)
Set the attribute to a string value.
Definition: tinyxml2.cpp:1329
XMLError QueryUnsignedValue(unsigned int *value) const
See QueryIntValue.
Definition: tinyxml2.cpp:1293
double DoubleValue() const
Query as a double. See IntValue()
Definition: tinyxml2.h:1091
XMLError QueryBoolValue(bool *value) const
See QueryIntValue.
Definition: tinyxml2.cpp:1302
XMLError QueryIntValue(int *value) const
Definition: tinyxml2.cpp:1284
bool BoolValue() const
Query as a boolean. See IntValue()
Definition: tinyxml2.h:1085
int IntValue() const
Definition: tinyxml2.h:1073
const XMLAttribute * Next() const
The next attribute in the list.
Definition: tinyxml2.h:1065
Definition: tinyxml2.h:1883
Definition: tinyxml2.h:985
virtual XMLDeclaration * ToDeclaration()
Safely cast to a Declaration, or null.
Definition: tinyxml2.h:988
Definition: tinyxml2.h:1531
void SetBOM(bool useBOM)
Definition: tinyxml2.h:1610
const char * GetErrorStr1() const
Return a possibly helpful diagnostic location or string.
Definition: tinyxml2.h:1697
const char * GetErrorStr2() const
Return a possibly helpful secondary diagnostic location or string.
Definition: tinyxml2.h:1701
bool HasBOM() const
Definition: tinyxml2.h:1605
bool Error() const
Return true if there was an error parsing the document.
Definition: tinyxml2.h:1687
virtual XMLDocument * ToDocument()
Safely cast to a Document, or null.
Definition: tinyxml2.h:1538
virtual bool ShallowEqual(const XMLNode *) const
Definition: tinyxml2.h:1716
virtual XMLNode * ShallowClone(XMLDocument *) const
Definition: tinyxml2.h:1713
XMLElement * RootElement()
Definition: tinyxml2.h:1617
XMLError ErrorID() const
Return the errorID.
Definition: tinyxml2.h:1691
Definition: tinyxml2.h:1154
int QueryAttribute(const char *name, int *value) const
Definition: tinyxml2.h:1306
bool BoolAttribute(const char *name) const
See IntAttribute()
Definition: tinyxml2.h:1217
void SetAttribute(const char *name, const char *value)
Sets the named attribute to value.
Definition: tinyxml2.h:1327
XMLError QueryBoolAttribute(const char *name, bool *value) const
See QueryIntAttribute()
Definition: tinyxml2.h:1264
void SetAttribute(const char *name, double value)
Sets the named attribute to value.
Definition: tinyxml2.h:1347
XMLError QueryUnsignedAttribute(const char *name, unsigned int *value) const
See QueryIntAttribute()
Definition: tinyxml2.h:1256
unsigned UnsignedAttribute(const char *name) const
See IntAttribute()
Definition: tinyxml2.h:1211
const XMLAttribute * FirstAttribute() const
Return the first attribute in the list.
Definition: tinyxml2.h:1363
void SetAttribute(const char *name, float value)
Sets the named attribute to value.
Definition: tinyxml2.h:1352
XMLError QueryDoubleAttribute(const char *name, double *value) const
See QueryIntAttribute()
Definition: tinyxml2.h:1272
const char * Name() const
Get the name of an element (which is the Value() of the node.)
Definition: tinyxml2.h:1159
float FloatAttribute(const char *name) const
See IntAttribute()
Definition: tinyxml2.h:1229
double DoubleAttribute(const char *name) const
See IntAttribute()
Definition: tinyxml2.h:1223
XMLError QueryIntAttribute(const char *name, int *value) const
Definition: tinyxml2.h:1248
void SetName(const char *str, bool staticMem=false)
Set the name of the element.
Definition: tinyxml2.h:1163
void SetAttribute(const char *name, bool value)
Sets the named attribute to value.
Definition: tinyxml2.h:1342
void SetAttribute(const char *name, int value)
Sets the named attribute to value.
Definition: tinyxml2.h:1332
XMLError QueryFloatAttribute(const char *name, float *value) const
See QueryIntAttribute()
Definition: tinyxml2.h:1280
int IntAttribute(const char *name) const
Definition: tinyxml2.h:1205
virtual XMLElement * ToElement()
Safely cast to an Element, or null.
Definition: tinyxml2.h:1167
void SetAttribute(const char *name, unsigned value)
Sets the named attribute to value.
Definition: tinyxml2.h:1337
Definition: tinyxml2.h:1799
XMLNode * ToNode()
Safe cast to XMLNode. This can return null.
Definition: tinyxml2.h:1853
XMLDeclaration * ToDeclaration()
Safe cast to XMLDeclaration. This can return null.
Definition: tinyxml2.h:1869
XMLHandle PreviousSibling()
Get the previous sibling of this handle.
Definition: tinyxml2.h:1836
XMLHandle LastChildElement(const char *name=0)
Get the last child element of this handle.
Definition: tinyxml2.h:1832
XMLHandle FirstChild()
Get the first child of this handle.
Definition: tinyxml2.h:1820
XMLElement * ToElement()
Safe cast to XMLElement. This can return null.
Definition: tinyxml2.h:1857
XMLText * ToText()
Safe cast to XMLText. This can return null.
Definition: tinyxml2.h:1861
XMLHandle FirstChildElement(const char *name=0)
Get the first child element of this handle.
Definition: tinyxml2.h:1824
XMLHandle & operator=(const XMLHandle &ref)
Assignment.
Definition: tinyxml2.h:1814
XMLHandle PreviousSiblingElement(const char *name=0)
Get the previous sibling element of this handle.
Definition: tinyxml2.h:1840
XMLHandle(XMLNode *node)
Create a handle from any node (at any depth of the tree.) This can be a null pointer.
Definition: tinyxml2.h:1802
XMLHandle LastChild()
Get the last child of this handle.
Definition: tinyxml2.h:1828
XMLHandle(XMLNode &node)
Create a handle from a node.
Definition: tinyxml2.h:1806
XMLUnknown * ToUnknown()
Safe cast to XMLUnknown. This can return null.
Definition: tinyxml2.h:1865
XMLHandle NextSibling()
Get the next sibling of this handle.
Definition: tinyxml2.h:1844
XMLHandle NextSiblingElement(const char *name=0)
Get the next sibling element of this handle.
Definition: tinyxml2.h:1848
XMLHandle(const XMLHandle &ref)
Copy constructor.
Definition: tinyxml2.h:1810
Definition: tinyxml2.h:624
virtual XMLDeclaration * ToDeclaration()
Safely cast to a Declaration, or null.
Definition: tinyxml2.h:657
const XMLDocument * GetDocument() const
Get the XMLDocument that owns this XMLNode.
Definition: tinyxml2.h:630
virtual XMLText * ToText()
Safely cast to Text, or null.
Definition: tinyxml2.h:645
const XMLNode * NextSibling() const
Get the next (right) sibling node of this node.
Definition: tinyxml2.h:767
virtual bool ShallowEqual(const XMLNode *compare) const =0
virtual bool Accept(XMLVisitor *visitor) const =0
virtual XMLDocument * ToDocument()
Safely cast to a Document, or null.
Definition: tinyxml2.h:653
virtual XMLNode * ShallowClone(XMLDocument *document) const =0
virtual XMLUnknown * ToUnknown()
Safely cast to an Unknown, or null.
Definition: tinyxml2.h:661
const XMLNode * LastChild() const
Get the last child node, or null if none exists.
Definition: tinyxml2.h:733
virtual XMLElement * ToElement()
Safely cast to an Element, or null.
Definition: tinyxml2.h:641
const XMLNode * PreviousSibling() const
Get the previous (left) sibling node of this node.
Definition: tinyxml2.h:751
bool NoChildren() const
Returns true if this node has no children.
Definition: tinyxml2.h:710
const XMLNode * Parent() const
Get the parent of this node on the DOM.
Definition: tinyxml2.h:701
const XMLNode * FirstChild() const
Get the first child node, or null if none exists.
Definition: tinyxml2.h:715
XMLDocument * GetDocument()
Get the XMLDocument that owns this XMLNode.
Definition: tinyxml2.h:635
virtual XMLComment * ToComment()
Safely cast to a Comment, or null.
Definition: tinyxml2.h:649
Definition: tinyxml2.h:1990
virtual bool VisitExit(const XMLDocument &)
Visit a document.
Definition: tinyxml2.h:2036
const char * CStr() const
Definition: tinyxml2.h:2052
void ClearBuffer()
Definition: tinyxml2.h:2067
int CStrSize() const
Definition: tinyxml2.h:2060
Definition: tinyxml2.h:905
virtual XMLText * ToText()
Safely cast to Text, or null.
Definition: tinyxml2.h:911
bool CData() const
Returns true if this is a CDATA text element.
Definition: tinyxml2.h:923
void SetCData(bool isCData)
Declare whether this should be CDATA or standard text.
Definition: tinyxml2.h:919
Definition: tinyxml2.h:1020
virtual XMLUnknown * ToUnknown()
Safely cast to an Unknown, or null.
Definition: tinyxml2.h:1023
Definition: tinyxml2.h:518
Definition: tinyxml2.h:446
virtual bool Visit(const XMLUnknown &)
Visit an unknown node.
Definition: tinyxml2.h:481
virtual bool VisitExit(const XMLDocument &)
Visit a document.
Definition: tinyxml2.h:455
virtual bool VisitExit(const XMLElement &)
Visit an element.
Definition: tinyxml2.h:464
virtual bool VisitEnter(const XMLDocument &)
Visit a document.
Definition: tinyxml2.h:451
virtual bool Visit(const XMLComment &)
Visit a comment node.
Definition: tinyxml2.h:477
virtual bool Visit(const XMLDeclaration &)
Visit a declaration.
Definition: tinyxml2.h:469
virtual bool Visit(const XMLText &)
Visit a text node.
Definition: tinyxml2.h:473
virtual bool VisitEnter(const XMLElement &, const XMLAttribute *)
Visit an element.
Definition: tinyxml2.h:460