29#ifndef TINYXML2_INCLUDED
30#define TINYXML2_INCLUDED
32#if defined(ANDROID_NDK) || defined(__BORLANDC__) || defined(__QNXNTO__)
50#include <aws/core/utils/memory/AWSMemory.h>
63#if defined( _DEBUG ) || defined (__DEBUG__)
71# pragma warning(disable: 4251)
75 #ifdef USE_IMPORT_EXPORT
76 #ifdef AWS_CORE_EXPORTS
77 #define TINYXML2_LIB __declspec(dllexport)
79 #define TINYXML2_LIB __declspec(dllimport)
83 #define TINYXML2_LIB __attribute__((visibility("default")))
93# define TIXMLASSERT( x ) if ( !((void)0,(x))) { __debugbreak(); }
94# elif defined (ANDROID_NDK)
95# include <android/log.h>
96# define TIXMLASSERT( x ) if ( !(x)) { __android_log_assert( "assert", "grinliz", "ASSERT in '%s' at %d.", __FILE__, __LINE__ ); }
99# define TIXMLASSERT assert
102# define TIXMLASSERT( x ) {}
109static const int TIXML2_MAJOR_VERSION = 11;
110static const int TIXML2_MINOR_VERSION = 0;
111static const int TIXML2_PATCH_VERSION = 0;
113#define TINYXML2_MAJOR_VERSION 11
114#define TINYXML2_MINOR_VERSION 0
115#define TINYXML2_PATCH_VERSION 0
153 NEEDS_ENTITY_PROCESSING = 0x01,
154 NEEDS_NEWLINE_NORMALIZATION = 0x02,
155 NEEDS_WHITESPACE_COLLAPSING = 0x04,
157 TEXT_ELEMENT = NEEDS_ENTITY_PROCESSING | NEEDS_NEWLINE_NORMALIZATION,
158 TEXT_ELEMENT_LEAVE_ENTITIES = NEEDS_NEWLINE_NORMALIZATION,
160 ATTRIBUTE_VALUE = NEEDS_ENTITY_PROCESSING | NEEDS_NEWLINE_NORMALIZATION,
161 ATTRIBUTE_VALUE_LEAVE_ENTITIES = NEEDS_NEWLINE_NORMALIZATION,
162 COMMENT = NEEDS_NEWLINE_NORMALIZATION
165 StrPair() : _flags( 0 ), _start( 0 ), _end( 0 ) {}
168 void Set(
char* start,
char* end,
int flags ) {
169 TIXMLASSERT( start );
174 _flags = flags | NEEDS_FLUSH;
180 return _start == _end;
185 _start =
const_cast<char*
>(str);
188 void SetStr(
const char* str,
int flags=0 );
190 char*
ParseText(
char* in,
const char* endTag,
int strFlags,
int* curLineNumPtr );
197 void CollapseWhitespace();
209 void operator=(
const StrPair& other );
218template <
class T,
size_t INITIAL_SIZE>
224 _allocated( INITIAL_SIZE ),
230 if ( _mem != _pool ) {
231 Aws::DeleteArray<T>(_mem);
240 TIXMLASSERT( _size < INT_MAX );
241 EnsureCapacity( _size+1 );
247 TIXMLASSERT( _size <= SIZE_MAX - count );
248 EnsureCapacity( _size+count );
249 T* ret = &_mem[_size];
255 TIXMLASSERT( _size > 0 );
261 TIXMLASSERT( _size >= count );
270 TIXMLASSERT( i < _size );
275 TIXMLASSERT( i < _size );
280 TIXMLASSERT( _size > 0 );
281 return _mem[ _size - 1];
289 TIXMLASSERT( _allocated >= INITIAL_SIZE );
294 TIXMLASSERT(i < _size);
295 TIXMLASSERT(_size > 0);
296 _mem[i] = _mem[_size - 1];
314 void EnsureCapacity(
size_t cap ) {
315 TIXMLASSERT( cap > 0 );
316 if ( cap > _allocated ) {
317 TIXMLASSERT( cap <= SIZE_MAX / 2 /
sizeof(T));
318 const size_t newAllocated = cap * 2;
320 TIXMLASSERT( newAllocated >= _size );
321 memcpy( newMem, _mem,
sizeof(T) * _size );
322 if ( _mem != _pool ) {
323 Aws::DeleteArray<T>(_mem);
326 _allocated = newAllocated;
331 T _pool[INITIAL_SIZE];
349 virtual void Free(
void* ) = 0;
357template<
size_t ITEM_SIZE >
361 MemPoolT() : _blockPtrs(), _root(0), _currentAllocs(0), _nAllocs(0), _maxAllocs(0), _nUntracked(0) {}
368 while( !_blockPtrs.
Empty()) {
369 Block* lastBlock = _blockPtrs.
Pop();
383 return _currentAllocs;
390 _blockPtrs.
Push( block );
392 Item* blockItems = block->items;
394 blockItems[i].next = &(blockItems[i + 1]);
399 Item*
const result = _root;
400 TIXMLASSERT( result != 0 );
404 if ( _currentAllocs > _maxAllocs ) {
405 _maxAllocs = _currentAllocs;
412 virtual void Free(
void* mem )
override {
417 Item* item =
static_cast<Item*
>( mem );
419 memset( item, 0xfe,
sizeof( *item ) );
425 printf(
"Mempool %s watermark=%d [%dk] current=%d size=%d nAlloc=%d blocks=%d\n",
426 name, _maxAllocs, _maxAllocs * ITEM_SIZE / 1024, _currentAllocs,
427 ITEM_SIZE, _nAllocs, _blockPtrs.
Size() );
457 char itemData[
static_cast<size_t>(ITEM_SIZE)];
462 DynArray< Block*, 10 > _blockPtrs;
465 size_t _currentAllocs;
567 while( IsWhiteSpace(*p) ) {
568 if (curLineNumPtr && *p ==
'\n') {
577 return const_cast<char*
>( SkipWhiteSpace(
const_cast<const char*
>(p), curLineNumPtr ) );
583 return !IsUTF8Continuation(p) && isspace(
static_cast<unsigned char>(p) );
591 if ( isalpha( ch ) ) {
594 return ch ==
':' || ch ==
'_';
598 return IsNameStartChar( ch )
605 p = SkipWhiteSpace(p, 0);
606 return p && *p ==
'0' && ( *(p + 1) ==
'x' || *(p + 1) ==
'X');
609 inline static bool StringEqual(
const char* p,
const char* q,
int nChar=INT_MAX ) {
615 TIXMLASSERT( nChar >= 0 );
616 return strncmp( p, q,
static_cast<size_t>(nChar) ) == 0;
620 return ( p & 0x80 ) != 0;
623 static const char*
ReadBOM(
const char* p,
bool* hasBOM );
630 static void ToStr(
int v,
char* buffer,
int bufferSize );
631 static void ToStr(
unsigned v,
char* buffer,
int bufferSize );
632 static void ToStr(
bool v,
char* buffer,
int bufferSize );
633 static void ToStr(
float v,
char* buffer,
int bufferSize );
634 static void ToStr(
double v,
char* buffer,
int bufferSize );
635 static void ToStr(int64_t v,
char* buffer,
int bufferSize);
636 static void ToStr(uint64_t v,
char* buffer,
int bufferSize);
639 static bool ToInt(
const char* str,
int* value );
641 static bool ToBool(
const char* str,
bool* value );
642 static bool ToFloat(
const char* str,
float* value );
643 static bool ToDouble(
const char* str,
double* value );
644 static bool ToInt64(
const char* str, int64_t* value);
654 static const char* writeBoolTrue;
655 static const char* writeBoolFalse;
692 TIXMLASSERT( _document );
697 TIXMLASSERT( _document );
765 void SetValue(
const char* val,
bool staticMem=
false );
799 return const_cast<XMLElement*
>(
const_cast<const XMLNode*
>(
this)->FirstChildElement( name ));
817 return const_cast<XMLElement*
>(
const_cast<const XMLNode*
>(
this)->LastChildElement(name) );
833 return const_cast<XMLElement*
>(
const_cast<const XMLNode*
>(
this)->PreviousSiblingElement( name ) );
849 return const_cast<XMLElement*
>(
const_cast<const XMLNode*
>(
this)->NextSiblingElement( name ) );
862 return InsertEndChild( addThis );
986 static void DeleteNode(
XMLNode* node );
987 void InsertChildPreamble(
XMLNode* insertThis )
const;
988 const XMLElement* ToElementWithName(
const char* name )
const;
1186 QueryInt64Value(&i);
1192 QueryUnsigned64Value(&i);
1199 QueryUnsignedValue( &i );
1205 QueryBoolValue( &b );
1211 QueryDoubleValue( &d );
1217 QueryFloatValue( &f );
1257 enum { BUF_SIZE = 200 };
1259 XMLAttribute() : _name(), _value(),_parseLineNum( 0 ), _next( 0 ), _memPool( 0 ) {}
1260 virtual ~XMLAttribute() {}
1262 XMLAttribute(
const XMLAttribute& );
1263 void operator=(
const XMLAttribute& );
1264 void SetName(
const char* name );
1266 char* ParseDeep(
char* p,
bool processEntities,
int* curLineNumPtr );
1268 mutable StrPair _name;
1269 mutable StrPair _value;
1271 XMLAttribute* _next;
1289 void SetName(
const char* str,
bool staticMem=
false ) {
1290 SetValue( str, staticMem );
1324 const char*
Attribute(
const char* name,
const char* value=0 )
const;
1425 *value = a->
Value();
1449 return QueryIntAttribute( name, value );
1453 return QueryUnsignedAttribute( name, value );
1457 return QueryInt64Attribute(name, value);
1461 return QueryUnsigned64Attribute(name, value);
1465 return QueryBoolAttribute( name, value );
1469 return QueryDoubleAttribute( name, value );
1473 return QueryFloatAttribute( name, value );
1477 return QueryStringAttribute(name, value);
1531 return _rootAttribute;
1693 return _closingType;
1707 XMLAttribute* FindOrCreateAttribute(
const char* name );
1708 char* ParseAttributes(
char* p,
int* curLineNumPtr );
1709 static void DeleteAttribute(
XMLAttribute* attribute );
1712 enum { BUF_SIZE = 200 };
1713 ElementClosingType _closingType;
1749 TIXMLASSERT(
this == _document );
1753 TIXMLASSERT(
this == _document );
1806 return _processEntities;
1809 return _whitespaceMode;
1828 return FirstChildElement();
1831 return FirstChildElement();
1919 return _errorLineNum;
1952 bool _processEntities;
1958 int _parseCurLineNum;
1977 void SetError(
XMLError error,
int lineNum,
const char* format, ... );
1982 class DepthTracker {
1985 this->_document = document;
1986 document->PushDepth();
1989 _document->PopDepth();
1992 XMLDocument * _document;
1997 template<
class NodeType,
size_t PoolElementSize>
1998 NodeType* CreateUnlinkedNode( MemPoolT<PoolElementSize>& pool );
2001template<
class NodeType,
size_t PoolElementSize>
2002inline NodeType* XMLDocument::CreateUnlinkedNode( MemPoolT<PoolElementSize>& pool )
2004 TIXMLASSERT(
sizeof( NodeType ) == PoolElementSize );
2005 TIXMLASSERT(
sizeof( NodeType ) == pool.ItemSize() );
2006 NodeType* returnNode =
new (pool.Alloc()) NodeType(
this );
2007 TIXMLASSERT( returnNode );
2008 returnNode->_memPool = &pool;
2010 _unlinked.
Push(returnNode);
2089 return XMLHandle( _node ? _node->FirstChild() : 0 );
2093 return XMLHandle( _node ? _node->FirstChildElement( name ) : 0 );
2097 return XMLHandle( _node ? _node->LastChild() : 0 );
2101 return XMLHandle( _node ? _node->LastChildElement( name ) : 0 );
2105 return XMLHandle( _node ? _node->PreviousSibling() : 0 );
2109 return XMLHandle( _node ? _node->PreviousSiblingElement( name ) : 0 );
2113 return XMLHandle( _node ? _node->NextSibling() : 0 );
2117 return XMLHandle( _node ? _node->NextSiblingElement( name ) : 0 );
2126 return ( _node ? _node->ToElement() : 0 );
2130 return ( _node ? _node->ToText() : 0 );
2134 return ( _node ? _node->ToUnknown() : 0 );
2138 return ( _node ? _node->ToDeclaration() : 0 );
2169 return XMLConstHandle( _node ? _node->FirstChildElement( name ) : 0 );
2175 return XMLConstHandle( _node ? _node->LastChildElement( name ) : 0 );
2181 return XMLConstHandle( _node ? _node->PreviousSiblingElement( name ) : 0 );
2187 return XMLConstHandle( _node ? _node->NextSiblingElement( name ) : 0 );
2195 return ( _node ? _node->ToElement() : 0 );
2198 return ( _node ? _node->ToText() : 0 );
2201 return ( _node ? _node->ToUnknown() : 0 );
2204 return ( _node ? _node->ToDeclaration() : 0 );
2259 DONT_ESCAPE_APOS_CHARS_IN_ATTRIBUTES
2329 return _buffer.Mem();
2337 return _buffer.Size();
2346 _firstElement = resetToFirstElement;
2356 virtual void Print(
const char* format, ... );
2357 virtual void Write(
const char* data,
size_t size );
2360 inline void Write(
const char* data) {
Write(data, strlen(data)); }
2371 void PrepareForNewNode(
bool compactMode );
2372 void PrintString(
const char*,
bool restrictedEntitySet );
2378 bool _processEntities;
2385 bool _entityFlag[ENTITY_RANGE];
2386 bool _restrictedEntityFlag[ENTITY_RANGE];
2400#if defined(_MSC_VER)
2401# pragma warning(pop)
const T & operator[](size_t i) const
const T & PeekTop() const
T * PushArr(size_t count)
void PopArr(size_t count)
void SwapRemove(size_t i)
virtual void Free(void *)=0
virtual size_t ItemSize() const =0
virtual void SetTracked()=0
virtual size_t ItemSize() const override
void Trace(const char *name)
virtual void * Alloc() override
size_t CurrentAllocs() const
virtual void Free(void *mem) override
void SetTracked() override
void Set(char *start, char *end, int flags)
void SetStr(const char *str, int flags=0)
void SetInternedStr(const char *str)
void TransferTo(StrPair *other)
char * ParseText(char *in, const char *endTag, int strFlags, int *curLineNumPtr)
char * ParseName(char *in)
uint64_t Unsigned64Value() const
const char * Value() const
The value of the attribute.
int64_t Int64Value() const
XMLError QueryInt64Value(int64_t *value) const
See QueryIntValue.
float FloatValue() const
Query as a float. See IntValue()
XMLError QueryUnsigned64Value(uint64_t *value) const
See QueryIntValue.
bool BoolValue() const
Query as a boolean. See IntValue()
void SetAttribute(int64_t value)
Set the attribute to value.
int GetLineNum() const
Gets the line number the attribute is in, if the document was parsed from a file.
void SetAttribute(double value)
Set the attribute to value.
const XMLAttribute * Next() const
The next attribute in the list.
void SetAttribute(int value)
Set the attribute to value.
unsigned UnsignedValue() const
Query as an unsigned integer. See IntValue()
void SetAttribute(bool value)
Set the attribute to value.
const char * Name() const
The name of the attribute.
XMLError QueryBoolValue(bool *value) const
See QueryIntValue.
XMLError QueryUnsignedValue(unsigned int *value) const
See QueryIntValue.
void SetAttribute(const char *value)
Set the attribute to a string value.
void SetAttribute(uint64_t value)
Set the attribute to value.
void SetAttribute(float value)
Set the attribute to value.
void SetAttribute(unsigned value)
Set the attribute to value.
XMLError QueryFloatValue(float *value) const
See QueryIntValue.
double DoubleValue() const
Query as a double. See IntValue()
XMLError QueryDoubleValue(double *value) const
See QueryIntValue.
XMLError QueryIntValue(int *value) const
XMLConstHandle & operator=(const XMLConstHandle &ref)
const XMLConstHandle NextSiblingElement(const char *name=0) const
const XMLNode * ToNode() const
XMLConstHandle(const XMLNode *node)
const XMLText * ToText() const
XMLConstHandle(const XMLConstHandle &ref)
const XMLElement * ToElement() const
const XMLConstHandle PreviousSiblingElement(const char *name=0) const
const XMLConstHandle LastChild() const
const XMLConstHandle LastChildElement(const char *name=0) const
const XMLConstHandle FirstChild() const
const XMLDeclaration * ToDeclaration() const
const XMLConstHandle PreviousSibling() const
const XMLConstHandle NextSibling() const
const XMLUnknown * ToUnknown() const
XMLConstHandle(const XMLNode &node)
const XMLConstHandle FirstChildElement(const char *name=0) const
virtual XMLDeclaration * ToDeclaration() override
Safely cast to a Declaration, or null.
char * ParseDeep(char *p, StrPair *parentEndTag, int *curLineNumPtr) override
virtual XMLNode * ShallowClone(XMLDocument *document) const override
virtual ~XMLDeclaration()
virtual const XMLDeclaration * ToDeclaration() const override
virtual bool Accept(XMLVisitor *visitor) const override
XMLDeclaration(XMLDocument *doc)
virtual bool ShallowEqual(const XMLNode *compare) const override
void Print(XMLPrinter *streamer=0) const
XMLError SaveFile(const char *filename, bool compact=false)
void MarkInUse(const XMLNode *const)
bool ProcessEntities() const
XMLError LoadFile(const char *filename)
int ErrorLineNum() const
Return the line where the error occurred, or zero if unknown.
virtual XMLDocument * ToDocument() override
Safely cast to a Document, or null.
void DeleteNode(XMLNode *node)
bool Error() const
Return true if there was an error parsing the document.
virtual XMLNode * ShallowClone(XMLDocument *) const override
void PrintError() const
A (trivial) utility function that prints the ErrorStr() to stdout.
static const char * ErrorIDToName(XMLError errorID)
XMLDeclaration * NewDeclaration(const char *text=0)
XMLDocument(bool processEntities=true, Whitespace whitespaceMode=PRESERVE_WHITESPACE)
constructor
XMLError Parse(const char *xml, size_t nBytes=static_cast< size_t >(-1))
virtual bool Accept(XMLVisitor *visitor) const override
XMLElement * NewElement(const char *name)
const char * ErrorStr() const
XMLText * NewText(const char *text)
const XMLElement * RootElement() const
virtual const XMLDocument * ToDocument() const override
void Clear()
Clear the document, resetting it to the initial state.
XMLError SaveFile(FILE *fp, bool compact=false)
const char * ErrorName() const
XMLError LoadFile(FILE *)
XMLUnknown * NewUnknown(const char *text)
void ClearError()
Clears the error flags.
Whitespace WhitespaceMode() const
virtual bool ShallowEqual(const XMLNode *) const override
XMLComment * NewComment(const char *comment)
char * Identify(char *p, XMLNode **node, bool first)
XMLError ErrorID() const
Return the errorID.
void DeepCopy(XMLDocument *target) const
XMLElement * RootElement()
void DeleteAttribute(const char *name)
unsigned UnsignedAttribute(const char *name, unsigned defaultValue=0) const
See IntAttribute()
uint64_t Unsigned64Text(uint64_t defaultValue=0) const
See QueryIntText()
XMLComment * InsertNewComment(const char *comment)
See InsertNewChildElement()
bool BoolText(bool defaultValue=false) const
See QueryIntText()
int IntAttribute(const char *name, int defaultValue=0) const
void SetAttribute(const char *name, int value)
Sets the named attribute to value.
void SetAttribute(const char *name, uint64_t value)
Sets the named attribute to value.
XMLError QueryAttribute(const char *name, int64_t *value) const
const char * GetText() const
XMLError QueryUnsignedText(unsigned *uval) const
See QueryIntText()
void SetName(const char *str, bool staticMem=false)
Set the name of the element.
XMLText * InsertNewText(const char *text)
See InsertNewChildElement()
XMLError QueryBoolText(bool *bval) const
See QueryIntText()
void SetText(int64_t value)
Convenience method for setting text inside an element. See SetText() for important limitations.
float FloatAttribute(const char *name, float defaultValue=0) const
See IntAttribute()
XMLError QueryUnsigned64Attribute(const char *name, uint64_t *value) const
See QueryIntAttribute()
void SetAttribute(const char *name, bool value)
Sets the named attribute to value.
XMLError QueryBoolAttribute(const char *name, bool *value) const
See QueryIntAttribute()
void SetText(int value)
Convenience method for setting text inside an element. See SetText() for important limitations.
int64_t Int64Text(int64_t defaultValue=0) const
See QueryIntText()
virtual bool ShallowEqual(const XMLNode *compare) const override
XMLError QueryFloatText(float *fval) const
See QueryIntText()
XMLError QueryUnsignedAttribute(const char *name, unsigned int *value) const
See QueryIntAttribute()
virtual XMLNode * ShallowClone(XMLDocument *document) const override
void SetAttribute(const char *name, float value)
Sets the named attribute to value.
XMLError QueryAttribute(const char *name, float *value) const
uint64_t Unsigned64Attribute(const char *name, uint64_t defaultValue=0) const
See IntAttribute()
virtual bool Accept(XMLVisitor *visitor) const override
void SetText(double value)
Convenience method for setting text inside an element. See SetText() for important limitations.
virtual XMLElement * ToElement() override
Safely cast to an Element, or null.
float FloatText(float defaultValue=0) const
See QueryIntText()
XMLError QueryFloatAttribute(const char *name, float *value) const
See QueryIntAttribute()
double DoubleText(double defaultValue=0) const
See QueryIntText()
XMLError QueryAttribute(const char *name, unsigned int *value) const
void SetText(bool value)
Convenience method for setting text inside an element. See SetText() for important limitations.
ElementClosingType ClosingType() const
XMLError QueryInt64Text(int64_t *uval) const
See QueryIntText()
XMLError QueryDoubleText(double *dval) const
See QueryIntText()
void SetText(float value)
Convenience method for setting text inside an element. See SetText() for important limitations.
const char * Name() const
Get the name of an element (which is the Value() of the node.)
const XMLAttribute * FindAttribute(const char *name) const
Query a specific attribute in the list.
int IntText(int defaultValue=0) const
unsigned UnsignedText(unsigned defaultValue=0) const
See QueryIntText()
XMLError QueryUnsigned64Text(uint64_t *uval) const
See QueryIntText()
void SetText(const char *inText)
XMLError QueryStringAttribute(const char *name, const char **value) const
See QueryIntAttribute()
XMLDeclaration * InsertNewDeclaration(const char *text)
See InsertNewChildElement()
bool BoolAttribute(const char *name, bool defaultValue=false) const
See IntAttribute()
XMLError QueryAttribute(const char *name, double *value) const
XMLError QueryAttribute(const char *name, bool *value) const
void SetAttribute(const char *name, unsigned value)
Sets the named attribute to value.
void SetText(unsigned value)
Convenience method for setting text inside an element. See SetText() for important limitations.
void SetAttribute(const char *name, const char *value)
Sets the named attribute to value.
XMLError QueryAttribute(const char *name, const char **value) const
XMLError QueryInt64Attribute(const char *name, int64_t *value) const
See QueryIntAttribute()
const char * Attribute(const char *name, const char *value=0) const
XMLError QueryIntAttribute(const char *name, int *value) const
XMLError QueryAttribute(const char *name, int *value) const
double DoubleAttribute(const char *name, double defaultValue=0) const
See IntAttribute()
virtual const XMLElement * ToElement() const override
XMLError QueryIntText(int *ival) const
XMLElement * InsertNewChildElement(const char *name)
XMLError QueryAttribute(const char *name, uint64_t *value) const
XMLUnknown * InsertNewUnknown(const char *text)
See InsertNewChildElement()
void SetText(uint64_t value)
Convenience method for setting text inside an element. See SetText() for important limitations.
void SetAttribute(const char *name, double value)
Sets the named attribute to value.
void SetAttribute(const char *name, int64_t value)
Sets the named attribute to value.
const XMLAttribute * FirstAttribute() const
Return the first attribute in the list.
int64_t Int64Attribute(const char *name, int64_t defaultValue=0) const
See IntAttribute()
char * ParseDeep(char *p, StrPair *parentEndTag, int *curLineNumPtr) override
XMLError QueryDoubleAttribute(const char *name, double *value) const
See QueryIntAttribute()
XMLHandle FirstChildElement(const char *name=0)
Get the first child element of this handle.
XMLHandle FirstChild()
Get the first child of this handle.
XMLText * ToText()
Safe cast to XMLText. This can return null.
XMLUnknown * ToUnknown()
Safe cast to XMLUnknown. This can return null.
XMLDeclaration * ToDeclaration()
Safe cast to XMLDeclaration. This can return null.
XMLNode * ToNode()
Safe cast to XMLNode. This can return null.
XMLElement * ToElement()
Safe cast to XMLElement. This can return null.
XMLHandle PreviousSibling()
Get the previous sibling of this handle.
XMLHandle LastChildElement(const char *name=0)
Get the last child element of this handle.
XMLHandle PreviousSiblingElement(const char *name=0)
Get the previous sibling element of this handle.
XMLHandle LastChild()
Get the last child of this handle.
XMLHandle(const XMLHandle &ref)
Copy constructor.
XMLHandle NextSiblingElement(const char *name=0)
Get the next sibling element of this handle.
XMLHandle(XMLNode *node)
Create a handle from any node (at any depth of the tree.) This can be a null pointer.
XMLHandle & operator=(const XMLHandle &ref)
Assignment.
XMLHandle NextSibling()
Get the next sibling of this handle.
XMLHandle(XMLNode &node)
Create a handle from a node.
virtual XMLDeclaration * ToDeclaration()
Safely cast to a Declaration, or null.
const XMLNode * NextSibling() const
Get the next (right) sibling node of this node.
virtual const XMLDeclaration * ToDeclaration() const
virtual bool ShallowEqual(const XMLNode *compare) const =0
const XMLNode * FirstChild() const
Get the first child node, or null if none exists.
const XMLElement * PreviousSiblingElement(const char *name=0) const
Get the previous (left) sibling element of this node, with an optionally supplied name.
int ChildElementCount() const
virtual const XMLComment * ToComment() const
XMLElement * FirstChildElement(const char *name=0)
bool NoChildren() const
Returns true if this node has no children.
virtual bool Accept(XMLVisitor *visitor) const =0
XMLDocument * GetDocument()
Get the XMLDocument that owns this XMLNode.
const XMLElement * NextSiblingElement(const char *name=0) const
Get the next (right) sibling element of this node, with an optionally supplied name.
virtual const XMLUnknown * ToUnknown() const
virtual XMLText * ToText()
Safely cast to Text, or null.
const XMLNode * PreviousSibling() const
Get the previous (left) sibling node of this node.
XMLNode * InsertFirstChild(XMLNode *addThis)
XMLNode * InsertEndChild(XMLNode *addThis)
XMLNode * DeepClone(XMLDocument *target) const
virtual const XMLElement * ToElement() const
virtual XMLComment * ToComment()
Safely cast to a Comment, or null.
void SetValue(const char *val, bool staticMem=false)
void * GetUserData() const
virtual const XMLDocument * ToDocument() const
XMLElement * LastChildElement(const char *name=0)
XMLElement * PreviousSiblingElement(const char *name=0)
const XMLElement * LastChildElement(const char *name=0) const
XMLElement * NextSiblingElement(const char *name=0)
virtual XMLNode * ShallowClone(XMLDocument *document) const =0
XMLNode * InsertAfterChild(XMLNode *afterThis, XMLNode *addThis)
const XMLNode * Parent() const
Get the parent of this node on the DOM.
const char * Value() const
const XMLNode * LastChild() const
Get the last child node, or null if none exists.
virtual XMLUnknown * ToUnknown()
Safely cast to an Unknown, or null.
virtual char * ParseDeep(char *p, StrPair *parentEndTag, int *curLineNumPtr)
virtual XMLDocument * ToDocument()
Safely cast to a Document, or null.
int GetLineNum() const
Gets the line number the node is in, if the document was parsed from a file.
const XMLElement * FirstChildElement(const char *name=0) const
XMLNode * LinkEndChild(XMLNode *addThis)
XMLNode * PreviousSibling()
void DeleteChild(XMLNode *node)
void SetUserData(void *userData)
virtual const XMLText * ToText() const
int ChildElementCount(const char *value) const
const XMLDocument * GetDocument() const
Get the XMLDocument that owns this XMLNode.
virtual XMLElement * ToElement()
Safely cast to an Element, or null.
virtual bool CompactMode(const XMLElement &)
void OpenElement(const char *name, bool compactMode=false)
void PushAttribute(const char *name, int value)
void PushUnknown(const char *value)
void PushText(double value)
Add a text node from a double.
virtual bool VisitEnter(const XMLDocument &) override
Visit a document.
void PushText(bool value)
Add a text node from a bool.
void PushText(const char *text, bool cdata=false)
Add a text node.
void PushAttribute(const char *name, int64_t value)
XMLPrinter(FILE *file=0, bool compact=false, int depth=0, EscapeAposCharsInAttributes aposInAttributes=ESCAPE_APOS_CHARS_IN_ATTRIBUTES)
virtual bool VisitExit(const XMLElement &element) override
Visit an element.
const char * CStr() const
virtual void PrintSpace(int depth)
void PushAttribute(const char *name, const char *value)
If streaming, add an attribute to an open element.
virtual void CloseElement(bool compactMode=false)
If streaming, close the Element.
DynArray< const char *, 10 > _stack
void PushText(unsigned value)
Add a text node from an unsigned.
void PushText(float value)
Add a text node from a float.
virtual bool Visit(const XMLText &text) override
Visit a text node.
void PushAttribute(const char *name, bool value)
void Write(const char *data)
void PushText(int value)
Add a text node from an integer.
virtual void Putc(char ch)
virtual void Write(const char *data, size_t size)
void PushHeader(bool writeBOM, bool writeDeclaration)
virtual bool VisitEnter(const XMLElement &element, const XMLAttribute *attribute) override
Visit an element.
void PushAttribute(const char *name, double value)
void PushAttribute(const char *name, unsigned value)
virtual bool VisitExit(const XMLDocument &) override
Visit a document.
void ClearBuffer(bool resetToFirstElement=true)
virtual bool Visit(const XMLComment &comment) override
Visit a comment node.
EscapeAposCharsInAttributes
@ ESCAPE_APOS_CHARS_IN_ATTRIBUTES
void SealElementIfJustOpened()
void PushText(int64_t value)
Add a text node from a signed 64bit integer.
virtual void Print(const char *format,...)
void PushDeclaration(const char *value)
void PushComment(const char *comment)
Add a comment.
virtual bool Visit(const XMLDeclaration &declaration) override
Visit a declaration.
virtual bool Visit(const XMLUnknown &unknown) override
Visit an unknown node.
void PushText(uint64_t value)
Add a text node from an unsigned 64bit integer.
void PushAttribute(const char *name, uint64_t value)
virtual const XMLText * ToText() const override
bool CData() const
Returns true if this is a CDATA text element.
virtual bool ShallowEqual(const XMLNode *compare) const override
void SetCData(bool isCData)
Declare whether this should be CDATA or standard text.
virtual bool Accept(XMLVisitor *visitor) const override
XMLText(XMLDocument *doc)
char * ParseDeep(char *p, StrPair *parentEndTag, int *curLineNumPtr) override
virtual XMLNode * ShallowClone(XMLDocument *document) const override
virtual XMLText * ToText() override
Safely cast to Text, or null.
virtual XMLNode * ShallowClone(XMLDocument *document) const override
virtual const XMLUnknown * ToUnknown() const override
virtual bool ShallowEqual(const XMLNode *compare) const override
XMLUnknown(XMLDocument *doc)
virtual bool Accept(XMLVisitor *visitor) const override
char * ParseDeep(char *p, StrPair *parentEndTag, int *curLineNumPtr) override
virtual XMLUnknown * ToUnknown() override
Safely cast to an Unknown, or null.
static const char * SkipWhiteSpace(const char *p, int *curLineNumPtr)
static bool IsPrefixHex(const char *p)
static char * SkipWhiteSpace(char *const p, int *curLineNumPtr)
static void ToStr(bool v, char *buffer, int bufferSize)
static bool ToInt64(const char *str, int64_t *value)
static void ToStr(float v, char *buffer, int bufferSize)
static bool ToBool(const char *str, bool *value)
static void ToStr(uint64_t v, char *buffer, int bufferSize)
static void ToStr(int64_t v, char *buffer, int bufferSize)
static bool IsUTF8Continuation(const char p)
static bool ToUnsigned64(const char *str, uint64_t *value)
static void ConvertUTF32ToUTF8(unsigned long input, char *output, int *length)
static bool StringEqual(const char *p, const char *q, int nChar=INT_MAX)
static void SetBoolSerialization(const char *writeTrue, const char *writeFalse)
static void ToStr(double v, char *buffer, int bufferSize)
static void ToStr(int v, char *buffer, int bufferSize)
static bool IsNameChar(unsigned char ch)
static bool ToUnsigned(const char *str, unsigned *value)
static const char * ReadBOM(const char *p, bool *hasBOM)
static bool ToDouble(const char *str, double *value)
static bool IsNameStartChar(unsigned char ch)
static const char * GetCharacterRef(const char *p, char *value, int *length)
static bool ToFloat(const char *str, float *value)
static bool IsWhiteSpace(char p)
static bool ToInt(const char *str, int *value)
static void ToStr(unsigned v, char *buffer, int bufferSize)
virtual bool Visit(const XMLDeclaration &)
Visit a declaration.
virtual bool VisitEnter(const XMLDocument &)
Visit a document.
virtual bool VisitEnter(const XMLElement &, const XMLAttribute *)
Visit an element.
virtual bool Visit(const XMLComment &)
Visit a comment node.
virtual bool VisitExit(const XMLDocument &)
Visit a document.
virtual bool Visit(const XMLText &)
Visit a text node.
virtual bool VisitExit(const XMLElement &)
Visit an element.
virtual bool Visit(const XMLUnknown &)
Visit an unknown node.
static const char * ALLOCATION_TAG
@ XML_ERROR_PARSING_DECLARATION
@ XML_WRONG_ATTRIBUTE_TYPE
@ XML_ERROR_PARSING_CDATA
@ XML_CAN_NOT_CONVERT_TEXT
@ XML_ERROR_PARSING_COMMENT
@ XML_ERROR_FILE_COULD_NOT_BE_OPENED
@ XML_ERROR_MISMATCHED_ELEMENT
@ XML_ERROR_FILE_NOT_FOUND
@ XML_ERROR_PARSING_ATTRIBUTE
@ XML_ERROR_FILE_READ_ERROR
@ XML_ERROR_PARSING_ELEMENT
@ XML_ELEMENT_DEPTH_EXCEEDED
@ XML_ERROR_PARSING_UNKNOWN
@ XML_ERROR_EMPTY_DOCUMENT
static const int TINYXML2_MAX_ELEMENT_DEPTH
std::enable_if<!std::is_polymorphic< T >::value >::type Delete(T *pointerToT)