24 #ifndef TINYXML2_INCLUDED 25 #define TINYXML2_INCLUDED 27 #if defined(ANDROID_NDK) || defined(__BORLANDC__) || defined(__QNXNTO__) 56 #if defined( _DEBUG ) || defined (__DEBUG__) 57 # ifndef TINYXML2_DEBUG 58 # define TINYXML2_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"))) 82 #if !defined(TIXMLASSERT) 83 #if defined(TINYXML2_DEBUG) 84 # if defined(_MSC_VER) 85 # // "(void)0," is for suppressing C4127 warning in "assert(false)", "assert(true)" and the like 86 # define TIXMLASSERT( x ) if ( !((void)0,(x))) { __debugbreak(); } 87 # elif defined (ANDROID_NDK) 88 # include <android/log.h> 89 # define TIXMLASSERT( x ) if ( !(x)) { __android_log_assert( "assert", "grinliz", "ASSERT in '%s' at %d.", __FILE__, __LINE__ ); } 92 # define TIXMLASSERT assert 95 # define TIXMLASSERT( x ) {} 106 #define TINYXML2_MAJOR_VERSION 9 107 #define TINYXML2_MINOR_VERSION 0 108 #define TINYXML2_PATCH_VERSION 0 124 class XMLDeclaration;
140 NEEDS_ENTITY_PROCESSING = 0x01,
141 NEEDS_NEWLINE_NORMALIZATION = 0x02,
142 NEEDS_WHITESPACE_COLLAPSING = 0x04,
144 TEXT_ELEMENT = NEEDS_ENTITY_PROCESSING | NEEDS_NEWLINE_NORMALIZATION,
145 TEXT_ELEMENT_LEAVE_ENTITIES = NEEDS_NEWLINE_NORMALIZATION,
147 ATTRIBUTE_VALUE = NEEDS_ENTITY_PROCESSING | NEEDS_NEWLINE_NORMALIZATION,
148 ATTRIBUTE_VALUE_LEAVE_ENTITIES = NEEDS_NEWLINE_NORMALIZATION,
149 COMMENT = NEEDS_NEWLINE_NORMALIZATION
152 StrPair() : _flags( 0 ), _start( 0 ), _end( 0 ) {}
155 void Set(
char* start,
char* end,
int flags ) {
161 _flags = flags | NEEDS_FLUSH;
164 const char* GetStr();
167 return _start == _end;
172 _start =
const_cast<char*
>(str);
175 void SetStr(
const char* str,
int flags=0 );
177 char* ParseText(
char* in,
const char* endTag,
int strFlags,
int* curLineNumPtr );
178 char* ParseName(
char* in );
180 void TransferTo(
StrPair* other );
184 void CollapseWhitespace();
196 void operator=(
const StrPair& other );
205 template <
class T,
int INITIAL_SIZE>
211 _allocated( INITIAL_SIZE ),
217 if ( _mem != _pool ) {
228 EnsureCapacity( _size+1 );
236 EnsureCapacity( _size+count );
237 T* ret = &_mem[_size];
269 return _mem[ _size - 1];
285 _mem[i] = _mem[_size - 1];
305 if ( cap > _allocated ) {
307 const int newAllocated = cap * 2;
308 T* newMem =
new T[newAllocated];
310 memcpy( newMem, _mem,
sizeof(T)*_size );
311 if ( _mem != _pool ) {
315 _allocated = newAllocated;
320 T _pool[INITIAL_SIZE];
336 virtual int ItemSize()
const = 0;
337 virtual void* Alloc() = 0;
338 virtual void Free(
void* ) = 0;
339 virtual void SetTracked() = 0;
346 template<
int ITEM_SIZE >
350 MemPoolT() : _blockPtrs(), _root(0), _currentAllocs(0), _nAllocs(0), _maxAllocs(0), _nUntracked(0) {}
357 while( !_blockPtrs.Empty()) {
358 Block* lastBlock = _blockPtrs.Pop();
372 return _currentAllocs;
378 Block* block =
new Block();
379 _blockPtrs.Push( block );
381 Item* blockItems = block->items;
382 for(
int i = 0; i < ITEMS_PER_BLOCK - 1; ++i ) {
383 blockItems[i].next = &(blockItems[i + 1]);
385 blockItems[ITEMS_PER_BLOCK - 1].next = 0;
388 Item*
const result = _root;
393 if ( _currentAllocs > _maxAllocs ) {
394 _maxAllocs = _currentAllocs;
401 virtual void Free(
void* mem ) {
406 Item* item =
static_cast<Item*
>( mem );
407 #ifdef TINYXML2_DEBUG 408 memset( item, 0xfe,
sizeof( *item ) );
414 printf(
"Mempool %s watermark=%d [%dk] current=%d size=%d nAlloc=%d blocks=%d\n",
415 name, _maxAllocs, _maxAllocs * ITEM_SIZE / 1024, _currentAllocs,
416 ITEM_SIZE, _nAllocs, _blockPtrs.Size() );
438 enum { ITEMS_PER_BLOCK = (4 * 1024) / ITEM_SIZE };
446 char itemData[ITEM_SIZE];
557 while( IsWhiteSpace(*p) ) {
558 if (curLineNumPtr && *p ==
'\n') {
567 return const_cast<char*
>( SkipWhiteSpace( const_cast<const char*>(p), curLineNumPtr ) );
573 return !IsUTF8Continuation(p) && isspace( static_cast<unsigned char>(p) );
581 if ( isalpha( ch ) ) {
584 return ch ==
':' || ch ==
'_';
588 return IsNameStartChar( ch )
595 p = SkipWhiteSpace(p, 0);
596 return p && *p ==
'0' && ( *(p + 1) ==
'x' || *(p + 1) ==
'X');
599 inline static bool StringEqual(
const char* p,
const char* q,
int nChar=INT_MAX ) {
606 return strncmp( p, q, nChar ) == 0;
610 return ( p & 0x80 ) != 0;
613 static const char* ReadBOM(
const char* p,
bool* hasBOM );
616 static const char* GetCharacterRef(
const char* p,
char* value,
int* length );
617 static void ConvertUTF32ToUTF8(
unsigned long input,
char* output,
int* length );
620 static void ToStr(
int v,
char*
buffer,
int bufferSize );
621 static void ToStr(
unsigned v,
char* buffer,
int bufferSize );
622 static void ToStr(
bool v,
char* buffer,
int bufferSize );
623 static void ToStr(
float v,
char* buffer,
int bufferSize );
624 static void ToStr(
double v,
char* buffer,
int bufferSize );
625 static void ToStr(int64_t v,
char* buffer,
int bufferSize);
626 static void ToStr(uint64_t v,
char* buffer,
int bufferSize);
629 static bool ToInt(
const char* str,
int* value );
630 static bool ToUnsigned(
const char* str,
unsigned* value );
631 static bool ToBool(
const char* str,
bool* value );
632 static bool ToFloat(
const char* str,
float* value );
633 static bool ToDouble(
const char* str,
double* value );
634 static bool ToInt64(
const char* str, int64_t* value);
635 static bool ToUnsigned64(
const char* str, uint64_t* value);
641 static void SetBoolSerialization(
const char* writeTrue,
const char* writeFalse);
744 const char* Value()
const;
749 void SetValue(
const char* val,
bool staticMem=
false );
780 const XMLElement* FirstChildElement(
const char* name = 0 )
const;
783 return const_cast<XMLElement*
>(
const_cast<const XMLNode*
>(
this)->FirstChildElement( name ));
798 const XMLElement* LastChildElement(
const char* name = 0 )
const;
801 return const_cast<XMLElement*
>(
const_cast<const XMLNode*
>(
this)->LastChildElement(name) );
814 const XMLElement* PreviousSiblingElement(
const char* name = 0 )
const ;
817 return const_cast<XMLElement*
>(
const_cast<const XMLNode*
>(
this)->PreviousSiblingElement( name ) );
830 const XMLElement* NextSiblingElement(
const char* name = 0 )
const;
833 return const_cast<XMLElement*
>(
const_cast<const XMLNode*
>(
this)->NextSiblingElement( name ) );
846 return InsertEndChild( addThis );
869 void DeleteChildren();
874 void DeleteChild(
XMLNode* node );
908 virtual bool ShallowEqual(
const XMLNode* compare )
const = 0;
932 virtual bool Accept(
XMLVisitor* visitor )
const = 0;
952 virtual char* ParseDeep(
char* p,
StrPair* parentEndTag,
int* curLineNumPtr);
970 static void DeleteNode(
XMLNode* node );
971 void InsertChildPreamble(
XMLNode* insertThis )
const;
972 const XMLElement* ToElementWithName(
const char* name )
const;
995 virtual bool Accept(
XMLVisitor* visitor )
const;
1014 virtual bool ShallowEqual(
const XMLNode* compare )
const;
1020 char* ParseDeep(
char* p,
StrPair* parentEndTag,
int* curLineNumPtr );
1042 virtual bool Accept(
XMLVisitor* visitor )
const;
1045 virtual bool ShallowEqual(
const XMLNode* compare )
const;
1051 char* ParseDeep(
char* p,
StrPair* parentEndTag,
int* curLineNumPtr);
1081 virtual bool Accept(
XMLVisitor* visitor )
const;
1084 virtual bool ShallowEqual(
const XMLNode* compare )
const;
1090 char* ParseDeep(
char* p,
StrPair* parentEndTag,
int* curLineNumPtr );
1116 virtual bool Accept(
XMLVisitor* visitor )
const;
1119 virtual bool ShallowEqual(
const XMLNode* compare )
const;
1125 char* ParseDeep(
char* p,
StrPair* parentEndTag,
int* curLineNumPtr );
1145 const char* Name()
const;
1148 const char* Value()
const;
1170 QueryInt64Value(&i);
1176 QueryUnsigned64Value(&i);
1183 QueryUnsignedValue( &i );
1189 QueryBoolValue( &b );
1195 QueryDoubleValue( &d );
1201 QueryFloatValue( &f );
1209 XMLError QueryIntValue(
int* value )
const;
1211 XMLError QueryUnsignedValue(
unsigned int* value )
const;
1213 XMLError QueryInt64Value(int64_t* value)
const;
1215 XMLError QueryUnsigned64Value(uint64_t* value)
const;
1217 XMLError QueryBoolValue(
bool* value )
const;
1219 XMLError QueryDoubleValue(
double* value )
const;
1221 XMLError QueryFloatValue(
float* value )
const;
1224 void SetAttribute(
const char* value );
1226 void SetAttribute(
int value );
1228 void SetAttribute(
unsigned value );
1230 void SetAttribute(int64_t value);
1232 void SetAttribute(uint64_t value);
1234 void SetAttribute(
bool value );
1236 void SetAttribute(
double value );
1238 void SetAttribute(
float value );
1241 enum { BUF_SIZE = 200 };
1243 XMLAttribute() : _name(), _value(),_parseLineNum( 0 ), _next( 0 ), _memPool( 0 ) {}
1248 void SetName(
const char* name );
1250 char* ParseDeep(
char* p,
bool processEntities,
int* curLineNumPtr );
1273 void SetName(
const char* str,
bool staticMem=
false ) {
1274 SetValue( str, staticMem );
1283 virtual bool Accept(
XMLVisitor* visitor )
const;
1308 const char* Attribute(
const char* name,
const char* value=0 )
const;
1316 int IntAttribute(
const char* name,
int defaultValue = 0)
const;
1318 unsigned UnsignedAttribute(
const char* name,
unsigned defaultValue = 0)
const;
1320 int64_t Int64Attribute(
const char* name, int64_t defaultValue = 0)
const;
1322 uint64_t Unsigned64Attribute(
const char* name, uint64_t defaultValue = 0)
const;
1324 bool BoolAttribute(
const char* name,
bool defaultValue =
false)
const;
1326 double DoubleAttribute(
const char* name,
double defaultValue = 0)
const;
1328 float FloatAttribute(
const char* name,
float defaultValue = 0)
const;
1409 *value = a->
Value();
1433 return QueryIntAttribute( name, value );
1437 return QueryUnsignedAttribute( name, value );
1441 return QueryInt64Attribute(name, value);
1445 return QueryUnsigned64Attribute(name, value);
1449 return QueryBoolAttribute( name, value );
1453 return QueryDoubleAttribute( name, value );
1457 return QueryFloatAttribute( name, value );
1461 return QueryStringAttribute(name, value);
1511 void DeleteAttribute(
const char* name );
1515 return _rootAttribute;
1518 const XMLAttribute* FindAttribute(
const char* name )
const;
1548 const char* GetText()
const;
1584 void SetText(
const char* inText );
1586 void SetText(
int value );
1588 void SetText(
unsigned value );
1590 void SetText(int64_t value);
1592 void SetText(uint64_t value);
1594 void SetText(
bool value );
1596 void SetText(
double value );
1598 void SetText(
float value );
1626 XMLError QueryIntText(
int* ival )
const;
1628 XMLError QueryUnsignedText(
unsigned* uval )
const;
1630 XMLError QueryInt64Text(int64_t* uval)
const;
1632 XMLError QueryUnsigned64Text(uint64_t* uval)
const;
1634 XMLError QueryBoolText(
bool* bval )
const;
1636 XMLError QueryDoubleText(
double* dval )
const;
1638 XMLError QueryFloatText(
float* fval )
const;
1640 int IntText(
int defaultValue = 0)
const;
1643 unsigned UnsignedText(
unsigned defaultValue = 0)
const;
1645 int64_t Int64Text(int64_t defaultValue = 0)
const;
1647 uint64_t Unsigned64Text(uint64_t defaultValue = 0)
const;
1649 bool BoolText(
bool defaultValue =
false)
const;
1651 double DoubleText(
double defaultValue = 0)
const;
1653 float FloatText(
float defaultValue = 0)
const;
1659 XMLElement* InsertNewChildElement(
const char* name);
1661 XMLComment* InsertNewComment(
const char* comment);
1663 XMLText* InsertNewText(
const char* text);
1667 XMLUnknown* InsertNewUnknown(
const char* text);
1677 return _closingType;
1680 virtual bool ShallowEqual(
const XMLNode* compare )
const;
1683 char* ParseDeep(
char* p,
StrPair* parentEndTag,
int* curLineNumPtr );
1691 XMLAttribute* FindOrCreateAttribute(
const char* name );
1692 char* ParseAttributes(
char* p,
int* curLineNumPtr );
1693 static void DeleteAttribute(
XMLAttribute* attribute );
1696 enum { BUF_SIZE = 200 };
1750 XMLError Parse(
const char* xml,
size_t nBytes=static_cast<size_t>(-1) );
1757 XMLError LoadFile(
const char* filename );
1777 XMLError SaveFile(
const char* filename,
bool compact =
false );
1786 XMLError SaveFile( FILE* fp,
bool compact =
false );
1789 return _processEntities;
1792 return _whitespaceMode;
1811 return FirstChildElement();
1814 return FirstChildElement();
1832 virtual bool Accept(
XMLVisitor* visitor )
const;
1845 XMLComment* NewComment(
const char* comment );
1851 XMLText* NewText(
const char* text );
1875 void DeleteNode(
XMLNode* node );
1888 const char* ErrorName()
const;
1889 static const char* ErrorIDToName(
XMLError errorID);
1894 const char* ErrorStr()
const;
1897 void PrintError()
const;
1902 return _errorLineNum;
1918 char* Identify(
char* p,
XMLNode** node );
1921 void MarkInUse(
const XMLNode*
const);
1960 void SetError(
XMLError error,
int lineNum,
const char* format, ... );
1968 this->_document = document;
1972 _document->PopDepth();
1980 template<
class NodeType,
int PoolElementSize>
1984 template<
class NodeType,
int PoolElementSize>
1991 returnNode->_memPool = &pool;
1993 _unlinked.Push(returnNode);
2072 return XMLHandle( _node ? _node->FirstChild() : 0 );
2076 return XMLHandle( _node ? _node->FirstChildElement( name ) : 0 );
2080 return XMLHandle( _node ? _node->LastChild() : 0 );
2084 return XMLHandle( _node ? _node->LastChildElement( name ) : 0 );
2088 return XMLHandle( _node ? _node->PreviousSibling() : 0 );
2092 return XMLHandle( _node ? _node->PreviousSiblingElement( name ) : 0 );
2096 return XMLHandle( _node ? _node->NextSibling() : 0 );
2100 return XMLHandle( _node ? _node->NextSiblingElement( name ) : 0 );
2109 return ( _node ? _node->ToElement() : 0 );
2113 return ( _node ? _node->ToText() : 0 );
2117 return ( _node ? _node->ToUnknown() : 0 );
2121 return ( _node ? _node->ToDeclaration() : 0 );
2152 return XMLConstHandle( _node ? _node->FirstChildElement( name ) : 0 );
2158 return XMLConstHandle( _node ? _node->LastChildElement( name ) : 0 );
2164 return XMLConstHandle( _node ? _node->PreviousSiblingElement( name ) : 0 );
2170 return XMLConstHandle( _node ? _node->NextSiblingElement( name ) : 0 );
2178 return ( _node ? _node->ToElement() : 0 );
2181 return ( _node ? _node->ToText() : 0 );
2184 return ( _node ? _node->ToUnknown() : 0 );
2187 return ( _node ? _node->ToDeclaration() : 0 );
2250 void PushHeader(
bool writeBOM,
bool writeDeclaration );
2254 void OpenElement(
const char* name,
bool compactMode=
false );
2256 void PushAttribute(
const char* name,
const char* value );
2257 void PushAttribute(
const char* name,
int value );
2258 void PushAttribute(
const char* name,
unsigned value );
2259 void PushAttribute(
const char* name, int64_t value );
2260 void PushAttribute(
const char* name, uint64_t value );
2261 void PushAttribute(
const char* name,
bool value );
2262 void PushAttribute(
const char* name,
double value );
2264 virtual void CloseElement(
bool compactMode=
false );
2267 void PushText(
const char* text,
bool cdata=
false );
2269 void PushText(
int value );
2271 void PushText(
unsigned value );
2273 void PushText( int64_t value );
2275 void PushText( uint64_t value );
2277 void PushText(
bool value );
2279 void PushText(
float value );
2281 void PushText(
double value );
2284 void PushComment(
const char* comment );
2286 void PushDeclaration(
const char* value );
2287 void PushUnknown(
const char* value );
2295 virtual bool VisitExit(
const XMLElement& element );
2297 virtual bool Visit(
const XMLText& text );
2298 virtual bool Visit(
const XMLComment& comment );
2300 virtual bool Visit(
const XMLUnknown& unknown );
2307 return _buffer.Mem();
2315 return _buffer.Size();
2324 _firstElement = resetToFirstElement;
2333 virtual void PrintSpace(
int depth );
2334 virtual void Print(
const char* format, ... );
2335 virtual void Write(
const char*
data,
size_t size );
2336 virtual void Putc(
char ch );
2338 inline void Write(
const char* data) {
Write(data, strlen(data)); }
2340 void SealElementIfJustOpened();
2349 void PrepareForNewNode(
bool compactMode );
2350 void PrintString(
const char*,
bool restrictedEntitySet );
2363 bool _entityFlag[ENTITY_RANGE];
2364 bool _restrictedEntityFlag[ENTITY_RANGE];
2376 #if defined(_MSC_VER) 2377 # pragma warning(pop) 2380 #endif // TINYXML2_INCLUDED virtual XMLElement * ToElement()
Safely cast to an Element, or null.
XMLError QueryDoubleValue(double *value) const
See QueryIntValue.
XMLError QueryAttribute(const char *name, int *value) const
const T * data(const std::vector< T, Alloc > &v)
void SetAttribute(const char *name, int64_t value)
Sets the named attribute to value.
int64_t Int64Value() const
const XMLConstHandle NextSibling() const
static const int TIXML2_PATCH_VERSION
NodeType * CreateUnlinkedNode(MemPoolT< PoolElementSize > &pool)
const char * Name() const
Get the name of an element (which is the Value() of the node.)
virtual XMLDocument * ToDocument()
Safely cast to a Document, or null.
XMLHandle(XMLNode *node)
Create a handle from any node (at any depth of the tree.) This can be a null pointer.
virtual const XMLElement * ToElement() const
XMLError QueryAttribute(const char *name, float *value) const
XMLElement * PreviousSiblingElement(const char *name=0)
const XMLNode * ToNode() const
XMLError QueryFloatAttribute(const char *name, float *value) const
See QueryIntAttribute()
static raw_event_t * buffer
XMLElement * LastChildElement(const char *name=0)
XMLAttribute * _rootAttribute
MemPoolT< sizeof(XMLAttribute) > _attributePool
double DoubleValue() const
Query as a double. See IntValue()
void SetAttribute(const char *name, unsigned value)
Sets the named attribute to value.
const XMLAttribute * FirstAttribute() const
Return the first attribute in the list.
virtual XMLComment * ToComment()
Safely cast to a Comment, or null.
unsigned UnsignedValue() const
Query as an unsigned integer. See IntValue()
XMLConstHandle & operator=(const XMLConstHandle &ref)
XMLError QueryAttribute(const char *name, double *value) const
virtual const XMLDeclaration * ToDeclaration() const
int GetLineNum() const
Gets the line number the node is in, if the document was parsed from a file.
virtual bool VisitEnter(const XMLElement &, const XMLAttribute *)
Visit an element.
static const char * SkipWhiteSpace(const char *p, int *curLineNumPtr)
void Set(char *start, char *end, int flags)
bool Error() const
Return true if there was an error parsing the document.
Whitespace WhitespaceMode() const
const XMLConstHandle LastChild() const
const XMLDocument * GetDocument() const
Get the XMLDocument that owns this XMLNode.
XMLError QueryDoubleAttribute(const char *name, double *value) const
See QueryIntAttribute()
static bool IsNameChar(unsigned char ch)
static bool IsWhiteSpace(char p)
const XMLConstHandle FirstChild() const
virtual const XMLComment * ToComment() const
XMLError QueryUnsigned64Value(uint64_t *value) const
See QueryIntValue.
XMLError QueryFloatValue(float *value) const
See QueryIntValue.
virtual XMLUnknown * ToUnknown()
Safely cast to an Unknown, or null.
virtual bool Visit(const XMLText &)
Visit a text node.
const XMLUnknown * ToUnknown() const
DepthTracker(XMLDocument *document)
XMLError ErrorID() const
Return the errorID.
XMLConstHandle(const XMLNode *node)
XMLNode * PreviousSibling()
virtual bool VisitExit(const XMLDocument &)
Visit a document.
virtual bool ShallowEqual(const XMLNode *) const
const T & operator[](int i) const
XMLConstHandle(const XMLNode &node)
const char * CStr() const
void SetAttribute(const char *value)
Set the attribute to a string value.
bool BoolValue() const
Query as a boolean. See IntValue()
const XMLConstHandle PreviousSiblingElement(const char *name=0) const
virtual XMLText * ToText()
Safely cast to Text, or null.
const XMLConstHandle LastChildElement(const char *name=0) const
virtual bool Visit(const XMLComment &)
Visit a comment node.
XMLHandle LastChild()
Get the last child of this handle.
void Write(const char *data)
static const char * writeBoolTrue
XMLError QueryAttribute(const char *name, unsigned int *value) const
const XMLText * ToText() const
virtual const XMLDocument * ToDocument() const
void SetAttribute(const char *name, const char *value)
Sets the named attribute to value.
const XMLNode * LastChild() const
Get the last child node, or null if none exists.
const XMLNode * Parent() const
Get the parent of this node on the DOM.
XMLHandle FirstChildElement(const char *name=0)
Get the first child element of this handle.
static const int TIXML2_MINOR_VERSION
XMLHandle & operator=(const XMLHandle &ref)
Assignment.
DynArray< char, 20 > _buffer
virtual const XMLText * ToText() const
XMLElement * RootElement()
const XMLElement * RootElement() const
static char * SkipWhiteSpace(char *const p, int *curLineNumPtr)
XMLHandle NextSiblingElement(const char *name=0)
Get the next sibling element of this handle.
const XMLNode * FirstChild() const
Get the first child node, or null if none exists.
void * GetUserData() const
virtual const XMLUnknown * ToUnknown() const
virtual const XMLText * ToText() const
void SetName(const char *str, bool staticMem=false)
Set the name of the element.
static bool IsUTF8Continuation(const char p)
const XMLConstHandle PreviousSibling() const
XMLError QueryUnsigned64Attribute(const char *name, uint64_t *value) const
See QueryIntAttribute()
void SetAttribute(const char *name, double value)
Sets the named attribute to value.
void ClearBuffer(bool resetToFirstElement=true)
static const int TIXML2_MAJOR_VERSION
const XMLNode * NextSibling() const
Get the next (right) sibling node of this node.
MemPoolT< sizeof(XMLComment) > _commentPool
const XMLConstHandle FirstChildElement(const char *name=0) const
const char * Value() const
The value of the attribute.
XMLHandle LastChildElement(const char *name=0)
Get the last child element of this handle.
void EnsureCapacity(int cap)
int CurrentAllocs() const
virtual XMLNode * ShallowClone(XMLDocument *) const
virtual bool VisitExit(const XMLDocument &)
Visit a document.
XMLHandle(XMLNode &node)
Create a handle from a node.
void SetCData(bool isCData)
Declare whether this should be CDATA or standard text.
XMLDocument * GetDocument()
Get the XMLDocument that owns this XMLNode.
const XMLConstHandle NextSiblingElement(const char *name=0) const
XMLError QueryInt64Attribute(const char *name, int64_t *value) const
See QueryIntAttribute()
int ErrorLineNum() const
Return the line where the error occurred, or zero if unknown.
virtual int ItemSize() const
XMLError QueryIntValue(int *value) const
XMLError QueryUnsignedValue(unsigned int *value) const
See QueryIntValue.
virtual XMLDeclaration * ToDeclaration()
Safely cast to a Declaration, or null.
virtual XMLUnknown * ToUnknown()
Safely cast to an Unknown, or null.
ElementClosingType _closingType
static bool StringEqual(const char *p, const char *q, int nChar=INT_MAX)
virtual bool VisitExit(const XMLElement &)
Visit an element.
XMLError QueryStringAttribute(const char *name, const char **value) const
See QueryIntAttribute()
virtual bool Visit(const XMLUnknown &)
Visit an unknown node.
XMLConstHandle(const XMLConstHandle &ref)
XMLError QueryIntAttribute(const char *name, int *value) const
XMLElement * NextSiblingElement(const char *name=0)
XMLNode * LinkEndChild(XMLNode *addThis)
const XMLAttribute * Next() const
The next attribute in the list.
XMLElement * FirstChildElement(const char *name=0)
void SetAttribute(const char *name, bool value)
Sets the named attribute to value.
void SetAttribute(const char *name, float value)
Sets the named attribute to value.
static volatile int count
uint64_t Unsigned64Value() const
DynArray< const char *, 10 > _stack
XMLNode * ToNode()
Safe cast to XMLNode. This can return null.
void SetUserData(void *userData)
XMLHandle NextSibling()
Get the next sibling of this handle.
DynArray< XMLNode *, 10 > _unlinked
XMLError QueryInt64Value(int64_t *value) const
See QueryIntValue.
float FloatValue() const
Query as a float. See IntValue()
DynArray< Block *, 10 > _blockPtrs
XMLText(XMLDocument *doc)
static bool IsNameStartChar(unsigned char ch)
virtual XMLText * ToText()
Safely cast to Text, or null.
void SetAttribute(const char *name, int value)
Sets the named attribute to value.
virtual void Free(void *mem)
bool CData() const
Returns true if this is a CDATA text element.
XMLText * ToText()
Safe cast to XMLText. This can return null.
void SetAttribute(const char *name, uint64_t value)
Sets the named attribute to value.
XMLError QueryBoolValue(bool *value) const
See QueryIntValue.
virtual const XMLDeclaration * ToDeclaration() const
XMLError QueryBoolAttribute(const char *name, bool *value) const
See QueryIntAttribute()
const T & PeekTop() const
virtual bool CompactMode(const XMLElement &)
XMLHandle PreviousSibling()
Get the previous sibling of this handle.
MemPoolT< sizeof(XMLText) > _textPool
XMLDeclaration * ToDeclaration()
Safe cast to XMLDeclaration. This can return null.
MemPoolT< sizeof(XMLElement) > _elementPool
ElementClosingType ClosingType() const
XMLUnknown * ToUnknown()
Safe cast to XMLUnknown. This can return null.
static const char * writeBoolFalse
bool NoChildren() const
Returns true if this node has no children.
XMLHandle FirstChild()
Get the first child of this handle.
XMLError QueryAttribute(const char *name, int64_t *value) const
XMLError QueryAttribute(const char *name, uint64_t *value) const
XMLElement * ToElement()
Safe cast to XMLElement. This can return null.
XMLHandle PreviousSiblingElement(const char *name=0)
Get the previous sibling element of this handle.
int GetLineNum() const
Gets the line number the attribute is in, if the document was parsed from a file. ...
const XMLNode * PreviousSibling() const
Get the previous (left) sibling node of this node.
virtual bool Visit(const XMLDeclaration &)
Visit a declaration.
XMLError QueryAttribute(const char *name, bool *value) const
XMLError QueryUnsignedAttribute(const char *name, unsigned int *value) const
See QueryIntAttribute()
Whitespace _whitespaceMode
virtual bool VisitEnter(const XMLDocument &)
Visit a document.
bool ProcessEntities() const
virtual XMLDocument * ToDocument()
Safely cast to a Document, or null.
NodeType
Enumerates the possible types of nodes.
virtual const XMLUnknown * ToUnknown() const
virtual XMLDeclaration * ToDeclaration()
Safely cast to a Declaration, or null.
virtual XMLElement * ToElement()
Safely cast to an Element, or null.
virtual const XMLElement * ToElement() const
virtual const XMLDocument * ToDocument() const
void Trace(const char *name)
static const int TINYXML2_MAX_ELEMENT_DEPTH
XMLHandle(const XMLHandle &ref)
Copy constructor.
static bool IsPrefixHex(const char *p)
XMLError QueryAttribute(const char *name, const char **value) const
const XMLElement * ToElement() const
void SetInternedStr(const char *str)
const XMLDeclaration * ToDeclaration() const