24 #ifndef TINYXML2_INCLUDED
25 #define TINYXML2_INCLUDED
27 #if defined(ANDROID_NDK) || defined(__BORLANDC__) || defined(__QNXNTO__)
54 #if defined( _DEBUG ) || defined( DEBUG ) || defined (__DEBUG__)
61 # pragma warning(push)
62 # pragma warning(disable: 4251)
66 # ifdef TINYXML2_EXPORT
67 # define TINYXML2_LIB __declspec(dllexport)
68 # elif defined(TINYXML2_IMPORT)
69 # define TINYXML2_LIB __declspec(dllimport)
79 # if defined(_MSC_VER)
80 # // "(void)0," is for suppressing C4127 warning in "assert(false)", "assert(true)" and the like
81 # define TIXMLASSERT( x ) if ( !((void)0,(x))) { __debugbreak(); } //if ( !(x)) WinDebugBreak()
82 # elif defined (ANDROID_NDK)
83 # include <android/log.h>
84 # define TIXMLASSERT( x ) if ( !(x)) { __android_log_assert( "assert", "grinliz", "ASSERT in '%s' at %d.", __FILE__, __LINE__ ); }
87 # define TIXMLASSERT assert
90 # define TIXMLASSERT( x ) {}
94 #if defined(_MSC_VER) && (_MSC_VER >= 1400 ) && (!defined WINCE)
103 inline int TIXML_SNPRINTF(
char* buffer,
size_t size,
const char* format, ... )
106 va_start( va, format );
107 int result = vsnprintf_s( buffer, size, _TRUNCATE, format, va );
111 #define TIXML_SSCANF sscanf_s
113 #define TIXML_SNPRINTF _snprintf
114 #define TIXML_SSCANF sscanf
118 #define TIXML_SNPRINTF snprintf
119 #define TIXML_SSCANF sscanf
125 static const int TIXML2_MAJOR_VERSION = 3;
126 static const int TIXML2_MINOR_VERSION = 0;
127 static const int TIXML2_PATCH_VERSION = 0;
136 class XMLDeclaration;
150 NEEDS_ENTITY_PROCESSING = 0x01,
151 NEEDS_NEWLINE_NORMALIZATION = 0x02,
152 COLLAPSE_WHITESPACE = 0x04,
154 TEXT_ELEMENT = NEEDS_ENTITY_PROCESSING | NEEDS_NEWLINE_NORMALIZATION,
155 TEXT_ELEMENT_LEAVE_ENTITIES = NEEDS_NEWLINE_NORMALIZATION,
157 ATTRIBUTE_VALUE = NEEDS_ENTITY_PROCESSING | NEEDS_NEWLINE_NORMALIZATION,
158 ATTRIBUTE_VALUE_LEAVE_ENTITIES = NEEDS_NEWLINE_NORMALIZATION,
159 COMMENT = NEEDS_NEWLINE_NORMALIZATION
162 StrPair() : _flags( 0 ), _start( 0 ), _end( 0 ) {}
165 void Set(
char* start,
char* end,
int flags ) {
169 _flags = flags | NEEDS_FLUSH;
172 const char* GetStr();
175 return _start == _end;
178 void SetInternedStr(
const char* str ) {
180 _start =
const_cast<char*
>(str);
183 void SetStr(
const char* str,
int flags=0 );
185 char* ParseText(
char* in,
const char* endTag,
int strFlags );
186 char* ParseName(
char* in );
188 void TransferTo( StrPair* other );
192 void CollapseWhitespace();
204 StrPair(
const StrPair& other );
205 void operator=( StrPair& other );
214 template <
class T,
int INIT>
225 if ( _mem != _pool ) {
235 TIXMLASSERT( _size < INT_MAX );
236 EnsureCapacity( _size+1 );
240 T* PushArr(
int count ) {
241 TIXMLASSERT( count >= 0 );
242 TIXMLASSERT( _size <= INT_MAX - count );
243 EnsureCapacity( _size+count );
244 T* ret = &_mem[_size];
250 TIXMLASSERT( _size > 0 );
251 return _mem[--_size];
254 void PopArr(
int count ) {
255 TIXMLASSERT( _size >= count );
263 T& operator[](
int i) {
264 TIXMLASSERT( i>= 0 && i < _size );
268 const T& operator[](
int i)
const {
269 TIXMLASSERT( i>= 0 && i < _size );
273 const T& PeekTop()
const {
274 TIXMLASSERT( _size > 0 );
275 return _mem[ _size - 1];
279 TIXMLASSERT( _size >= 0 );
283 int Capacity()
const {
287 const T* Mem()
const {
296 DynArray(
const DynArray& );
297 void operator=(
const DynArray& );
299 void EnsureCapacity(
int cap ) {
300 TIXMLASSERT( cap > 0 );
301 if ( cap > _allocated ) {
302 TIXMLASSERT( cap <= INT_MAX / 2 );
303 int newAllocated = cap * 2;
304 T* newMem =
new T[newAllocated];
305 memcpy( newMem, _mem,
sizeof(T)*_size );
306 if ( _mem != _pool ) {
310 _allocated = newAllocated;
329 virtual ~MemPool() {}
331 virtual int ItemSize()
const = 0;
332 virtual void* Alloc() = 0;
333 virtual void Free(
void* ) = 0;
334 virtual void SetTracked() = 0;
335 virtual void Clear() = 0;
343 class MemPoolT :
public MemPool
346 MemPoolT() : _root(0), _currentAllocs(0), _nAllocs(0), _maxAllocs(0), _nUntracked(0) {}
353 while( !_blockPtrs.Empty()) {
354 Block* b = _blockPtrs.Pop();
364 virtual int ItemSize()
const {
367 int CurrentAllocs()
const {
368 return _currentAllocs;
371 virtual void* Alloc() {
374 Block* block =
new Block();
375 _blockPtrs.Push( block );
377 for(
int i=0; i<COUNT-1; ++i ) {
378 block->chunk[i].next = &block->chunk[i+1];
380 block->chunk[COUNT-1].next = 0;
381 _root = block->chunk;
383 void* result = _root;
387 if ( _currentAllocs > _maxAllocs ) {
388 _maxAllocs = _currentAllocs;
395 virtual void Free(
void* mem ) {
400 Chunk* chunk =
static_cast<Chunk*
>( mem );
402 memset( chunk, 0xfe,
sizeof(Chunk) );
407 void Trace(
const char* name ) {
408 printf(
"Mempool %s watermark=%d [%dk] current=%d size=%d nAlloc=%d blocks=%d\n",
409 name, _maxAllocs, _maxAllocs*SIZE/1024, _currentAllocs, SIZE, _nAllocs, _blockPtrs.Size() );
416 int Untracked()
const {
429 enum { COUNT = (4*1024)/SIZE };
432 MemPoolT(
const MemPoolT& );
433 void operator=(
const MemPoolT& );
442 DynArray< Block*, 10 > _blockPtrs;
518 XML_WRONG_ATTRIBUTE_TYPE,
519 XML_ERROR_FILE_NOT_FOUND,
520 XML_ERROR_FILE_COULD_NOT_BE_OPENED,
521 XML_ERROR_FILE_READ_ERROR,
522 XML_ERROR_ELEMENT_MISMATCH,
523 XML_ERROR_PARSING_ELEMENT,
524 XML_ERROR_PARSING_ATTRIBUTE,
525 XML_ERROR_IDENTIFYING_TAG,
526 XML_ERROR_PARSING_TEXT,
527 XML_ERROR_PARSING_CDATA,
528 XML_ERROR_PARSING_COMMENT,
529 XML_ERROR_PARSING_DECLARATION,
530 XML_ERROR_PARSING_UNKNOWN,
531 XML_ERROR_EMPTY_DOCUMENT,
532 XML_ERROR_MISMATCHED_ELEMENT,
534 XML_CAN_NOT_CONVERT_TEXT,
547 static const char* SkipWhiteSpace(
const char* p ) {
549 while( IsWhiteSpace(*p) ) {
555 static char* SkipWhiteSpace(
char* p ) {
556 return const_cast<char*
>( SkipWhiteSpace( const_cast<const char*>(p) ) );
561 static bool IsWhiteSpace(
char p ) {
562 return !IsUTF8Continuation(p) && isspace( static_cast<unsigned char>(p) );
565 inline static bool IsNameStartChar(
unsigned char ch ) {
570 if ( isalpha( ch ) ) {
573 return ch ==
':' || ch ==
'_';
576 inline static bool IsNameChar(
unsigned char ch ) {
577 return IsNameStartChar( ch )
583 inline static bool StringEqual(
const char* p,
const char* q,
int nChar=INT_MAX ) {
588 while( *p && *q && *p == *q && n<nChar ) {
593 if ( (n == nChar) || ( *p == 0 && *q == 0 ) ) {
599 inline static bool IsUTF8Continuation(
const char p ) {
600 return ( p & 0x80 ) != 0;
603 static const char* ReadBOM(
const char* p,
bool* hasBOM );
606 static const char* GetCharacterRef(
const char* p,
char* value,
int* length );
607 static void ConvertUTF32ToUTF8(
unsigned long input,
char* output,
int* length );
610 static void ToStr(
int v,
char* buffer,
int bufferSize );
611 static void ToStr(
unsigned v,
char* buffer,
int bufferSize );
612 static void ToStr(
bool v,
char* buffer,
int bufferSize );
613 static void ToStr(
float v,
char* buffer,
int bufferSize );
614 static void ToStr(
double v,
char* buffer,
int bufferSize );
617 static bool ToInt(
const char* str,
int* value );
618 static bool ToUnsigned(
const char* str,
unsigned* value );
619 static bool ToBool(
const char* str,
bool* value );
620 static bool ToFloat(
const char* str,
float* value );
621 static bool ToDouble(
const char* str,
double* value );
693 virtual const XMLText* ToText()
const {
696 virtual const XMLComment* ToComment()
const {
699 virtual const XMLDocument* ToDocument()
const {
702 virtual const XMLDeclaration* ToDeclaration()
const {
705 virtual const XMLUnknown* ToUnknown()
const {
718 const char* Value()
const;
723 void SetValue(
const char* val,
bool staticMem=
false );
751 const XMLElement* FirstChildElement(
const char* value=0 )
const;
753 XMLElement* FirstChildElement(
const char* value=0 ) {
754 return const_cast<XMLElement*
>(
const_cast<const XMLNode*
>(
this)->FirstChildElement( value ));
763 return const_cast<XMLNode*
>(
const_cast<const XMLNode*
>(
this)->LastChild() );
769 const XMLElement* LastChildElement(
const char* value=0 )
const;
771 XMLElement* LastChildElement(
const char* value=0 ) {
772 return const_cast<XMLElement*
>(
const_cast<const XMLNode*
>(
this)->LastChildElement(value) );
785 const XMLElement* PreviousSiblingElement(
const char* value=0 )
const ;
787 XMLElement* PreviousSiblingElement(
const char* value=0 ) {
788 return const_cast<XMLElement*
>(
const_cast<const XMLNode*
>(
this)->PreviousSiblingElement( value ) );
801 const XMLElement* NextSiblingElement(
const char* value=0 )
const;
803 XMLElement* NextSiblingElement(
const char* value=0 ) {
804 return const_cast<XMLElement*
>(
const_cast<const XMLNode*
>(
this)->NextSiblingElement( value ) );
814 XMLNode* InsertEndChild( XMLNode* addThis );
816 XMLNode* LinkEndChild( XMLNode* addThis ) {
817 return InsertEndChild( addThis );
826 XMLNode* InsertFirstChild( XMLNode* addThis );
835 XMLNode* InsertAfterChild( XMLNode* afterThis, XMLNode* addThis );
840 void DeleteChildren();
845 void DeleteChild( XMLNode* node );
856 virtual XMLNode* ShallowClone( XMLDocument* document )
const = 0;
864 virtual bool ShallowEqual(
const XMLNode* compare )
const = 0;
888 virtual bool Accept( XMLVisitor* visitor )
const = 0;
891 virtual char* ParseDeep(
char*, StrPair* );
894 XMLNode( XMLDocument* );
897 XMLDocument* _document;
899 mutable StrPair _value;
901 XMLNode* _firstChild;
909 void Unlink( XMLNode* child );
910 static void DeleteNode( XMLNode* node );
911 void InsertChildPreamble( XMLNode* insertThis )
const;
913 XMLNode(
const XMLNode& );
914 XMLNode& operator=(
const XMLNode& );
932 friend class XMLBase;
935 virtual bool Accept(
XMLVisitor* visitor )
const;
940 virtual const XMLText* ToText()
const {
953 char* ParseDeep(
char*, StrPair* endTag );
955 virtual bool ShallowEqual(
const XMLNode* compare )
const;
959 virtual ~XMLText() {}
964 XMLText(
const XMLText& );
965 XMLText& operator=(
const XMLText& );
981 virtual bool Accept( XMLVisitor* visitor )
const;
983 char* ParseDeep(
char*, StrPair* endTag );
984 virtual XMLNode* ShallowClone( XMLDocument* document )
const;
985 virtual bool ShallowEqual(
const XMLNode* compare )
const;
988 XMLComment( XMLDocument* doc );
989 virtual ~XMLComment();
992 XMLComment(
const XMLComment& );
993 XMLComment& operator=(
const XMLComment& );
1019 virtual bool Accept( XMLVisitor* visitor )
const;
1021 char* ParseDeep(
char*, StrPair* endTag );
1022 virtual XMLNode* ShallowClone( XMLDocument* document )
const;
1023 virtual bool ShallowEqual(
const XMLNode* compare )
const;
1026 XMLDeclaration( XMLDocument* doc );
1027 virtual ~XMLDeclaration();
1030 XMLDeclaration(
const XMLDeclaration& );
1031 XMLDeclaration& operator=(
const XMLDeclaration& );
1049 virtual const XMLUnknown* ToUnknown()
const {
1053 virtual bool Accept( XMLVisitor* visitor )
const;
1055 char* ParseDeep(
char*, StrPair* endTag );
1056 virtual XMLNode* ShallowClone( XMLDocument* document )
const;
1057 virtual bool ShallowEqual(
const XMLNode* compare )
const;
1060 XMLUnknown( XMLDocument* doc );
1061 virtual ~XMLUnknown();
1064 XMLUnknown(
const XMLUnknown& );
1065 XMLUnknown& operator=(
const XMLUnknown& );
1081 const char* Name()
const;
1084 const char* Value()
const;
1097 QueryIntValue( &i );
1103 QueryUnsignedValue( &i );
1109 QueryBoolValue( &b );
1115 QueryDoubleValue( &d );
1121 QueryFloatValue( &f );
1129 XMLError QueryIntValue(
int* value )
const;
1131 XMLError QueryUnsignedValue(
unsigned int* value )
const;
1133 XMLError QueryBoolValue(
bool* value )
const;
1135 XMLError QueryDoubleValue(
double* value )
const;
1137 XMLError QueryFloatValue(
float* value )
const;
1140 void SetAttribute(
const char* value );
1142 void SetAttribute(
int value );
1144 void SetAttribute(
unsigned value );
1146 void SetAttribute(
bool value );
1148 void SetAttribute(
double value );
1150 void SetAttribute(
float value );
1153 enum { BUF_SIZE = 200 };
1155 XMLAttribute() : _next( 0 ), _memPool( 0 ) {}
1156 virtual ~XMLAttribute() {}
1158 XMLAttribute(
const XMLAttribute& );
1159 void operator=(
const XMLAttribute& );
1160 void SetName(
const char* name );
1162 char* ParseDeep(
char* p,
bool processEntities );
1164 mutable StrPair _name;
1165 mutable StrPair _value;
1166 XMLAttribute* _next;
1177 friend class XMLBase;
1185 void SetName(
const char* str,
bool staticMem=
false ) {
1186 SetValue( str, staticMem );
1192 virtual const XMLElement* ToElement()
const {
1195 virtual bool Accept( XMLVisitor* visitor )
const;
1220 const char* Attribute(
const char* name,
const char* value=0 )
const;
1229 QueryIntAttribute( name, &i );
1235 QueryUnsignedAttribute( name, &i );
1241 QueryBoolAttribute( name, &b );
1247 QueryDoubleAttribute( name, &d );
1253 QueryFloatAttribute( name, &f );
1273 return XML_NO_ATTRIBUTE;
1281 return XML_NO_ATTRIBUTE;
1289 return XML_NO_ATTRIBUTE;
1297 return XML_NO_ATTRIBUTE;
1305 return XML_NO_ATTRIBUTE;
1329 return QueryIntAttribute( name, value );
1332 int QueryAttribute(
const char* name,
unsigned int* value )
const {
1333 return QueryUnsignedAttribute( name, value );
1336 int QueryAttribute(
const char* name,
bool* value )
const {
1337 return QueryBoolAttribute( name, value );
1340 int QueryAttribute(
const char* name,
double* value )
const {
1341 return QueryDoubleAttribute( name, value );
1344 int QueryAttribute(
const char* name,
float* value )
const {
1345 return QueryFloatAttribute( name, value );
1382 void DeleteAttribute(
const char* name );
1386 return _rootAttribute;
1389 const XMLAttribute* FindAttribute(
const char* name )
const;
1419 const char* GetText()
const;
1455 void SetText(
const char* inText );
1457 void SetText(
int value );
1459 void SetText(
unsigned value );
1461 void SetText(
bool value );
1463 void SetText(
double value );
1465 void SetText(
float value );
1493 XMLError QueryIntText(
int* ival )
const;
1495 XMLError QueryUnsignedText(
unsigned* uval )
const;
1497 XMLError QueryBoolText(
bool* bval )
const;
1499 XMLError QueryDoubleText(
double* dval )
const;
1501 XMLError QueryFloatText(
float* fval )
const;
1509 int ClosingType()
const {
1510 return _closingType;
1512 char* ParseDeep(
char* p, StrPair* endTag );
1513 virtual XMLNode* ShallowClone( XMLDocument* document )
const;
1514 virtual bool ShallowEqual(
const XMLNode* compare )
const;
1517 XMLElement( XMLDocument* doc );
1518 virtual ~XMLElement();
1519 XMLElement(
const XMLElement& );
1520 void operator=(
const XMLElement& );
1522 XMLAttribute* FindAttribute(
const char* name ) {
1523 return const_cast<XMLAttribute*
>(
const_cast<const XMLElement*
>(
this)->FindAttribute( name ));
1525 XMLAttribute* FindOrCreateAttribute(
const char* name );
1527 char* ParseAttributes(
char* p );
1528 static void DeleteAttribute( XMLAttribute* attribute );
1530 enum { BUF_SIZE = 200 };
1535 XMLAttribute* _rootAttribute;
1540 PRESERVE_WHITESPACE,
1555 XMLDocument(
bool processEntities =
true, Whitespace = PRESERVE_WHITESPACE );
1575 XMLError Parse(
const char* xml,
size_t nBytes=(
size_t)(-1) );
1582 XMLError LoadFile(
const char* filename );
1595 XMLError LoadFile( FILE* );
1602 XMLError SaveFile(
const char* filename,
bool compact =
false );
1611 XMLError SaveFile( FILE* fp,
bool compact =
false );
1613 bool ProcessEntities()
const {
1614 return _processEntities;
1616 Whitespace WhitespaceMode()
const {
1636 return FirstChildElement();
1639 return FirstChildElement();
1656 void Print( XMLPrinter* streamer=0 )
const;
1657 virtual bool Accept( XMLVisitor* visitor )
const;
1664 XMLElement* NewElement(
const char* name );
1670 XMLComment* NewComment(
const char* comment );
1676 XMLText* NewText(
const char* text );
1688 XMLDeclaration* NewDeclaration(
const char* text=0 );
1694 XMLUnknown* NewUnknown(
const char* text );
1700 void DeleteNode( XMLNode* node );
1702 void SetError( XMLError error,
const char* str1,
const char* str2 );
1706 return _errorID != XML_NO_ERROR;
1712 const char* ErrorName()
const;
1723 void PrintError()
const;
1729 char* Identify(
char* p,
XMLNode** node );
1743 bool _processEntities;
1745 Whitespace _whitespace;
1746 const char* _errorStr1;
1747 const char* _errorStr2;
1750 MemPoolT< sizeof(XMLElement) > _elementPool;
1751 MemPoolT< sizeof(XMLAttribute) > _attributePool;
1752 MemPoolT< sizeof(XMLText) > _textPool;
1753 MemPoolT< sizeof(XMLComment) > _commentPool;
1755 static const char* _errorNames[XML_ERROR_COUNT];
1839 return XMLHandle( _node ? _node->FirstChild() : 0 );
1843 return XMLHandle( _node ? _node->FirstChildElement( value ) : 0 );
1847 return XMLHandle( _node ? _node->LastChild() : 0 );
1851 return XMLHandle( _node ? _node->LastChildElement( _value ) : 0 );
1855 return XMLHandle( _node ? _node->PreviousSibling() : 0 );
1859 return XMLHandle( _node ? _node->PreviousSiblingElement( _value ) : 0 );
1863 return XMLHandle( _node ? _node->NextSibling() : 0 );
1867 return XMLHandle( _node ? _node->NextSiblingElement( _value ) : 0 );
1876 return ( ( _node == 0 ) ? 0 : _node->ToElement() );
1880 return ( ( _node == 0 ) ? 0 : _node->ToText() );
1884 return ( ( _node == 0 ) ? 0 : _node->ToUnknown() );
1888 return ( ( _node == 0 ) ? 0 : _node->ToDeclaration() );
1921 const XMLConstHandle FirstChildElement(
const char* value=0 )
const {
1922 return XMLConstHandle( _node ? _node->FirstChildElement( value ) : 0 );
1927 const XMLConstHandle LastChildElement(
const char* _value=0 )
const {
1928 return XMLConstHandle( _node ? _node->LastChildElement( _value ) : 0 );
1933 const XMLConstHandle PreviousSiblingElement(
const char* _value=0 )
const {
1934 return XMLConstHandle( _node ? _node->PreviousSiblingElement( _value ) : 0 );
1939 const XMLConstHandle NextSiblingElement(
const char* _value=0 )
const {
1940 return XMLConstHandle( _node ? _node->NextSiblingElement( _value ) : 0 );
1944 const XMLNode* ToNode()
const {
1948 return ( ( _node == 0 ) ? 0 : _node->ToElement() );
1950 const XMLText* ToText()
const {
1951 return ( ( _node == 0 ) ? 0 : _node->ToText() );
1954 return ( ( _node == 0 ) ? 0 : _node->ToUnknown() );
1957 return ( ( _node == 0 ) ? 0 : _node->ToDeclaration() );
2016 XMLPrinter( FILE* file=0,
bool compact =
false,
int depth = 0 );
2020 void PushHeader(
bool writeBOM,
bool writeDeclaration );
2024 void OpenElement(
const char* name,
bool compactMode=
false );
2026 void PushAttribute(
const char* name,
const char* value );
2027 void PushAttribute(
const char* name,
int value );
2028 void PushAttribute(
const char* name,
unsigned value );
2029 void PushAttribute(
const char* name,
bool value );
2030 void PushAttribute(
const char* name,
double value );
2032 virtual void CloseElement(
bool compactMode=
false );
2035 void PushText(
const char* text,
bool cdata=
false );
2037 void PushText(
int value );
2039 void PushText(
unsigned value );
2041 void PushText(
bool value );
2043 void PushText(
float value );
2045 void PushText(
double value );
2048 void PushComment(
const char* comment );
2050 void PushDeclaration(
const char* value );
2051 void PushUnknown(
const char* value );
2059 virtual bool VisitExit(
const XMLElement& element );
2061 virtual bool Visit(
const XMLText& text );
2062 virtual bool Visit(
const XMLComment& comment );
2064 virtual bool Visit(
const XMLUnknown& unknown );
2071 return _buffer.Mem();
2079 return _buffer.Size();
2091 virtual bool CompactMode(
const XMLElement& ) {
return _compactMode; }
2096 virtual void PrintSpace(
int depth );
2097 void Print(
const char* format, ... );
2099 void SealElementIfJustOpened();
2100 bool _elementJustOpened;
2101 DynArray< const char*, 10 > _stack;
2104 void PrintString(
const char*,
bool restrictedEntitySet );
2110 bool _processEntities;
2117 bool _entityFlag[ENTITY_RANGE];
2118 bool _restrictedEntityFlag[ENTITY_RANGE];
2120 DynArray< char, 20 > _buffer;
2126 #if defined(_MSC_VER)
2127 # pragma warning(pop)
2130 #endif // TINYXML2_INCLUDED
bool CData() const
Returns true if this is a CDATA text element.
Definition: tinyxml2.h:949
const XMLNode * Parent() const
Get the parent of this node on the DOM.
Definition: tinyxml2.h:726
virtual bool VisitExit(const XMLDocument &)
Visit a document.
Definition: tinyxml2.h:482
virtual bool ShallowEqual(const XMLNode *) const
Definition: tinyxml2.h:1734
XMLText * ToText()
Safe cast to XMLText. This can return null.
Definition: tinyxml2.h:1879
XMLError QueryBoolAttribute(const char *name, bool *value) const
See QueryIntAttribute()
Definition: tinyxml2.h:1286
XMLElement * ToElement()
Safe cast to XMLElement. This can return null.
Definition: tinyxml2.h:1875
virtual XMLElement * ToElement()
Safely cast to an Element, or null.
Definition: tinyxml2.h:666
double DoubleValue() const
Query as a double. See IntValue()
Definition: tinyxml2.h:1113
virtual XMLText * ToText()
Safely cast to Text, or null.
Definition: tinyxml2.h:670
bool NoChildren() const
Returns true if this node has no children.
Definition: tinyxml2.h:735
XMLError ErrorID() const
Return the errorID.
Definition: tinyxml2.h:1709
int CStrSize() const
Definition: tinyxml2.h:2078
virtual XMLDocument * ToDocument()
Safely cast to a Document, or null.
Definition: tinyxml2.h:1558
const XMLNode * LastChild() const
Get the last child node, or null if none exists.
Definition: tinyxml2.h:758
XMLUnknown * ToUnknown()
Safe cast to XMLUnknown. This can return null.
Definition: tinyxml2.h:1883
XMLHandle(const XMLHandle &ref)
Copy constructor.
Definition: tinyxml2.h:1828
XMLHandle FirstChild()
Get the first child of this handle.
Definition: tinyxml2.h:1838
void SetCData(bool isCData)
Declare whether this should be CDATA or standard text.
Definition: tinyxml2.h:945
XMLHandle LastChild()
Get the last child of this handle.
Definition: tinyxml2.h:1846
Definition: tinyxml2.h:1816
Definition: tinyxml2.h:1008
XMLError QueryUnsignedAttribute(const char *name, unsigned int *value) const
See QueryIntAttribute()
Definition: tinyxml2.h:1278
XMLElement * RootElement()
Definition: tinyxml2.h:1635
const char * Name() const
Get the name of an element (which is the Value() of the node.)
Definition: tinyxml2.h:1181
virtual XMLText * ToText()
Safely cast to Text, or null.
Definition: tinyxml2.h:937
XMLHandle(XMLNode &node)
Create a handle from a node.
Definition: tinyxml2.h:1824
void SetName(const char *str, bool staticMem=false)
Set the name of the element.
Definition: tinyxml2.h:1185
void SetBOM(bool useBOM)
Definition: tinyxml2.h:1628
XMLHandle(XMLNode *node)
Create a handle from any node (at any depth of the tree.) This can be a null pointer.
Definition: tinyxml2.h:1820
XMLError QueryIntValue(int *value) const
double DoubleAttribute(const char *name) const
See IntAttribute()
Definition: tinyxml2.h:1245
int QueryAttribute(const char *name, int *value) const
Definition: tinyxml2.h:1328
void ClearBuffer()
Definition: tinyxml2.h:2085
virtual XMLElement * ToElement()
Safely cast to an Element, or null.
Definition: tinyxml2.h:1189
Definition: tinyxml2.h:129
bool HasBOM() const
Definition: tinyxml2.h:1623
XMLNode * ToNode()
Safe cast to XMLNode. This can return null.
Definition: tinyxml2.h:1871
unsigned UnsignedAttribute(const char *name) const
See IntAttribute()
Definition: tinyxml2.h:1233
bool BoolAttribute(const char *name) const
See IntAttribute()
Definition: tinyxml2.h:1239
bool BoolValue() const
Query as a boolean. See IntValue()
Definition: tinyxml2.h:1107
virtual XMLDeclaration * ToDeclaration()
Safely cast to a Declaration, or null.
Definition: tinyxml2.h:1012
XMLError QueryFloatAttribute(const char *name, float *value) const
See QueryIntAttribute()
Definition: tinyxml2.h:1302
virtual bool Visit(const XMLDeclaration &)
Visit a declaration.
Definition: tinyxml2.h:496
virtual bool Visit(const XMLUnknown &)
Visit an unknown node.
Definition: tinyxml2.h:508
void SetAttribute(const char *name, unsigned value)
Sets the named attribute to value.
Definition: tinyxml2.h:1359
Definition: tinyxml2.h:1175
XMLHandle NextSibling()
Get the next sibling of this handle.
Definition: tinyxml2.h:1862
XMLError QueryUnsignedValue(unsigned int *value) const
See QueryIntValue.
virtual XMLUnknown * ToUnknown()
Safely cast to an Unknown, or null.
Definition: tinyxml2.h:1046
XMLError QueryFloatValue(float *value) const
See QueryIntValue.
XMLHandle PreviousSibling()
Get the previous sibling of this handle.
Definition: tinyxml2.h:1854
Definition: tinyxml2.h:1900
XMLHandle & operator=(const XMLHandle &ref)
Assignment.
Definition: tinyxml2.h:1832
virtual bool VisitExit(const XMLDocument &)
Visit a document.
Definition: tinyxml2.h:2054
virtual bool VisitEnter(const XMLElement &, const XMLAttribute *)
Visit an element.
Definition: tinyxml2.h:487
const XMLDocument * GetDocument() const
Get the XMLDocument that owns this XMLNode.
Definition: tinyxml2.h:657
virtual XMLNode * ShallowClone(XMLDocument *) const
Definition: tinyxml2.h:1731
XMLHandle FirstChildElement(const char *value=0)
Get the first child element of this handle.
Definition: tinyxml2.h:1842
virtual bool VisitEnter(const XMLDocument &)
Visit a document.
Definition: tinyxml2.h:478
Definition: tinyxml2.h:1042
const XMLNode * NextSibling() const
Get the next (right) sibling node of this node.
Definition: tinyxml2.h:792
virtual XMLDocument * ToDocument()
Safely cast to a Document, or null.
Definition: tinyxml2.h:678
Definition: tinyxml2.h:1076
float FloatAttribute(const char *name) const
See IntAttribute()
Definition: tinyxml2.h:1251
const char * GetErrorStr2() const
Return a possibly helpful secondary diagnostic location or string.
Definition: tinyxml2.h:1719
void SetAttribute(const char *name, bool value)
Sets the named attribute to value.
Definition: tinyxml2.h:1364
XMLDeclaration * ToDeclaration()
Safe cast to XMLDeclaration. This can return null.
Definition: tinyxml2.h:1887
unsigned UnsignedValue() const
Query as an unsigned integer. See IntValue()
Definition: tinyxml2.h:1101
XMLHandle NextSiblingElement(const char *_value=0)
Get the next sibling element of this handle.
Definition: tinyxml2.h:1866
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:1349
virtual bool VisitExit(const XMLElement &)
Visit an element.
Definition: tinyxml2.h:491
Definition: tinyxml2.h:2007
Definition: tinyxml2.h:1550
const char * CStr() const
Definition: tinyxml2.h:2070
XMLError QueryIntAttribute(const char *name, int *value) const
Definition: tinyxml2.h:1270
void SetAttribute(const char *name, double value)
Sets the named attribute to value.
Definition: tinyxml2.h:1369
int IntValue() const
Definition: tinyxml2.h:1095
virtual bool Visit(const XMLComment &)
Visit a comment node.
Definition: tinyxml2.h:504
const XMLAttribute * Next() const
The next attribute in the list.
Definition: tinyxml2.h:1087
const char * GetErrorStr1() const
Return a possibly helpful diagnostic location or string.
Definition: tinyxml2.h:1715
XMLError QueryDoubleValue(double *value) const
See QueryIntValue.
bool Error() const
Return true if there was an error parsing the document.
Definition: tinyxml2.h:1705
Definition: tinyxml2.h:650
const XMLNode * PreviousSibling() const
Get the previous (left) sibling node of this node.
Definition: tinyxml2.h:776
float FloatValue() const
Query as a float. See IntValue()
Definition: tinyxml2.h:1119
XMLError QueryBoolValue(bool *value) const
See QueryIntValue.
XMLHandle PreviousSiblingElement(const char *_value=0)
Get the previous sibling element of this handle.
Definition: tinyxml2.h:1858
virtual bool Visit(const XMLText &)
Visit a text node.
Definition: tinyxml2.h:500
Definition: tinyxml2.h:930
Definition: tinyxml2.h:472
XMLDocument * GetDocument()
Get the XMLDocument that owns this XMLNode.
Definition: tinyxml2.h:661
virtual XMLUnknown * ToUnknown()
Safely cast to an Unknown, or null.
Definition: tinyxml2.h:686
XMLError QueryDoubleAttribute(const char *name, double *value) const
See QueryIntAttribute()
Definition: tinyxml2.h:1294
void SetAttribute(const char *name, float value)
Sets the named attribute to value.
Definition: tinyxml2.h:1374
const XMLNode * FirstChild() const
Get the first child node, or null if none exists.
Definition: tinyxml2.h:740
virtual XMLDeclaration * ToDeclaration()
Safely cast to a Declaration, or null.
Definition: tinyxml2.h:682
const XMLAttribute * FirstAttribute() const
Return the first attribute in the list.
Definition: tinyxml2.h:1385
int IntAttribute(const char *name) const
Definition: tinyxml2.h:1227
void SetAttribute(const char *name, int value)
Sets the named attribute to value.
Definition: tinyxml2.h:1354
XMLHandle LastChildElement(const char *_value=0)
Get the last child element of this handle.
Definition: tinyxml2.h:1850
virtual XMLComment * ToComment()
Safely cast to a Comment, or null.
Definition: tinyxml2.h:674