24 #ifndef BT_TINYXML2_INCLUDED 25 #define BT_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("hidden"))) 82 #if defined(TINYXML2_DEBUG) 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 ) {} 105 #define TINYXML2_MAJOR_VERSION 7 106 #define TINYXML2_MINOR_VERSION 0 107 #define TINYXML2_PATCH_VERSION 1 123 class XMLDeclaration;
139 NEEDS_ENTITY_PROCESSING = 0x01,
140 NEEDS_NEWLINE_NORMALIZATION = 0x02,
141 NEEDS_WHITESPACE_COLLAPSING = 0x04,
143 TEXT_ELEMENT = NEEDS_ENTITY_PROCESSING | NEEDS_NEWLINE_NORMALIZATION,
144 TEXT_ELEMENT_LEAVE_ENTITIES = NEEDS_NEWLINE_NORMALIZATION,
146 ATTRIBUTE_VALUE = NEEDS_ENTITY_PROCESSING | NEEDS_NEWLINE_NORMALIZATION,
147 ATTRIBUTE_VALUE_LEAVE_ENTITIES = NEEDS_NEWLINE_NORMALIZATION,
148 COMMENT = NEEDS_NEWLINE_NORMALIZATION
151 StrPair() : _flags( 0 ), _start( 0 ), _end( 0 ) {}
154 void Set(
char* start,
char* end,
int flags ) {
160 _flags = flags | NEEDS_FLUSH;
163 const char* GetStr();
166 return _start == _end;
171 _start =
const_cast<char*
>(
str);
174 void SetStr(
const char*
str,
int flags=0 );
176 char* ParseText(
char* in,
const char* endTag,
int strFlags,
int* curLineNumPtr );
177 char* ParseName(
char* in );
179 void TransferTo(
StrPair* other );
183 void CollapseWhitespace();
195 void operator=(
const StrPair& other );
204 template <
class T,
int INITIAL_SIZE>
210 _allocated( INITIAL_SIZE ),
216 if ( _mem != _pool ) {
227 EnsureCapacity( _size+1 );
235 EnsureCapacity( _size+count );
236 T* ret = &_mem[_size];
268 return _mem[ _size - 1];
284 _mem[i] = _mem[_size - 1];
304 if ( cap > _allocated ) {
306 int newAllocated = cap * 2;
307 T* newMem =
new T[newAllocated];
309 memcpy( newMem, _mem,
sizeof(T)*_size );
310 if ( _mem != _pool ) {
314 _allocated = newAllocated;
319 T _pool[INITIAL_SIZE];
335 virtual int ItemSize()
const = 0;
336 virtual void* Alloc() = 0;
337 virtual void Free(
void* ) = 0;
338 virtual void SetTracked() = 0;
345 template<
int ITEM_SIZE >
349 MemPoolT() : _blockPtrs(), _root(0), _currentAllocs(0), _nAllocs(0), _maxAllocs(0), _nUntracked(0) {}
356 while( !_blockPtrs.Empty()) {
357 Block* lastBlock = _blockPtrs.Pop();
371 return _currentAllocs;
377 Block* block =
new Block();
378 _blockPtrs.Push( block );
380 Item* blockItems = block->items;
381 for(
int i = 0; i < ITEMS_PER_BLOCK - 1; ++i ) {
382 blockItems[i].next = &(blockItems[i + 1]);
384 blockItems[ITEMS_PER_BLOCK - 1].next = 0;
387 Item*
const result = _root;
392 if ( _currentAllocs > _maxAllocs ) {
393 _maxAllocs = _currentAllocs;
400 virtual void Free(
void* mem ) {
405 Item* item =
static_cast<Item*
>( mem );
406 #ifdef TINYXML2_DEBUG 407 memset( item, 0xfe,
sizeof( *item ) );
413 printf(
"Mempool %s watermark=%d [%dk] current=%d size=%d nAlloc=%d blocks=%d\n",
414 name, _maxAllocs, _maxAllocs * ITEM_SIZE / 1024, _currentAllocs,
415 ITEM_SIZE, _nAllocs, _blockPtrs.Size() );
437 enum { ITEMS_PER_BLOCK = (4 * 1024) / ITEM_SIZE };
445 char itemData[ITEM_SIZE];
556 while( IsWhiteSpace(*p) ) {
557 if (curLineNumPtr && *p ==
'\n') {
566 return const_cast<char*
>( SkipWhiteSpace( const_cast<const char*>(p), curLineNumPtr ) );
572 return !IsUTF8Continuation(p) && isspace( static_cast<unsigned char>(p) );
580 if ( isalpha( ch ) ) {
583 return ch ==
':' || ch ==
'_';
587 return IsNameStartChar( ch )
593 inline static bool StringEqual(
const char* p,
const char* q,
int nChar=INT_MAX ) {
600 return strncmp( p, q, nChar ) == 0;
604 return ( p & 0x80 ) != 0;
607 static const char* ReadBOM(
const char* p,
bool* hasBOM );
610 static const char* GetCharacterRef(
const char* p,
char* value,
int* length );
611 static void ConvertUTF32ToUTF8(
unsigned long input,
char* output,
int* length );
614 static void ToStr(
int v,
char*
buffer,
int bufferSize );
615 static void ToStr(
unsigned v,
char* buffer,
int bufferSize );
616 static void ToStr(
bool v,
char* buffer,
int bufferSize );
617 static void ToStr(
float v,
char* buffer,
int bufferSize );
618 static void ToStr(
double v,
char* buffer,
int bufferSize );
619 static void ToStr(int64_t v,
char* buffer,
int bufferSize);
622 static bool ToInt(
const char*
str,
int* value );
623 static bool ToUnsigned(
const char* str,
unsigned* value );
624 static bool ToBool(
const char* str,
bool* value );
625 static bool ToFloat(
const char* str,
float* value );
626 static bool ToDouble(
const char* str,
double* value );
627 static bool ToInt64(
const char* str, int64_t* value);
634 static void SetBoolSerialization(
const char* writeTrue,
const char* writeFalse);
737 const char* Value()
const;
742 void SetValue(
const char* val,
bool staticMem=
false );
773 const XMLElement* FirstChildElement(
const char* name = 0 )
const;
776 return const_cast<XMLElement*
>(
const_cast<const XMLNode*
>(
this)->FirstChildElement( name ));
791 const XMLElement* LastChildElement(
const char* name = 0 )
const;
794 return const_cast<XMLElement*
>(
const_cast<const XMLNode*
>(
this)->LastChildElement(name) );
807 const XMLElement* PreviousSiblingElement(
const char* name = 0 )
const ;
810 return const_cast<XMLElement*
>(
const_cast<const XMLNode*
>(
this)->PreviousSiblingElement( name ) );
823 const XMLElement* NextSiblingElement(
const char* name = 0 )
const;
826 return const_cast<XMLElement*
>(
const_cast<const XMLNode*
>(
this)->NextSiblingElement( name ) );
839 return InsertEndChild( addThis );
862 void DeleteChildren();
867 void DeleteChild(
XMLNode* node );
901 virtual bool ShallowEqual(
const XMLNode* compare )
const = 0;
925 virtual bool Accept(
XMLVisitor* visitor )
const = 0;
945 virtual char* ParseDeep(
char* p,
StrPair* parentEndTag,
int* curLineNumPtr);
963 static void DeleteNode(
XMLNode* node );
964 void InsertChildPreamble(
XMLNode* insertThis )
const;
965 const XMLElement* ToElementWithName(
const char* name )
const;
988 virtual bool Accept(
XMLVisitor* visitor )
const;
1007 virtual bool ShallowEqual(
const XMLNode* compare )
const;
1013 char* ParseDeep(
char* p,
StrPair* parentEndTag,
int* curLineNumPtr );
1035 virtual bool Accept(
XMLVisitor* visitor )
const;
1038 virtual bool ShallowEqual(
const XMLNode* compare )
const;
1044 char* ParseDeep(
char* p,
StrPair* parentEndTag,
int* curLineNumPtr);
1074 virtual bool Accept(
XMLVisitor* visitor )
const;
1077 virtual bool ShallowEqual(
const XMLNode* compare )
const;
1083 char* ParseDeep(
char* p,
StrPair* parentEndTag,
int* curLineNumPtr );
1109 virtual bool Accept(
XMLVisitor* visitor )
const;
1112 virtual bool ShallowEqual(
const XMLNode* compare )
const;
1118 char* ParseDeep(
char* p,
StrPair* parentEndTag,
int* curLineNumPtr );
1138 const char* Name()
const;
1141 const char* Value()
const;
1163 QueryInt64Value(&i);
1170 QueryUnsignedValue( &i );
1176 QueryBoolValue( &b );
1182 QueryDoubleValue( &d );
1188 QueryFloatValue( &f );
1196 XMLError QueryIntValue(
int* value )
const;
1198 XMLError QueryUnsignedValue(
unsigned int* value )
const;
1200 XMLError QueryInt64Value(int64_t* value)
const;
1202 XMLError QueryBoolValue(
bool* value )
const;
1204 XMLError QueryDoubleValue(
double* value )
const;
1206 XMLError QueryFloatValue(
float* value )
const;
1209 void SetAttribute(
const char* value );
1211 void SetAttribute(
int value );
1213 void SetAttribute(
unsigned value );
1215 void SetAttribute(int64_t value);
1217 void SetAttribute(
bool value );
1219 void SetAttribute(
double value );
1221 void SetAttribute(
float value );
1224 enum { BUF_SIZE = 200 };
1226 XMLAttribute() : _name(), _value(),_parseLineNum( 0 ), _next( 0 ), _memPool( 0 ) {}
1231 void SetName(
const char* name );
1233 char* ParseDeep(
char* p,
bool processEntities,
int* curLineNumPtr );
1257 SetValue( str, staticMem );
1266 virtual bool Accept(
XMLVisitor* visitor )
const;
1291 const char* Attribute(
const char* name,
const char* value=0 )
const;
1299 int IntAttribute(
const char* name,
int defaultValue = 0)
const;
1301 unsigned UnsignedAttribute(
const char* name,
unsigned defaultValue = 0)
const;
1303 int64_t Int64Attribute(
const char* name, int64_t defaultValue = 0)
const;
1305 bool BoolAttribute(
const char* name,
bool defaultValue =
false)
const;
1307 double DoubleAttribute(
const char* name,
double defaultValue = 0)
const;
1309 float FloatAttribute(
const char* name,
float defaultValue = 0)
const;
1381 *value = a->
Value();
1405 return QueryIntAttribute( name, value );
1409 return QueryUnsignedAttribute( name, value );
1413 return QueryInt64Attribute(name, value);
1417 return QueryBoolAttribute( name, value );
1421 return QueryDoubleAttribute( name, value );
1425 return QueryFloatAttribute( name, value );
1469 void DeleteAttribute(
const char* name );
1473 return _rootAttribute;
1476 const XMLAttribute* FindAttribute(
const char* name )
const;
1506 const char* GetText()
const;
1542 void SetText(
const char* inText );
1544 void SetText(
int value );
1546 void SetText(
unsigned value );
1548 void SetText(int64_t value);
1550 void SetText(
bool value );
1552 void SetText(
double value );
1554 void SetText(
float value );
1582 XMLError QueryIntText(
int* ival )
const;
1584 XMLError QueryUnsignedText(
unsigned* uval )
const;
1586 XMLError QueryInt64Text(int64_t* uval)
const;
1588 XMLError QueryBoolText(
bool* bval )
const;
1590 XMLError QueryDoubleText(
double* dval )
const;
1592 XMLError QueryFloatText(
float* fval )
const;
1594 int IntText(
int defaultValue = 0)
const;
1597 unsigned UnsignedText(
unsigned defaultValue = 0)
const;
1599 int64_t Int64Text(int64_t defaultValue = 0)
const;
1601 bool BoolText(
bool defaultValue =
false)
const;
1603 double DoubleText(
double defaultValue = 0)
const;
1605 float FloatText(
float defaultValue = 0)
const;
1614 return _closingType;
1617 virtual bool ShallowEqual(
const XMLNode* compare )
const;
1620 char* ParseDeep(
char* p,
StrPair* parentEndTag,
int* curLineNumPtr );
1628 XMLAttribute* FindOrCreateAttribute(
const char* name );
1629 char* ParseAttributes(
char* p,
int* curLineNumPtr );
1630 static void DeleteAttribute(
XMLAttribute* attribute );
1633 enum { BUF_SIZE = 200 };
1687 XMLError Parse(
const char* xml,
size_t nBytes=(
size_t)(-1) );
1726 return _processEntities;
1729 return _whitespaceMode;
1748 return FirstChildElement();
1751 return FirstChildElement();
1769 virtual bool Accept(
XMLVisitor* visitor )
const;
1782 XMLComment* NewComment(
const char* comment );
1788 XMLText* NewText(
const char* text );
1812 void DeleteNode(
XMLNode* node );
1826 const char* ErrorName()
const;
1827 static const char* ErrorIDToName(
XMLError errorID);
1832 const char* ErrorStr()
const;
1835 void PrintError()
const;
1840 return _errorLineNum;
1856 char* Identify(
char* p,
XMLNode** node );
1898 void SetError(
XMLError error,
int lineNum,
const char* format, ... );
1906 this->_document = document;
1910 _document->PopDepth();
1918 template<
class NodeType,
int PoolElementSize>
1922 template<
class NodeType,
int PoolElementSize>
1929 returnNode->_memPool = &pool;
1931 _unlinked.Push(returnNode);
2010 return XMLHandle( _node ? _node->FirstChild() : 0 );
2014 return XMLHandle( _node ? _node->FirstChildElement( name ) : 0 );
2018 return XMLHandle( _node ? _node->LastChild() : 0 );
2022 return XMLHandle( _node ? _node->LastChildElement( name ) : 0 );
2026 return XMLHandle( _node ? _node->PreviousSibling() : 0 );
2030 return XMLHandle( _node ? _node->PreviousSiblingElement( name ) : 0 );
2034 return XMLHandle( _node ? _node->NextSibling() : 0 );
2038 return XMLHandle( _node ? _node->NextSiblingElement( name ) : 0 );
2047 return ( _node ? _node->ToElement() : 0 );
2051 return ( _node ? _node->ToText() : 0 );
2055 return ( _node ? _node->ToUnknown() : 0 );
2059 return ( _node ? _node->ToDeclaration() : 0 );
2090 return XMLConstHandle( _node ? _node->FirstChildElement( name ) : 0 );
2096 return XMLConstHandle( _node ? _node->LastChildElement( name ) : 0 );
2102 return XMLConstHandle( _node ? _node->PreviousSiblingElement( name ) : 0 );
2108 return XMLConstHandle( _node ? _node->NextSiblingElement( name ) : 0 );
2116 return ( _node ? _node->ToElement() : 0 );
2119 return ( _node ? _node->ToText() : 0 );
2122 return ( _node ? _node->ToUnknown() : 0 );
2125 return ( _node ? _node->ToDeclaration() : 0 );
2188 void PushHeader(
bool writeBOM,
bool writeDeclaration );
2192 void OpenElement(
const char* name,
bool compactMode=
false );
2194 void PushAttribute(
const char* name,
const char* value );
2195 void PushAttribute(
const char* name,
int value );
2196 void PushAttribute(
const char* name,
unsigned value );
2197 void PushAttribute(
const char* name, int64_t value);
2198 void PushAttribute(
const char* name,
bool value );
2199 void PushAttribute(
const char* name,
double value );
2201 virtual void CloseElement(
bool compactMode=
false );
2204 void PushText(
const char* text,
bool cdata=
false );
2206 void PushText(
int value );
2208 void PushText(
unsigned value );
2210 void PushText(int64_t value);
2212 void PushText(
bool value );
2214 void PushText(
float value );
2216 void PushText(
double value );
2219 void PushComment(
const char* comment );
2221 void PushDeclaration(
const char* value );
2222 void PushUnknown(
const char* value );
2230 virtual bool VisitExit(
const XMLElement& element );
2232 virtual bool Visit(
const XMLText& text );
2233 virtual bool Visit(
const XMLComment& comment );
2235 virtual bool Visit(
const XMLUnknown& unknown );
2242 return _buffer.Mem();
2250 return _buffer.Size();
2259 _firstElement =
true;
2268 virtual void PrintSpace(
int depth );
2269 void Print(
const char* format, ... );
2270 void Write(
const char*
data,
size_t size );
2271 inline void Write(
const char* data ) {
Write( data, strlen( data ) ); }
2272 void Putc(
char ch );
2274 void SealElementIfJustOpened();
2279 void PrintString(
const char*,
bool restrictedEntitySet );
2292 bool _entityFlag[ENTITY_RANGE];
2293 bool _restrictedEntityFlag[ENTITY_RANGE];
2305 #if defined(_MSC_VER) 2306 # pragma warning(pop) 2309 #endif // BT_TINYXML2_INCLUDED XMLError QueryUnsignedAttribute(const char *name, unsigned int *value) const
See QueryIntAttribute()
const T & PeekTop() const
static bool IsNameStartChar(unsigned char ch)
virtual XMLComment * ToComment()
Safely cast to a Comment, or null.
XMLHandle LastChildElement(const char *name=0)
Get the last child element of this handle.
virtual XMLElement * ToElement()
Safely cast to an Element, or null.
const XMLNode * NextSibling() const
Get the next (right) sibling node of this node.
void SetAttribute(const char *name, const char *value)
Sets the named attribute to value.
XMLError QueryFloatAttribute(const char *name, float *value) const
See QueryIntAttribute()
int64_t Int64Value() const
Whitespace WhitespaceMode() const
static const int TIXML2_PATCH_VERSION
const XMLDeclaration * ToDeclaration() const
XMLError QueryIntAttribute(const char *name, int *value) const
XMLError QueryAttribute(const char *name, int *value) const
XMLError QueryDoubleValue(double *value) const
See QueryIntValue.
static bool IsNameChar(unsigned char ch)
DynArray< char, 20 > _buffer
void SetAttribute(const char *value)
Set the attribute to a string value.
const XMLNode * LastChild() const
Get the last child node, or null if none exists.
int ErrorLineNum() const
Return the line where the error occurred, or zero if unknown.
virtual bool Visit(const XMLText &)
Visit a text node.
virtual bool Visit(const XMLDeclaration &)
Visit a declaration.
static raw_event_t * buffer
XMLElement * NextSiblingElement(const char *name=0)
virtual bool Visit(const XMLUnknown &)
Visit an unknown node.
const XMLConstHandle NextSibling() const
XMLHandle NextSibling()
Get the next sibling of this handle.
XMLHandle FirstChild()
Get the first child of this handle.
XMLError QueryAttribute(const char *name, int64_t *value) const
XMLError QueryAttribute(const char *name, float *value) const
const XMLNode * PreviousSibling() const
Get the previous (left) sibling node of this node.
XMLElement * FirstChildElement(const char *name=0)
const char * Value() const
The value of the attribute.
const XMLAttribute * Next() const
The next attribute in the list.
virtual bool VisitExit(const XMLDocument &)
Visit a document.
virtual const XMLDocument * ToDocument() const
virtual XMLDeclaration * ToDeclaration()
Safely cast to a Declaration, or null.
const XMLNode * Parent() const
Get the parent of this node on the DOM.
virtual bool ShallowEqual(const XMLNode *) const
virtual const XMLComment * ToComment() const
const XMLConstHandle LastChildElement(const char *name=0) const
bool LoadFile(const char *name, bool binary, std::string *buf)
XMLDocument * GetDocument()
Get the XMLDocument that owns this XMLNode.
virtual const XMLDocument * ToDocument() const
virtual XMLText * ToText()
Safely cast to Text, or null.
XMLConstHandle(const XMLConstHandle &ref)
void Trace(const char *name)
Whitespace _whitespaceMode
XMLConstHandle(const XMLNode *node)
XMLNode * PreviousSibling()
virtual bool CompactMode(const XMLElement &)
void SetAttribute(const char *name, double value)
Sets the named attribute to value.
virtual bool VisitExit(const XMLDocument &)
Visit a document.
DynArray< Block *, 10 > _blockPtrs
bool ProcessEntities() const
const XMLNode * ToNode() const
virtual XMLNode * ShallowClone(XMLDocument *) const
XMLError QueryBoolValue(bool *value) const
See QueryIntValue.
virtual bool VisitEnter(const XMLDocument &)
Visit a document.
XMLElement * LastChildElement(const char *name=0)
const XMLNode * FirstChild() const
Get the first child node, or null if none exists.
virtual XMLUnknown * ToUnknown()
Safely cast to an Unknown, or null.
XMLError QueryAttribute(const char *name, bool *value) const
XMLError QueryDoubleAttribute(const char *name, double *value) const
See QueryIntAttribute()
static const char * writeBoolFalse
virtual const XMLText * ToText() const
const XMLText * ToText() const
static bool StringEqual(const char *p, const char *q, int nChar=INT_MAX)
int CurrentAllocs() const
static const int TIXML2_MINOR_VERSION
XMLNode * LinkEndChild(XMLNode *addThis)
void SetName(const char *str, bool staticMem=false)
Set the name of the element.
virtual XMLDeclaration * ToDeclaration()
Safely cast to a Declaration, or null.
ElementClosingType _closingType
XMLUnknown * ToUnknown()
Safe cast to XMLUnknown. This can return null.
const XMLElement * RootElement() const
int GetLineNum() const
Gets the line number the node is in, if the document was parsed from a file.
static char * SkipWhiteSpace(char *p, int *curLineNumPtr)
void SetCData(bool isCData)
Declare whether this should be CDATA or standard text.
MemPoolT< sizeof(XMLText) > _textPool
XMLHandle(const XMLHandle &ref)
Copy constructor.
const XMLConstHandle FirstChildElement(const char *name=0) const
void SetAttribute(const char *name, int64_t value)
Sets the named attribute to value.
void Set(char *start, char *end, int flags)
XMLHandle NextSiblingElement(const char *name=0)
Get the next sibling element of this handle.
virtual const XMLElement * ToElement() const
virtual const XMLDeclaration * ToDeclaration() const
XMLText * ToText()
Safe cast to XMLText. This can return null.
XMLError QueryInt64Value(int64_t *value) const
See QueryIntValue.
XMLError QueryStringAttribute(const char *name, const char **value) const
See QueryIntAttribute()
virtual XMLText * ToText()
Safely cast to Text, or null.
XMLHandle(XMLNode *node)
Create a handle from any node (at any depth of the tree.) This can be a null pointer.
static const char * writeBoolTrue
XMLElement * RootElement()
void SetAttribute(const char *name, int value)
Sets the named attribute to value.
void SetAttribute(const char *name, float value)
Sets the named attribute to value.
bool Error() const
Return true if there was an error parsing the document.
virtual bool VisitEnter(const XMLElement &, const XMLAttribute *)
Visit an element.
XMLHandle PreviousSiblingElement(const char *name=0)
Get the previous sibling element of this handle.
XMLHandle PreviousSibling()
Get the previous sibling of this handle.
static const int TIXML2_MAJOR_VERSION
bool BoolValue() const
Query as a boolean. See IntValue()
const char * CStr() const
static const char * SkipWhiteSpace(const char *p, int *curLineNumPtr)
XMLError ErrorID() const
Return the errorID.
virtual const XMLUnknown * ToUnknown() const
const XMLAttribute * FirstAttribute() const
Return the first attribute in the list.
const T * data(const std::vector< T, Alloc > &v)
virtual bool Visit(const XMLComment &)
Visit a comment node.
unsigned UnsignedValue() const
Query as an unsigned integer. See IntValue()
const XMLElement * ToElement() const
XMLError QueryInt64Attribute(const char *name, int64_t *value) const
See QueryIntAttribute()
DynArray< XMLNode *, 10 > _unlinked
const XMLConstHandle PreviousSibling() const
void EnsureCapacity(int cap)
void SetUserData(void *userData)
XMLNode * ToNode()
Safe cast to XMLNode. This can return null.
const XMLDocument * GetDocument() const
Get the XMLDocument that owns this XMLNode.
XMLAttribute * _rootAttribute
XMLElement * ToElement()
Safe cast to XMLElement. This can return null.
ElementClosingType ClosingType() const
void * GetUserData() const
static volatile int count
const T & operator[](int i) const
const XMLConstHandle LastChild() const
MemPoolT< sizeof(XMLAttribute) > _attributePool
float FloatValue() const
Query as a float. See IntValue()
virtual XMLElement * ToElement()
Safely cast to an Element, or null.
XMLError QueryAttribute(const char *name, unsigned int *value) const
virtual XMLDocument * ToDocument()
Safely cast to a Document, or null.
void SetAttribute(const char *name, unsigned value)
Sets the named attribute to value.
XMLError QueryFloatValue(float *value) const
See QueryIntValue.
XMLHandle LastChild()
Get the last child of this handle.
XMLError QueryIntValue(int *value) const
XMLHandle FirstChildElement(const char *name=0)
Get the first child element of this handle.
bool CData() const
Returns true if this is a CDATA text element.
DepthTracker(XMLDocument *document)
double DoubleValue() const
Query as a double. See IntValue()
virtual XMLUnknown * ToUnknown()
Safely cast to an Unknown, or null.
XMLError QueryBoolAttribute(const char *name, bool *value) const
See QueryIntAttribute()
NodeType * CreateUnlinkedNode(MemPoolT< PoolElementSize > &pool)
XMLConstHandle & operator=(const XMLConstHandle &ref)
virtual const XMLText * ToText() const
DynArray< const char *, 10 > _stack
virtual bool VisitExit(const XMLElement &)
Visit an element.
XMLError QueryAttribute(const char *name, double *value) const
static bool IsWhiteSpace(char p)
XMLError QueryUnsignedValue(unsigned int *value) const
See QueryIntValue.
XMLDeclaration * ToDeclaration()
Safe cast to XMLDeclaration. This can return null.
void Write(const char *data)
void SetInternedStr(const char *str)
XMLConstHandle(const XMLNode &node)
virtual const XMLUnknown * ToUnknown() const
virtual const XMLDeclaration * ToDeclaration() const
const char * Name() const
Get the name of an element (which is the Value() of the node.)
const XMLUnknown * ToUnknown() const
virtual void Free(void *mem)
virtual int ItemSize() const
static bool IsUTF8Continuation(char p)
const XMLConstHandle FirstChild() const
XMLHandle & operator=(const XMLHandle &ref)
Assignment.
bool NoChildren() const
Returns true if this node has no children.
NodeType
Enumerates the possible types of nodes.
int GetLineNum() const
Gets the line number the attribute is in, if the document was parsed from a file. ...
XMLText(XMLDocument *doc)
XMLElement * PreviousSiblingElement(const char *name=0)
static const int TINYXML2_MAX_ELEMENT_DEPTH
bool SaveFile(const char *name, const char *buf, size_t len, bool binary)
const XMLConstHandle PreviousSiblingElement(const char *name=0) const
void SetAttribute(const char *name, bool value)
Sets the named attribute to value.
XMLHandle(XMLNode &node)
Create a handle from a node.
MemPoolT< sizeof(XMLElement) > _elementPool
virtual XMLDocument * ToDocument()
Safely cast to a Document, or null.
MemPoolT< sizeof(XMLComment) > _commentPool
const XMLConstHandle NextSiblingElement(const char *name=0) const
virtual const XMLElement * ToElement() const