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 = 6;
110static const int TIXML2_MINOR_VERSION = 1;
111static const int TIXML2_PATCH_VERSION = 0;
113#define TINYXML2_MAJOR_VERSION 6
114#define TINYXML2_MINOR_VERSION 1
115#define TINYXML2_PATCH_VERSION 0
144 NEEDS_ENTITY_PROCESSING = 0x01,
145 NEEDS_NEWLINE_NORMALIZATION = 0x02,
146 NEEDS_WHITESPACE_COLLAPSING = 0x04,
148 TEXT_ELEMENT = NEEDS_ENTITY_PROCESSING | NEEDS_NEWLINE_NORMALIZATION,
149 TEXT_ELEMENT_LEAVE_ENTITIES = NEEDS_NEWLINE_NORMALIZATION,
151 ATTRIBUTE_VALUE = NEEDS_ENTITY_PROCESSING | NEEDS_NEWLINE_NORMALIZATION,
152 ATTRIBUTE_VALUE_LEAVE_ENTITIES = NEEDS_NEWLINE_NORMALIZATION,
153 COMMENT = NEEDS_NEWLINE_NORMALIZATION
156 StrPair() : _flags( 0 ), _start( 0 ), _end( 0 ) {}
159 void Set(
char* start,
char* end,
int flags ) {
160 TIXMLASSERT( start );
165 _flags = flags | NEEDS_FLUSH;
171 return _start == _end;
176 _start =
const_cast<char*
>(str);
179 void SetStr(
const char* str,
int flags=0 );
181 char*
ParseText(
char* in,
const char* endTag,
int strFlags,
int* curLineNumPtr );
188 void CollapseWhitespace();
200 void operator=(
StrPair& other );
209template <
class T,
int INITIAL_SIZE>
215 _allocated( INITIAL_SIZE ),
221 if ( _mem != _pool ) {
222 Aws::DeleteArray<T>(_mem);
231 TIXMLASSERT( _size < INT_MAX );
232 EnsureCapacity( _size+1 );
238 TIXMLASSERT( count >= 0 );
239 TIXMLASSERT( _size <= INT_MAX - count );
240 EnsureCapacity( _size+count );
241 T* ret = &_mem[_size];
247 TIXMLASSERT( _size > 0 );
253 TIXMLASSERT( _size >= count );
262 TIXMLASSERT( i>= 0 && i < _size );
267 TIXMLASSERT( i>= 0 && i < _size );
272 TIXMLASSERT( _size > 0 );
273 return _mem[ _size - 1];
277 TIXMLASSERT( _size >= 0 );
282 TIXMLASSERT( _allocated >= INITIAL_SIZE );
287 TIXMLASSERT(i >= 0 && i < _size);
288 TIXMLASSERT(_size > 0);
289 _mem[i] = _mem[_size - 1];
307 void EnsureCapacity(
int cap ) {
308 TIXMLASSERT( cap > 0 );
309 if ( cap > _allocated ) {
310 TIXMLASSERT( cap <= INT_MAX / 2 );
311 int newAllocated = cap * 2;
313 TIXMLASSERT( newAllocated >= _size );
314 memcpy( newMem, _mem,
sizeof(T)*_size );
315 if ( _mem != _pool ) {
316 Aws::DeleteArray<T>(_mem);
319 _allocated = newAllocated;
324 T _pool[INITIAL_SIZE];
342 virtual void Free(
void* ) = 0;
351template<
int ITEM_SIZE >
355 MemPoolT() : _blockPtrs(), _root(0), _currentAllocs(0), _nAllocs(0), _maxAllocs(0), _nUntracked(0) {}
362 while( !_blockPtrs.
Empty()) {
363 Block* lastBlock = _blockPtrs.
Pop();
377 return _currentAllocs;
384 _blockPtrs.
Push( block );
386 Item* blockItems = block->items;
388 blockItems[i].next = &(blockItems[i + 1]);
393 Item*
const result = _root;
394 TIXMLASSERT( result != 0 );
398 if ( _currentAllocs > _maxAllocs ) {
399 _maxAllocs = _currentAllocs;
406 virtual void Free(
void* mem ) {
411 Item* item =
static_cast<Item*
>( mem );
413 memset( item, 0xfe,
sizeof( *item ) );
419 printf(
"Mempool %s watermark=%d [%dk] current=%d size=%d nAlloc=%d blocks=%d\n",
420 name, _maxAllocs, _maxAllocs * ITEM_SIZE / 1024, _currentAllocs,
421 ITEM_SIZE, _nAllocs, _blockPtrs.
Size() );
451 char itemData[ITEM_SIZE];
456 DynArray< Block*, 10 > _blockPtrs;
563 while( IsWhiteSpace(*p) ) {
564 if (curLineNumPtr && *p ==
'\n') {
573 return const_cast<char*
>( SkipWhiteSpace(
const_cast<const char*
>(p), curLineNumPtr ) );
579 return !IsUTF8Continuation(p) && isspace(
static_cast<unsigned char>(p) );
587 if ( isalpha( ch ) ) {
590 return ch ==
':' || ch ==
'_';
594 return IsNameStartChar( ch )
600 inline static bool StringEqual(
const char* p,
const char* q,
int nChar=INT_MAX ) {
606 TIXMLASSERT( nChar >= 0 );
607 return strncmp( p, q, nChar ) == 0;
611 return ( p & 0x80 ) != 0;
614 static const char*
ReadBOM(
const char* p,
bool* hasBOM );
621 static void ToStr(
int v,
char* buffer,
int bufferSize );
622 static void ToStr(
unsigned v,
char* buffer,
int bufferSize );
623 static void ToStr(
bool v,
char* buffer,
int bufferSize );
624 static void ToStr(
float v,
char* buffer,
int bufferSize );
625 static void ToStr(
double v,
char* buffer,
int bufferSize );
626 static void ToStr(int64_t v,
char* buffer,
int bufferSize);
629 static bool ToInt(
const char* str,
int* 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);
644 static const char* writeBoolTrue;
645 static const char* writeBoolFalse;
682 TIXMLASSERT( _document );
687 TIXMLASSERT( _document );
749 void SetValue(
const char* val,
bool staticMem=
false );
783 return const_cast<XMLElement*
>(
const_cast<const XMLNode*
>(
this)->FirstChildElement( name ));
801 return const_cast<XMLElement*
>(
const_cast<const XMLNode*
>(
this)->LastChildElement(name) );
817 return const_cast<XMLElement*
>(
const_cast<const XMLNode*
>(
this)->PreviousSiblingElement( name ) );
833 return const_cast<XMLElement*
>(
const_cast<const XMLNode*
>(
this)->NextSiblingElement( name ) );
846 return InsertEndChild( addThis );
970 static void DeleteNode(
XMLNode* node );
971 void InsertChildPreamble(
XMLNode* insertThis )
const;
972 const XMLElement* ToElementWithName(
const char* name )
const;
1170 QueryInt64Value(&i);
1177 QueryUnsignedValue( &i );
1183 QueryBoolValue( &b );
1189 QueryDoubleValue( &d );
1195 QueryFloatValue( &f );
1231 enum { BUF_SIZE = 200 };
1233 XMLAttribute() : _name(), _value(),_parseLineNum( 0 ), _next( 0 ), _memPool( 0 ) {}
1234 virtual ~XMLAttribute() {}
1236 XMLAttribute(
const XMLAttribute& );
1237 void operator=(
const XMLAttribute& );
1238 void SetName(
const char* name );
1240 char* ParseDeep(
char* p,
bool processEntities,
int* curLineNumPtr );
1242 mutable StrPair _name;
1243 mutable StrPair _value;
1245 XMLAttribute* _next;
1263 void SetName(
const char* str,
bool staticMem=
false ) {
1264 SetValue( str, staticMem );
1298 const char*
Attribute(
const char* name,
const char* value=0 )
const;
1401 return QueryIntAttribute( name, value );
1405 return QueryUnsignedAttribute( name, value );
1409 return QueryInt64Attribute(name, value);
1413 return QueryBoolAttribute( name, value );
1417 return QueryDoubleAttribute( name, value );
1421 return QueryFloatAttribute( name, value );
1469 return _rootAttribute;
1610 return _closingType;
1627 XMLAttribute* FindOrCreateAttribute(
const char* name );
1629 char* ParseAttributes(
char* p,
int* curLineNumPtr );
1630 static void DeleteAttribute(
XMLAttribute* attribute );
1633 enum { BUF_SIZE = 200 };
1634 ElementClosingType _closingType;
1638 XMLAttribute* _rootAttribute;
1669 TIXMLASSERT(
this == _document );
1673 TIXMLASSERT(
this == _document );
1726 return _processEntities;
1729 return _whitespaceMode;
1748 return FirstChildElement();
1751 return FirstChildElement();
1840 return _errorLineNum;
1873 bool _processEntities;
1879 int _parseCurLineNum;
1897 void SetError(
XMLError error,
int lineNum,
const char* format, ... );
1899 template<
class NodeType,
int PoolElementSize>
1903template<
class NodeType,
int PoolElementSize>
1904inline NodeType* XMLDocument::CreateUnlinkedNode( MemPoolT<PoolElementSize>& pool )
1906 TIXMLASSERT(
sizeof( NodeType ) == PoolElementSize );
1907 TIXMLASSERT(
sizeof( NodeType ) == pool.ItemSize() );
1908 NodeType* returnNode =
new (pool.Alloc()) NodeType(
this );
1909 TIXMLASSERT( returnNode );
1910 returnNode->_memPool = &pool;
1912 _unlinked.Push(returnNode);
1991 return XMLHandle( _node ? _node->FirstChild() : 0 );
1995 return XMLHandle( _node ? _node->FirstChildElement( name ) : 0 );
1999 return XMLHandle( _node ? _node->LastChild() : 0 );
2003 return XMLHandle( _node ? _node->LastChildElement( name ) : 0 );
2007 return XMLHandle( _node ? _node->PreviousSibling() : 0 );
2011 return XMLHandle( _node ? _node->PreviousSiblingElement( name ) : 0 );
2015 return XMLHandle( _node ? _node->NextSibling() : 0 );
2019 return XMLHandle( _node ? _node->NextSiblingElement( name ) : 0 );
2028 return ( _node ? _node->ToElement() : 0 );
2032 return ( _node ? _node->ToText() : 0 );
2036 return ( _node ? _node->ToUnknown() : 0 );
2040 return ( _node ? _node->ToDeclaration() : 0 );
2071 return XMLConstHandle( _node ? _node->FirstChildElement( name ) : 0 );
2077 return XMLConstHandle( _node ? _node->LastChildElement( name ) : 0 );
2083 return XMLConstHandle( _node ? _node->PreviousSiblingElement( name ) : 0 );
2089 return XMLConstHandle( _node ? _node->NextSiblingElement( name ) : 0 );
2097 return ( _node ? _node->ToElement() : 0 );
2100 return ( _node ? _node->ToText() : 0 );
2103 return ( _node ? _node->ToUnknown() : 0 );
2106 return ( _node ? _node->ToDeclaration() : 0 );
2223 return _buffer.Mem();
2231 return _buffer.Size();
2240 _firstElement =
true;
2251 void Write(
const char* data,
size_t size );
2252 inline void Write(
const char* data ) {
Write( data, strlen( data ) ); }
2260 void PrintString(
const char*,
bool restrictedEntitySet );
2266 bool _processEntities;
2273 bool _entityFlag[ENTITY_RANGE];
2274 bool _restrictedEntityFlag[ENTITY_RANGE];
2288#if defined(_MSC_VER)
2289# pragma warning(pop)
const T & operator[](int i) const
const T & PeekTop() const
virtual void Free(void *)=0
virtual int ItemSize() const =0
virtual void SetTracked()=0
void Trace(const char *name)
int CurrentAllocs() const
virtual void Free(void *mem)
virtual int ItemSize() const
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)
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()
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(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()
Safely cast to a Declaration, or null.
virtual XMLNode * ShallowClone(XMLDocument *document) const
char * ParseDeep(char *p, StrPair *parentEndTag, int *curLineNumPtr)
virtual ~XMLDeclaration()
virtual bool ShallowEqual(const XMLNode *compare) const
XMLDeclaration(XMLDocument *doc)
virtual bool Accept(XMLVisitor *visitor) const
virtual const XMLDeclaration * ToDeclaration() const
void Print(XMLPrinter *streamer=0) const
XMLError SaveFile(const char *filename, bool compact=false)
bool ProcessEntities() const
virtual bool ShallowEqual(const XMLNode *) const
XMLError LoadFile(const char *filename)
int ErrorLineNum() const
Return the line where the error occurred, or zero if unknown.
virtual XMLNode * ShallowClone(XMLDocument *) const
void DeleteNode(XMLNode *node)
bool Error() const
Return true if there was an error parsing the document.
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)
char * Identify(char *p, XMLNode **node)
XMLDocument(bool processEntities=true, Whitespace whitespaceMode=PRESERVE_WHITESPACE)
constructor
virtual XMLDocument * ToDocument()
Safely cast to a Document, or null.
XMLElement * NewElement(const char *name)
const char * ErrorStr() const
XMLText * NewText(const char *text)
const XMLElement * RootElement() const
virtual bool Accept(XMLVisitor *visitor) const
void Clear()
Clear the document, resetting it to the initial state.
XMLError Parse(const char *xml, size_t nBytes=(size_t)(-1))
XMLError SaveFile(FILE *fp, bool compact=false)
const char * ErrorName() const
XMLError LoadFile(FILE *)
XMLUnknown * NewUnknown(const char *text)
Whitespace WhitespaceMode() const
void MarkInUse(XMLNode *)
XMLComment * NewComment(const char *comment)
XMLError ErrorID() const
Return the errorID.
virtual const XMLDocument * ToDocument() const
void DeepCopy(XMLDocument *target) const
XMLElement * RootElement()
virtual bool Accept(XMLVisitor *visitor) const
void DeleteAttribute(const char *name)
unsigned UnsignedAttribute(const char *name, unsigned defaultValue=0) const
See IntAttribute()
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.
virtual bool ShallowEqual(const XMLNode *compare) const
char * ParseDeep(char *p, StrPair *parentEndTag, int *curLineNumPtr)
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.
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()
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 XMLNode * ShallowClone(XMLDocument *document) const
XMLError QueryFloatText(float *fval) const
See QueryIntText()
XMLError QueryUnsignedAttribute(const char *name, unsigned int *value) const
See QueryIntAttribute()
void SetAttribute(const char *name, float value)
Sets the named attribute to value.
void SetText(double value)
Convenience method for setting text inside an element. See SetText() for important limitations.
virtual const XMLElement * ToElement() const
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()
void SetText(bool value)
Convenience method for setting text inside an element. See SetText() for important limitations.
int QueryAttribute(const char *name, bool *value) const
ElementClosingType ClosingType() const
XMLError QueryInt64Text(int64_t *uval) const
See QueryIntText()
int QueryAttribute(const char *name, double *value) const
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()
int QueryAttribute(const char *name, int64_t *value) const
void SetText(const char *inText)
bool BoolAttribute(const char *name, bool defaultValue=false) const
See IntAttribute()
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 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
double DoubleAttribute(const char *name, double defaultValue=0) const
See IntAttribute()
int QueryAttribute(const char *name, float *value) const
XMLError QueryIntText(int *ival) const
int QueryAttribute(const char *name, unsigned int *value) const
virtual XMLElement * ToElement()
Safely cast to an Element, or null.
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()
XMLError QueryDoubleAttribute(const char *name, double *value) const
See QueryIntAttribute()
int QueryAttribute(const char *name, int *value) const
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.
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
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 Write(const char *data, size_t size)
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 Visit(const XMLComment &comment)
Visit a comment node.
virtual bool Visit(const XMLDeclaration &declaration)
Visit a declaration.
void PushText(bool value)
Add a text node from a bool.
virtual bool Visit(const XMLText &text)
Visit a text node.
void PushText(const char *text, bool cdata=false)
Add a text node.
void PushAttribute(const char *name, int64_t value)
const char * CStr() const
virtual void PrintSpace(int depth)
virtual bool VisitExit(const XMLDocument &)
Visit a document.
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 VisitEnter(const XMLDocument &)
Visit a document.
void PushAttribute(const char *name, bool value)
void Write(const char *data)
void PushText(int value)
Add a text node from an integer.
void Print(const char *format,...)
void PushHeader(bool writeBOM, bool writeDeclaration)
void PushAttribute(const char *name, double value)
virtual bool VisitExit(const XMLElement &element)
Visit an element.
void PushAttribute(const char *name, unsigned value)
virtual bool Visit(const XMLUnknown &unknown)
Visit an unknown node.
virtual bool VisitEnter(const XMLElement &element, const XMLAttribute *attribute)
Visit an element.
XMLPrinter(FILE *file=0, bool compact=false, int depth=0)
void SealElementIfJustOpened()
void PushText(int64_t value)
Add a text node from an unsigned.
void PushDeclaration(const char *value)
void PushComment(const char *comment)
Add a comment.
char * ParseDeep(char *p, StrPair *parentEndTag, int *curLineNumPtr)
bool CData() const
Returns true if this is a CDATA text element.
virtual bool ShallowEqual(const XMLNode *compare) const
void SetCData(bool isCData)
Declare whether this should be CDATA or standard text.
virtual XMLText * ToText()
Safely cast to Text, or null.
XMLText(XMLDocument *doc)
virtual bool Accept(XMLVisitor *visitor) const
virtual const XMLText * ToText() const
virtual XMLNode * ShallowClone(XMLDocument *document) const
virtual const XMLUnknown * ToUnknown() const
virtual bool Accept(XMLVisitor *visitor) const
char * ParseDeep(char *p, StrPair *parentEndTag, int *curLineNumPtr)
virtual XMLNode * ShallowClone(XMLDocument *document) const
XMLUnknown(XMLDocument *doc)
virtual bool ShallowEqual(const XMLNode *compare) const
virtual XMLUnknown * ToUnknown()
Safely cast to an Unknown, or null.
static const char * SkipWhiteSpace(const char *p, int *curLineNumPtr)
static void ToStr(bool v, char *buffer, int bufferSize)
static bool IsUTF8Continuation(char p)
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(int64_t v, char *buffer, int bufferSize)
static void ConvertUTF32ToUTF8(unsigned long input, char *output, int *length)
static bool StringEqual(const char *p, const char *q, int nChar=INT_MAX)
static char * SkipWhiteSpace(char *p, int *curLineNumPtr)
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
@ UNUSED_XML_ERROR_ELEMENT_MISMATCH
@ 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
@ UNUSED_XML_ERROR_IDENTIFYING_TAG
@ XML_ERROR_PARSING_ELEMENT
@ XML_ERROR_PARSING_UNKNOWN
@ XML_ERROR_EMPTY_DOCUMENT
std::enable_if<!std::is_polymorphic< T >::value >::type Delete(T *pointerToT)