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 = 6;
102 static const int TIXML2_MINOR_VERSION = 0;
103 static const int TIXML2_PATCH_VERSION = 0;
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 ),
203 if ( _mem != _pool ) {
213 TIXMLASSERT( _size < INT_MAX );
214 EnsureCapacity( _size+1 );
219 T* PushArr(
int count ) {
220 TIXMLASSERT( count >= 0 );
221 TIXMLASSERT( _size <= INT_MAX - count );
222 EnsureCapacity( _size+count );
223 T* ret = &_mem[_size];
229 TIXMLASSERT( _size > 0 );
234 void PopArr(
int count ) {
235 TIXMLASSERT( _size >= count );
243 T& operator[](
int i) {
244 TIXMLASSERT( i>= 0 && i < _size );
248 const T& operator[](
int i)
const {
249 TIXMLASSERT( i>= 0 && i < _size );
253 const T& PeekTop()
const {
254 TIXMLASSERT( _size > 0 );
255 return _mem[ _size - 1];
259 TIXMLASSERT( _size >= 0 );
263 int Capacity()
const {
264 TIXMLASSERT( _allocated >= INITIAL_SIZE );
268 void SwapRemove(
int i) {
269 TIXMLASSERT(i >= 0 && i < _size);
270 TIXMLASSERT(_size > 0);
271 _mem[i] = _mem[_size - 1];
275 const T* Mem()
const {
286 DynArray(
const DynArray& );
287 void operator=(
const DynArray& );
289 void EnsureCapacity(
int cap ) {
290 TIXMLASSERT( cap > 0 );
291 if ( cap > _allocated ) {
292 TIXMLASSERT( cap <= INT_MAX / 2 );
293 int newAllocated = cap * 2;
294 T* newMem =
new T[newAllocated];
295 TIXMLASSERT( newAllocated >= _size );
296 memcpy( newMem, _mem,
sizeof(T)*_size );
297 if ( _mem != _pool ) {
301 _allocated = newAllocated;
306 T _pool[INITIAL_SIZE];
320 virtual ~MemPool() {}
322 virtual int ItemSize()
const = 0;
323 virtual void* Alloc() = 0;
324 virtual void Free(
void* ) = 0;
325 virtual void SetTracked() = 0;
326 virtual void Clear() = 0;
333 template<
int ITEM_SIZE >
334 class MemPoolT :
public MemPool
337 MemPoolT() : _blockPtrs(), _root(0), _currentAllocs(0), _nAllocs(0), _maxAllocs(0), _nUntracked(0) {}
344 while( !_blockPtrs.Empty()) {
345 Block* lastBlock = _blockPtrs.Pop();
355 virtual int ItemSize()
const {
358 int CurrentAllocs()
const {
359 return _currentAllocs;
362 virtual void* Alloc() {
365 Block* block =
new Block();
366 _blockPtrs.Push( block );
368 Item* blockItems = block->items;
369 for(
int i = 0; i < ITEMS_PER_BLOCK - 1; ++i ) {
370 blockItems[i].next = &(blockItems[i + 1]);
372 blockItems[ITEMS_PER_BLOCK - 1].next = 0;
375 Item*
const result = _root;
376 TIXMLASSERT( result != 0 );
380 if ( _currentAllocs > _maxAllocs ) {
381 _maxAllocs = _currentAllocs;
388 virtual void Free(
void* mem ) {
393 Item* item =
static_cast<Item*
>( mem );
395 memset( item, 0xfe,
sizeof( *item ) );
400 void Trace(
const char* name ) {
401 printf(
"Mempool %s watermark=%d [%dk] current=%d size=%d nAlloc=%d blocks=%d\n",
402 name, _maxAllocs, _maxAllocs * ITEM_SIZE / 1024, _currentAllocs,
403 ITEM_SIZE, _nAllocs, _blockPtrs.Size() );
410 int Untracked()
const {
425 enum { ITEMS_PER_BLOCK = (4 * 1024) / ITEM_SIZE };
428 MemPoolT(
const MemPoolT& );
429 void operator=(
const MemPoolT& );
433 char itemData[ITEM_SIZE];
436 Item items[ITEMS_PER_BLOCK];
438 DynArray< Block*, 10 > _blockPtrs;
513 XML_WRONG_ATTRIBUTE_TYPE,
514 XML_ERROR_FILE_NOT_FOUND,
515 XML_ERROR_FILE_COULD_NOT_BE_OPENED,
516 XML_ERROR_FILE_READ_ERROR,
517 UNUSED_XML_ERROR_ELEMENT_MISMATCH,
518 XML_ERROR_PARSING_ELEMENT,
519 XML_ERROR_PARSING_ATTRIBUTE,
520 UNUSED_XML_ERROR_IDENTIFYING_TAG,
521 XML_ERROR_PARSING_TEXT,
522 XML_ERROR_PARSING_CDATA,
523 XML_ERROR_PARSING_COMMENT,
524 XML_ERROR_PARSING_DECLARATION,
525 XML_ERROR_PARSING_UNKNOWN,
526 XML_ERROR_EMPTY_DOCUMENT,
527 XML_ERROR_MISMATCHED_ELEMENT,
529 XML_CAN_NOT_CONVERT_TEXT,
539 class TINYXML2_LIB XMLUtil
542 static const char* SkipWhiteSpace(
const char* p,
int* curLineNumPtr ) {
545 while( IsWhiteSpace(*p) ) {
546 if (curLineNumPtr && *p ==
'\n') {
554 static char* SkipWhiteSpace(
char* p,
int* curLineNumPtr ) {
555 return const_cast<char*
>( SkipWhiteSpace( const_cast<const char*>(p), curLineNumPtr ) );
560 static bool IsWhiteSpace(
char p ) {
561 return !IsUTF8Continuation(p) && isspace( static_cast<unsigned char>(p) );
564 inline static bool IsNameStartChar(
unsigned char ch ) {
569 if ( isalpha( ch ) ) {
572 return ch ==
':' || ch ==
'_';
575 inline static bool IsNameChar(
unsigned char ch ) {
576 return IsNameStartChar( ch )
582 inline static bool StringEqual(
const char* p,
const char* q,
int nChar=INT_MAX ) {
588 TIXMLASSERT( nChar >= 0 );
589 return strncmp( p, q, nChar ) == 0;
592 inline static bool IsUTF8Continuation(
char p ) {
593 return ( p & 0x80 ) != 0;
596 static const char* ReadBOM(
const char* p,
bool* hasBOM );
599 static const char* GetCharacterRef(
const char* p,
char* value,
int* length );
600 static void ConvertUTF32ToUTF8(
unsigned long input,
char* output,
int* length );
603 static void ToStr(
int v,
char* buffer,
int bufferSize );
604 static void ToStr(
unsigned v,
char* buffer,
int bufferSize );
605 static void ToStr(
bool v,
char* buffer,
int bufferSize );
606 static void ToStr(
float v,
char* buffer,
int bufferSize );
607 static void ToStr(
double v,
char* buffer,
int bufferSize );
608 static void ToStr(int64_t v,
char* buffer,
int bufferSize);
611 static bool ToInt(
const char* str,
int* value );
612 static bool ToUnsigned(
const char* str,
unsigned* value );
613 static bool ToBool(
const char* str,
bool* value );
614 static bool ToFloat(
const char* str,
float* value );
615 static bool ToDouble(
const char* str,
double* value );
616 static bool ToInt64(
const char* str, int64_t* value);
623 static void SetBoolSerialization(
const char* writeTrue,
const char* writeFalse);
626 static const char* writeBoolTrue;
627 static const char* writeBoolFalse;
664 TIXMLASSERT( _document );
669 TIXMLASSERT( _document );
701 virtual const XMLText* ToText()
const {
726 const char* Value()
const;
731 void SetValue(
const char* val,
bool staticMem=
false );
762 const XMLElement* FirstChildElement(
const char* name = 0 )
const;
764 XMLElement* FirstChildElement(
const char* name = 0 ) {
765 return const_cast<XMLElement*
>(
const_cast<const XMLNode*
>(
this)->FirstChildElement( name ));
780 const XMLElement* LastChildElement(
const char* name = 0 )
const;
782 XMLElement* LastChildElement(
const char* name = 0 ) {
783 return const_cast<XMLElement*
>(
const_cast<const XMLNode*
>(
this)->LastChildElement(name) );
796 const XMLElement* PreviousSiblingElement(
const char* name = 0 )
const ;
798 XMLElement* PreviousSiblingElement(
const char* name = 0 ) {
799 return const_cast<XMLElement*
>(
const_cast<const XMLNode*
>(
this)->PreviousSiblingElement( name ) );
812 const XMLElement* NextSiblingElement(
const char* name = 0 )
const;
814 XMLElement* NextSiblingElement(
const char* name = 0 ) {
815 return const_cast<XMLElement*
>(
const_cast<const XMLNode*
>(
this)->NextSiblingElement( name ) );
828 return InsertEndChild( addThis );
851 void DeleteChildren();
856 void DeleteChild(
XMLNode* node );
890 virtual bool ShallowEqual(
const XMLNode* compare )
const = 0;
914 virtual bool Accept(
XMLVisitor* visitor )
const = 0;
934 virtual char* ParseDeep(
char* p, StrPair* parentEndTag,
int* curLineNumPtr);
938 mutable StrPair _value;
952 static void DeleteNode(
XMLNode* node );
953 void InsertChildPreamble(
XMLNode* insertThis )
const;
954 const XMLElement* ToElementWithName(
const char* name )
const;
977 virtual bool Accept(
XMLVisitor* visitor )
const;
982 virtual const XMLText* ToText()
const {
996 virtual bool ShallowEqual(
const XMLNode* compare )
const;
1002 char* ParseDeep(
char* p, StrPair* parentEndTag,
int* curLineNumPtr );
1020 virtual const XMLComment* ToComment()
const {
1024 virtual bool Accept(
XMLVisitor* visitor )
const;
1027 virtual bool ShallowEqual(
const XMLNode* compare )
const;
1033 char* ParseDeep(
char* p, StrPair* parentEndTag,
int* curLineNumPtr);
1063 virtual bool Accept(
XMLVisitor* visitor )
const;
1066 virtual bool ShallowEqual(
const XMLNode* compare )
const;
1072 char* ParseDeep(
char* p, StrPair* parentEndTag,
int* curLineNumPtr );
1094 virtual const XMLUnknown* ToUnknown()
const {
1098 virtual bool Accept(
XMLVisitor* visitor )
const;
1101 virtual bool ShallowEqual(
const XMLNode* compare )
const;
1107 char* ParseDeep(
char* p, StrPair* parentEndTag,
int* curLineNumPtr );
1127 const char* Name()
const;
1130 const char* Value()
const;
1150 int64_t Int64Value()
const {
1152 QueryInt64Value(&i);
1159 QueryUnsignedValue( &i );
1165 QueryBoolValue( &b );
1171 QueryDoubleValue( &d );
1177 QueryFloatValue( &f );
1185 XMLError QueryIntValue(
int* value )
const;
1187 XMLError QueryUnsignedValue(
unsigned int* value )
const;
1189 XMLError QueryInt64Value(int64_t* value)
const;
1191 XMLError QueryBoolValue(
bool* value )
const;
1193 XMLError QueryDoubleValue(
double* value )
const;
1195 XMLError QueryFloatValue(
float* value )
const;
1198 void SetAttribute(
const char* value );
1200 void SetAttribute(
int value );
1202 void SetAttribute(
unsigned value );
1204 void SetAttribute(int64_t value);
1206 void SetAttribute(
bool value );
1208 void SetAttribute(
double value );
1210 void SetAttribute(
float value );
1213 enum { BUF_SIZE = 200 };
1215 XMLAttribute() : _name(), _value(),_parseLineNum( 0 ), _next( 0 ), _memPool( 0 ) {}
1220 void SetName(
const char* name );
1222 char* ParseDeep(
char* p,
bool processEntities,
int* curLineNumPtr );
1224 mutable StrPair _name;
1225 mutable StrPair _value;
1245 void SetName(
const char* str,
bool staticMem=
false ) {
1246 SetValue( str, staticMem );
1252 virtual const XMLElement* ToElement()
const {
1255 virtual bool Accept(
XMLVisitor* visitor )
const;
1280 const char* Attribute(
const char* name,
const char* value=0 )
const;
1288 int IntAttribute(
const char* name,
int defaultValue = 0)
const;
1290 unsigned UnsignedAttribute(
const char* name,
unsigned defaultValue = 0)
const;
1292 int64_t Int64Attribute(
const char* name, int64_t defaultValue = 0)
const;
1294 bool BoolAttribute(
const char* name,
bool defaultValue =
false)
const;
1296 double DoubleAttribute(
const char* name,
double defaultValue = 0)
const;
1298 float FloatAttribute(
const char* name,
float defaultValue = 0)
const;
1316 return XML_NO_ATTRIBUTE;
1325 return XML_NO_ATTRIBUTE;
1334 return XML_NO_ATTRIBUTE;
1343 return XML_NO_ATTRIBUTE;
1351 return XML_NO_ATTRIBUTE;
1359 return XML_NO_ATTRIBUTE;
1383 return QueryIntAttribute( name, value );
1386 int QueryAttribute(
const char* name,
unsigned int* value )
const {
1387 return QueryUnsignedAttribute( name, value );
1390 int QueryAttribute(
const char* name, int64_t* value)
const {
1391 return QueryInt64Attribute(name, value);
1394 int QueryAttribute(
const char* name,
bool* value )
const {
1395 return QueryBoolAttribute( name, value );
1398 int QueryAttribute(
const char* name,
double* value )
const {
1399 return QueryDoubleAttribute( name, value );
1402 int QueryAttribute(
const char* name,
float* value )
const {
1403 return QueryFloatAttribute( name, value );
1447 void DeleteAttribute(
const char* name );
1451 return _rootAttribute;
1454 const XMLAttribute* FindAttribute(
const char* name )
const;
1484 const char* GetText()
const;
1520 void SetText(
const char* inText );
1522 void SetText(
int value );
1524 void SetText(
unsigned value );
1526 void SetText(int64_t value);
1528 void SetText(
bool value );
1530 void SetText(
double value );
1532 void SetText(
float value );
1560 XMLError QueryIntText(
int* ival )
const;
1562 XMLError QueryUnsignedText(
unsigned* uval )
const;
1564 XMLError QueryInt64Text(int64_t* uval)
const;
1566 XMLError QueryBoolText(
bool* bval )
const;
1568 XMLError QueryDoubleText(
double* dval )
const;
1570 XMLError QueryFloatText(
float* fval )
const;
1572 int IntText(
int defaultValue = 0)
const;
1575 unsigned UnsignedText(
unsigned defaultValue = 0)
const;
1577 int64_t Int64Text(int64_t defaultValue = 0)
const;
1579 bool BoolText(
bool defaultValue =
false)
const;
1581 double DoubleText(
double defaultValue = 0)
const;
1583 float FloatText(
float defaultValue = 0)
const;
1586 enum ElementClosingType {
1591 ElementClosingType ClosingType()
const {
1592 return _closingType;
1595 virtual bool ShallowEqual(
const XMLNode* compare )
const;
1598 char* ParseDeep(
char* p, StrPair* parentEndTag,
int* curLineNumPtr );
1609 XMLAttribute* FindOrCreateAttribute(
const char* name );
1611 char* ParseAttributes(
char* p,
int* curLineNumPtr );
1612 static void DeleteAttribute(
XMLAttribute* attribute );
1615 enum { BUF_SIZE = 200 };
1616 ElementClosingType _closingType;
1625 PRESERVE_WHITESPACE,
1647 XMLDocument(
bool processEntities =
true, Whitespace whitespaceMode = PRESERVE_WHITESPACE );
1651 TIXMLASSERT(
this == _document );
1655 TIXMLASSERT(
this == _document );
1669 XMLError Parse(
const char* xml,
size_t nBytes=(
size_t)(-1) );
1676 XMLError LoadFile(
const char* filename );
1689 XMLError LoadFile( FILE* );
1696 XMLError SaveFile(
const char* filename,
bool compact =
false );
1705 XMLError SaveFile( FILE* fp,
bool compact =
false );
1707 bool ProcessEntities()
const {
1708 return _processEntities;
1710 Whitespace WhitespaceMode()
const {
1711 return _whitespaceMode;
1730 return FirstChildElement();
1733 return FirstChildElement();
1751 virtual bool Accept(
XMLVisitor* visitor )
const;
1764 XMLComment* NewComment(
const char* comment );
1770 XMLText* NewText(
const char* text );
1794 void DeleteNode(
XMLNode* node );
1797 SetError(XML_SUCCESS, 0, 0);
1802 return _errorID != XML_SUCCESS;
1808 const char* ErrorName()
const;
1809 static const char* ErrorIDToName(XMLError errorID);
1814 const char* ErrorStr()
const;
1817 void PrintError()
const;
1822 return _errorLineNum;
1838 char* Identify(
char* p,
XMLNode** node );
1855 bool _processEntities;
1857 Whitespace _whitespaceMode;
1858 mutable StrPair _errorStr;
1861 int _parseCurLineNum;
1868 DynArray<XMLNode*, 10> _unlinked;
1870 MemPoolT< sizeof(XMLElement) > _elementPool;
1871 MemPoolT< sizeof(XMLAttribute) > _attributePool;
1872 MemPoolT< sizeof(XMLText) > _textPool;
1873 MemPoolT< sizeof(XMLComment) > _commentPool;
1875 static const char* _errorNames[XML_ERROR_COUNT];
1879 void SetError( XMLError error,
int lineNum,
const char* format, ... );
1881 template<
class NodeType,
int PoolElementSize>
1882 NodeType* CreateUnlinkedNode( MemPoolT<PoolElementSize>& pool );
1885 template<
class NodeType,
int PoolElementSize>
1886 inline NodeType* XMLDocument::CreateUnlinkedNode( MemPoolT<PoolElementSize>& pool )
1888 TIXMLASSERT(
sizeof( NodeType ) == PoolElementSize );
1889 TIXMLASSERT(
sizeof( NodeType ) == pool.ItemSize() );
1890 NodeType* returnNode =
new (pool.Alloc()) NodeType(
this );
1891 TIXMLASSERT( returnNode );
1892 returnNode->_memPool = &pool;
1894 _unlinked.Push(returnNode);
1973 return XMLHandle( _node ? _node->FirstChild() : 0 );
1977 return XMLHandle( _node ? _node->FirstChildElement( name ) : 0 );
1981 return XMLHandle( _node ? _node->LastChild() : 0 );
1985 return XMLHandle( _node ? _node->LastChildElement( name ) : 0 );
1989 return XMLHandle( _node ? _node->PreviousSibling() : 0 );
1993 return XMLHandle( _node ? _node->PreviousSiblingElement( name ) : 0 );
1997 return XMLHandle( _node ? _node->NextSibling() : 0 );
2001 return XMLHandle( _node ? _node->NextSiblingElement( name ) : 0 );
2010 return ( _node ? _node->ToElement() : 0 );
2014 return ( _node ? _node->ToText() : 0 );
2018 return ( _node ? _node->ToUnknown() : 0 );
2022 return ( _node ? _node->ToDeclaration() : 0 );
2052 const XMLConstHandle FirstChildElement(
const char* name = 0 )
const {
2053 return XMLConstHandle( _node ? _node->FirstChildElement( name ) : 0 );
2058 const XMLConstHandle LastChildElement(
const char* name = 0 )
const {
2059 return XMLConstHandle( _node ? _node->LastChildElement( name ) : 0 );
2064 const XMLConstHandle PreviousSiblingElement(
const char* name = 0 )
const {
2065 return XMLConstHandle( _node ? _node->PreviousSiblingElement( name ) : 0 );
2070 const XMLConstHandle NextSiblingElement(
const char* name = 0 )
const {
2071 return XMLConstHandle( _node ? _node->NextSiblingElement( name ) : 0 );
2075 const XMLNode* ToNode()
const {
2079 return ( _node ? _node->ToElement() : 0 );
2081 const XMLText* ToText()
const {
2082 return ( _node ? _node->ToText() : 0 );
2085 return ( _node ? _node->ToUnknown() : 0 );
2088 return ( _node ? _node->ToDeclaration() : 0 );
2147 XMLPrinter( FILE* file=0,
bool compact =
false,
int depth = 0 );
2151 void PushHeader(
bool writeBOM,
bool writeDeclaration );
2155 void OpenElement(
const char* name,
bool compactMode=
false );
2157 void PushAttribute(
const char* name,
const char* value );
2158 void PushAttribute(
const char* name,
int value );
2159 void PushAttribute(
const char* name,
unsigned value );
2160 void PushAttribute(
const char* name, int64_t value);
2161 void PushAttribute(
const char* name,
bool value );
2162 void PushAttribute(
const char* name,
double value );
2164 virtual void CloseElement(
bool compactMode=
false );
2167 void PushText(
const char* text,
bool cdata=
false );
2169 void PushText(
int value );
2171 void PushText(
unsigned value );
2173 void PushText(int64_t value);
2175 void PushText(
bool value );
2177 void PushText(
float value );
2179 void PushText(
double value );
2182 void PushComment(
const char* comment );
2184 void PushDeclaration(
const char* value );
2185 void PushUnknown(
const char* value );
2193 virtual bool VisitExit(
const XMLElement& element );
2195 virtual bool Visit(
const XMLText& text );
2196 virtual bool Visit(
const XMLComment& comment );
2198 virtual bool Visit(
const XMLUnknown& unknown );
2205 return _buffer.Mem();
2213 return _buffer.Size();
2222 _firstElement =
true;
2226 virtual bool CompactMode(
const XMLElement& ) {
return _compactMode; }
2231 virtual void PrintSpace(
int depth );
2232 void Print(
const char* format, ... );
2233 void Write(
const char* data,
size_t size );
2234 inline void Write(
const char* data ) { Write( data, strlen( data ) ); }
2235 void Putc(
char ch );
2237 void SealElementIfJustOpened();
2238 bool _elementJustOpened;
2239 DynArray< const char*, 10 > _stack;
2242 void PrintString(
const char*,
bool restrictedEntitySet );
2248 bool _processEntities;
2255 bool _entityFlag[ENTITY_RANGE];
2256 bool _restrictedEntityFlag[ENTITY_RANGE];
2258 DynArray< char, 20 > _buffer;
2268 #if defined(_MSC_VER) 2269 # pragma warning(pop) 2272 #endif // TINYXML2_INCLUDED XMLError QueryInt64Attribute(const char *name, int64_t *value) const
See QueryIntAttribute()
Definition: tinyxml2.h:1331
XMLError QueryIntValue(int *value) const
XMLError QueryBoolAttribute(const char *name, bool *value) const
See QueryIntAttribute()
Definition: tinyxml2.h:1340
virtual bool VisitExit(const XMLDocument &)
Visit a document.
Definition: tinyxml2.h:478
virtual XMLNode * ShallowClone(XMLDocument *) const
Definition: tinyxml2.h:1843
virtual bool ShallowEqual(const XMLNode *) const
Definition: tinyxml2.h:1846
XMLHandle FirstChildElement(const char *name=0)
Get the first child element of this handle.
Definition: tinyxml2.h:1976
XMLText * ToText()
Safe cast to XMLText. This can return null.
Definition: tinyxml2.h:2013
XMLError QueryFloatValue(float *value) const
See QueryIntValue.
const char * CStr() const
Definition: tinyxml2.h:2204
XMLError ErrorID() const
Return the errorID.
Definition: tinyxml2.h:1805
XMLElement * ToElement()
Safe cast to XMLElement. This can return null.
Definition: tinyxml2.h:2009
virtual XMLElement * ToElement()
Safely cast to an Element, or null.
Definition: tinyxml2.h:674
virtual XMLText * ToText()
Safely cast to Text, or null.
Definition: tinyxml2.h:678
XMLError QueryUnsignedAttribute(const char *name, unsigned int *value) const
See QueryIntAttribute()
Definition: tinyxml2.h:1322
int CStrSize() const
Definition: tinyxml2.h:2212
float FloatValue() const
Query as a float. See IntValue()
Definition: tinyxml2.h:1175
virtual XMLDocument * ToDocument()
Safely cast to a Document, or null.
Definition: tinyxml2.h:1650
XMLUnknown * ToUnknown()
Safe cast to XMLUnknown. This can return null.
Definition: tinyxml2.h:2017
const char * Name() const
Get the name of an element (which is the Value() of the node.)
Definition: tinyxml2.h:1241
XMLHandle(const XMLHandle &ref)
Copy constructor.
Definition: tinyxml2.h:1963
XMLHandle FirstChild()
Get the first child of this handle.
Definition: tinyxml2.h:1972
void SetCData(bool isCData)
Declare whether this should be CDATA or standard text.
Definition: tinyxml2.h:987
void SetUserData(void *userData)
Definition: tinyxml2.h:921
const XMLNode * NextSibling() const
Get the next (right) sibling node of this node.
Definition: tinyxml2.h:803
unsigned UnsignedValue() const
Query as an unsigned integer. See IntValue()
Definition: tinyxml2.h:1157
XMLHandle LastChildElement(const char *name=0)
Get the last child element of this handle.
Definition: tinyxml2.h:1984
XMLHandle LastChild()
Get the last child of this handle.
Definition: tinyxml2.h:1980
Definition: tinyxml2.h:1953
Definition: tinyxml2.h:1052
XMLElement * RootElement()
Definition: tinyxml2.h:1729
int QueryAttribute(const char *name, int *value) const
Definition: tinyxml2.h:1382
virtual XMLText * ToText()
Safely cast to Text, or null.
Definition: tinyxml2.h:979
XMLHandle(XMLNode &node)
Create a handle from a node.
Definition: tinyxml2.h:1960
void SetName(const char *str, bool staticMem=false)
Set the name of the element.
Definition: tinyxml2.h:1245
void SetBOM(bool useBOM)
Definition: tinyxml2.h:1722
XMLHandle(XMLNode *node)
Create a handle from any node (at any depth of the tree.) This can be a null pointer.
Definition: tinyxml2.h:1957
void ClearBuffer()
Definition: tinyxml2.h:2219
virtual XMLElement * ToElement()
Safely cast to an Element, or null.
Definition: tinyxml2.h:1249
bool HasBOM() const
Definition: tinyxml2.h:1717
Definition: tinyxml2.h:105
XMLError QueryFloatAttribute(const char *name, float *value) const
See QueryIntAttribute()
Definition: tinyxml2.h:1356
XMLError QueryUnsignedValue(unsigned int *value) const
See QueryIntValue.
XMLNode * ToNode()
Safe cast to XMLNode. This can return null.
Definition: tinyxml2.h:2005
bool BoolValue() const
Query as a boolean. See IntValue()
Definition: tinyxml2.h:1163
const XMLNode * FirstChild() const
Get the first child node, or null if none exists.
Definition: tinyxml2.h:751
virtual XMLDeclaration * ToDeclaration()
Safely cast to a Declaration, or null.
Definition: tinyxml2.h:1056
virtual bool Visit(const XMLDeclaration &)
Visit a declaration.
Definition: tinyxml2.h:492
virtual bool Visit(const XMLUnknown &)
Visit an unknown node.
Definition: tinyxml2.h:504
void SetAttribute(const char *name, unsigned value)
Sets the named attribute to value.
Definition: tinyxml2.h:1417
XMLError QueryDoubleAttribute(const char *name, double *value) const
See QueryIntAttribute()
Definition: tinyxml2.h:1348
Definition: tinyxml2.h:1236
XMLError QueryInt64Value(int64_t *value) const
See QueryIntValue.
XMLHandle NextSibling()
Get the next sibling of this handle.
Definition: tinyxml2.h:1996
int GetLineNum() const
Gets the line number the attribute is in, if the document was parsed from a file. ...
Definition: tinyxml2.h:1133
int IntValue() const
Definition: tinyxml2.h:1144
virtual XMLUnknown * ToUnknown()
Safely cast to an Unknown, or null.
Definition: tinyxml2.h:1091
bool CData() const
Returns true if this is a CDATA text element.
Definition: tinyxml2.h:991
XMLHandle PreviousSibling()
Get the previous sibling of this handle.
Definition: tinyxml2.h:1988
Definition: tinyxml2.h:2034
XMLHandle & operator=(const XMLHandle &ref)
Assignment.
Definition: tinyxml2.h:1966
virtual bool VisitExit(const XMLDocument &)
Visit a document.
Definition: tinyxml2.h:2188
virtual bool VisitEnter(const XMLElement &, const XMLAttribute *)
Visit an element.
Definition: tinyxml2.h:483
bool Error() const
Return true if there was an error parsing the document.
Definition: tinyxml2.h:1801
virtual bool VisitEnter(const XMLDocument &)
Visit a document.
Definition: tinyxml2.h:474
Definition: tinyxml2.h:1087
virtual XMLDocument * ToDocument()
Safely cast to a Document, or null.
Definition: tinyxml2.h:686
const XMLNode * LastChild() const
Get the last child node, or null if none exists.
Definition: tinyxml2.h:769
Definition: tinyxml2.h:1122
void SetAttribute(const char *name, bool value)
Sets the named attribute to value.
Definition: tinyxml2.h:1429
XMLDeclaration * ToDeclaration()
Safe cast to XMLDeclaration. This can return null.
Definition: tinyxml2.h:2021
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:1407
virtual bool VisitExit(const XMLElement &)
Visit an element.
Definition: tinyxml2.h:487
Definition: tinyxml2.h:2138
Definition: tinyxml2.h:1635
void * GetUserData() const
Definition: tinyxml2.h:928
void SetAttribute(const char *name, int64_t value)
Sets the named attribute to value.
Definition: tinyxml2.h:1423
void SetAttribute(const char *name, double value)
Sets the named attribute to value.
Definition: tinyxml2.h:1434
XMLError QueryDoubleValue(double *value) const
See QueryIntValue.
const XMLNode * Parent() const
Get the parent of this node on the DOM.
Definition: tinyxml2.h:737
virtual bool Visit(const XMLComment &)
Visit a comment node.
Definition: tinyxml2.h:500
XMLError QueryBoolValue(bool *value) const
See QueryIntValue.
const XMLNode * PreviousSibling() const
Get the previous (left) sibling node of this node.
Definition: tinyxml2.h:787
XMLHandle NextSiblingElement(const char *name=0)
Get the next sibling element of this handle.
Definition: tinyxml2.h:2000
Definition: tinyxml2.h:656
XMLError QueryIntAttribute(const char *name, int *value) const
Definition: tinyxml2.h:1313
int GetLineNum() const
Gets the line number the node is in, if the document was parsed from a file.
Definition: tinyxml2.h:734
virtual bool Visit(const XMLText &)
Visit a text node.
Definition: tinyxml2.h:496
Definition: tinyxml2.h:973
Definition: tinyxml2.h:468
int ErrorLineNum() const
Return the line where the error occured, or zero if unknown.
Definition: tinyxml2.h:1820
XMLDocument * GetDocument()
Get the XMLDocument that owns this XMLNode.
Definition: tinyxml2.h:668
virtual XMLUnknown * ToUnknown()
Safely cast to an Unknown, or null.
Definition: tinyxml2.h:694
void SetAttribute(const char *name, float value)
Sets the named attribute to value.
Definition: tinyxml2.h:1439
const XMLAttribute * Next() const
The next attribute in the list.
Definition: tinyxml2.h:1136
bool NoChildren() const
Returns true if this node has no children.
Definition: tinyxml2.h:746
double DoubleValue() const
Query as a double. See IntValue()
Definition: tinyxml2.h:1169
virtual XMLDeclaration * ToDeclaration()
Safely cast to a Declaration, or null.
Definition: tinyxml2.h:690
const XMLDocument * GetDocument() const
Get the XMLDocument that owns this XMLNode.
Definition: tinyxml2.h:663
XMLHandle PreviousSiblingElement(const char *name=0)
Get the previous sibling element of this handle.
Definition: tinyxml2.h:1992
void SetAttribute(const char *name, int value)
Sets the named attribute to value.
Definition: tinyxml2.h:1412
const XMLAttribute * FirstAttribute() const
Return the first attribute in the list.
Definition: tinyxml2.h:1450
virtual XMLComment * ToComment()
Safely cast to a Comment, or null.
Definition: tinyxml2.h:682