24#ifndef TINYXML2_INCLUDED
25#define TINYXML2_INCLUDED
27#if defined(ANDROID_NDK) || defined(__BORLANDC__) || defined(__QNXNTO__)
52#if defined( _DEBUG ) || defined( DEBUG ) || defined (__DEBUG__)
60# pragma warning(disable: 4251)
64# ifdef TINYXML2_EXPORT
65# define TINYXML2_LIB __declspec(dllexport)
66# elif defined(TINYXML2_IMPORT)
67# define TINYXML2_LIB __declspec(dllimport)
79# define TIXMLASSERT( x ) if ( !((void)0,(x))) { __debugbreak(); }
80# elif defined (ANDROID_NDK)
81# include <android/log.h>
82# define TIXMLASSERT( x ) if ( !(x)) { __android_log_assert( "assert", "grinliz", "ASSERT in '%s' at %d.", __FILE__, __LINE__ ); }
85# define TIXMLASSERT assert
88# define TIXMLASSERT( x ) {}
155 char*
ParseText(
char*
in,
const char* endTag,
int strFlags );
183template <
class T,
int INITIAL_SIZE>
275 int newAllocated =
cap * 2;
276 T* newMem =
new T[newAllocated];
305 virtual void Free(
void* ) = 0;
380 printf(
"Mempool %s watermark=%d [%dk] current=%d size=%d nAlloc=%d blocks=%d\n",
528 return const_cast<char*
>(
SkipWhiteSpace(
const_cast<const char*
>(
p) ) );
545 return ch ==
':' || ch ==
'_';
563 return (
p & 0x80 ) != 0;
566 static const char*
ReadBOM(
const char*
p,
bool* hasBOM );
683 const char*
Value()
const;
688 void SetValue(
const char*
val,
bool staticMem=
false );
716 const XMLElement* FirstChildElement(
const char*
name = 0 )
const;
750 const XMLElement* PreviousSiblingElement(
const char*
name = 0 )
const ;
766 const XMLElement* NextSiblingElement(
const char*
name = 0 )
const;
782 return InsertEndChild( addThis );
805 void DeleteChildren();
859 virtual char* ParseDeep(
char*,
StrPair* );
875 void InsertChildPreamble(
XMLNode* insertThis )
const;
896 friend class XMLBase;
899 virtual bool Accept(
XMLVisitor* visitor )
const;
924 char* ParseDeep(
char*,
StrPair* endTag );
946 virtual bool Accept(
XMLVisitor* visitor )
const;
955 char* ParseDeep(
char*,
StrPair* endTag );
985 virtual bool Accept(
XMLVisitor* visitor )
const;
994 char* ParseDeep(
char*,
StrPair* endTag );
1020 virtual bool Accept(
XMLVisitor* visitor )
const;
1029 char* ParseDeep(
char*,
StrPair* endTag );
1049 const char*
Name()
const;
1052 const char*
Value()
const;
1065 QueryIntValue( &
i );
1071 QueryUnsignedValue( &
i );
1077 QueryBoolValue( &
b );
1083 QueryDoubleValue( &
d );
1089 QueryFloatValue( &
f );
1108 void SetAttribute(
const char*
value );
1110 void SetAttribute(
int value );
1112 void SetAttribute(
unsigned value );
1114 void SetAttribute(
bool value );
1116 void SetAttribute(
double value );
1118 void SetAttribute(
float value );
1128 void SetName(
const char*
name );
1130 char* ParseDeep(
char*
p,
bool processEntities );
1145 friend class XMLBase;
1163 virtual bool Accept(
XMLVisitor* visitor )
const;
1188 const char* Attribute(
const char*
name,
const char*
value=0 )
const;
1197 QueryIntAttribute(
name, &
i );
1203 QueryUnsignedAttribute(
name, &
i );
1209 QueryBoolAttribute(
name, &
b );
1215 QueryDoubleAttribute(
name, &
d );
1221 QueryFloatAttribute(
name, &
f );
1243 return a->QueryIntValue(
value );
1251 return a->QueryUnsignedValue(
value );
1259 return a->QueryBoolValue(
value );
1267 return a->QueryDoubleValue(
value );
1275 return a->QueryFloatValue(
value );
1297 return QueryIntAttribute(
name,
value );
1301 return QueryUnsignedAttribute(
name,
value );
1305 return QueryBoolAttribute(
name,
value );
1309 return QueryDoubleAttribute(
name,
value );
1313 return QueryFloatAttribute(
name,
value );
1319 a->SetAttribute(
value );
1324 a->SetAttribute(
value );
1329 a->SetAttribute(
value );
1334 a->SetAttribute(
value );
1339 a->SetAttribute(
value );
1344 a->SetAttribute(
value );
1350 void DeleteAttribute(
const char*
name );
1354 return _rootAttribute;
1387 const char* GetText()
const;
1423 void SetText(
const char* inText );
1425 void SetText(
int value );
1427 void SetText(
unsigned value );
1429 void SetText(
bool value );
1431 void SetText(
double value );
1433 void SetText(
float value );
1461 XMLError QueryIntText(
int* ival )
const;
1463 XMLError QueryUnsignedText(
unsigned* uval )
const;
1469 XMLError QueryFloatText(
float* fval )
const;
1478 return _closingType;
1484 char* ParseDeep(
char*
p,
StrPair* endTag );
1497 char* ParseAttributes(
char*
p );
1547 XMLError Parse(
const char* xml,
size_t nBytes=(
size_t)(-1) );
1586 return _processEntities;
1608 return FirstChildElement();
1611 return FirstChildElement();
1629 virtual bool Accept(
XMLVisitor* visitor )
const;
1674 void SetError(
XMLError error,
const char* str1,
const char* str2 );
1684 const char* ErrorName()
const;
1811 return XMLHandle( _node ? _node->FirstChild() : 0 );
1815 return XMLHandle( _node ? _node->FirstChildElement(
name ) : 0 );
1819 return XMLHandle( _node ? _node->LastChild() : 0 );
1823 return XMLHandle( _node ? _node->LastChildElement(
name ) : 0 );
1827 return XMLHandle( _node ? _node->PreviousSibling() : 0 );
1831 return XMLHandle( _node ? _node->PreviousSiblingElement(
name ) : 0 );
1835 return XMLHandle( _node ? _node->NextSibling() : 0 );
1839 return XMLHandle( _node ? _node->NextSiblingElement(
name ) : 0 );
1848 return ( ( _node == 0 ) ? 0 : _node->ToElement() );
1852 return ( ( _node == 0 ) ? 0 : _node->ToText() );
1856 return ( ( _node == 0 ) ? 0 : _node->ToUnknown() );
1860 return ( ( _node == 0 ) ? 0 : _node->ToDeclaration() );
1920 return ( ( _node == 0 ) ? 0 : _node->ToElement() );
1923 return ( ( _node == 0 ) ? 0 : _node->ToText() );
1926 return ( ( _node == 0 ) ? 0 : _node->ToUnknown() );
1929 return ( ( _node == 0 ) ? 0 : _node->ToDeclaration() );
1992 void PushHeader(
bool writeBOM,
bool writeDeclaration );
1996 void OpenElement(
const char*
name,
bool compactMode=
false );
1998 void PushAttribute(
const char*
name,
const char*
value );
1999 void PushAttribute(
const char*
name,
int value );
2000 void PushAttribute(
const char*
name,
unsigned value );
2001 void PushAttribute(
const char*
name,
bool value );
2002 void PushAttribute(
const char*
name,
double value );
2004 virtual void CloseElement(
bool compactMode=
false );
2007 void PushText(
const char*
text,
bool cdata=
false );
2009 void PushText(
int value );
2011 void PushText(
unsigned value );
2013 void PushText(
bool value );
2015 void PushText(
float value );
2017 void PushText(
double value );
2020 void PushComment(
const char*
comment );
2022 void PushDeclaration(
const char*
value );
2023 void PushUnknown(
const char*
value );
2043 return _buffer.Mem();
2051 return _buffer.Size();
2069 void Print(
const char*
format, ... );
2071 void SealElementIfJustOpened();
2076 void PrintString(
const char*,
bool restrictedEntitySet );
2089 bool _entityFlag[ENTITY_RANGE];
2090 bool _restrictedEntityFlag[ENTITY_RANGE];
2098#if defined(_MSC_VER)
2099# pragma warning(pop)
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
static __inline VOID DeleteNode(NODE *node)
static VOID PrintError(DWORD dwError)
void EnsureCapacity(int cap)
const T & PeekTop() const
void operator=(const DynArray &)
const T & operator[](int i) const
DynArray(const DynArray &)
void Trace(const char *name)
virtual int ItemSize() const
virtual void Free(void *mem)
void operator=(const MemPoolT &)
int CurrentAllocs() const
MemPoolT(const MemPoolT &)
DynArray< Block *, 10 > _blockPtrs
virtual int ItemSize() const =0
virtual void Free(void *)=0
virtual void SetTracked()=0
void operator=(StrPair &other)
void SetStr(const char *str, int flags=0)
void SetInternedStr(const char *str)
@ NEEDS_WHITESPACE_COLLAPSING
@ ATTRIBUTE_VALUE_LEAVE_ENTITIES
@ NEEDS_ENTITY_PROCESSING
@ NEEDS_NEWLINE_NORMALIZATION
@ TEXT_ELEMENT_LEAVE_ENTITIES
void TransferTo(StrPair *other)
void Set(char *start, char *end, int flags)
char * ParseName(char *in)
StrPair(const StrPair &other)
char * ParseText(char *in, const char *endTag, int strFlags)
void CollapseWhitespace()
unsigned UnsignedValue() const
Query as an unsigned integer. See IntValue()
float FloatValue() const
Query as a float. See IntValue()
void operator=(const XMLAttribute &)
XMLAttribute(const XMLAttribute &)
double DoubleValue() const
Query as a double. See IntValue()
bool BoolValue() const
Query as a boolean. See IntValue()
const XMLAttribute * Next() const
The next attribute in the list.
XMLConstHandle(const XMLNode *node)
const XMLText * ToText() const
XMLConstHandle & operator=(const XMLConstHandle &ref)
const XMLConstHandle NextSiblingElement(const char *name=0) const
const XMLElement * ToElement() const
XMLConstHandle(const XMLConstHandle &ref)
const XMLUnknown * ToUnknown() const
const XMLDeclaration * ToDeclaration() const
XMLConstHandle(const XMLNode &node)
const XMLConstHandle LastChild() const
const XMLConstHandle LastChildElement(const char *name=0) const
const XMLConstHandle FirstChildElement(const char *name=0) const
const XMLNode * ToNode() const
const XMLConstHandle PreviousSibling() const
const XMLConstHandle NextSibling() const
const XMLConstHandle FirstChild() const
const XMLConstHandle PreviousSiblingElement(const char *name=0) const
XMLDeclaration & operator=(const XMLDeclaration &)
XMLDeclaration(const XMLDeclaration &)
virtual const XMLDeclaration * ToDeclaration() const
virtual XMLDeclaration * ToDeclaration()
Safely cast to a Declaration, or null.
XMLElement * RootElement()
bool Error() const
Return true if there was an error parsing the document.
const XMLElement * RootElement() const
bool ProcessEntities() const
virtual bool ShallowEqual(const XMLNode *) const
Whitespace WhitespaceMode() const
virtual XMLDocument * ToDocument()
Safely cast to a Document, or null.
const char * GetErrorStr1() const
Return a possibly helpful diagnostic location or string.
void operator=(const XMLDocument &)
virtual const XMLDocument * ToDocument() const
const char * GetErrorStr2() const
Return a possibly helpful secondary diagnostic location or string.
XMLDocument(const XMLDocument &)
virtual XMLNode * ShallowClone(XMLDocument *) const
XMLError ErrorID() const
Return the errorID.
int QueryAttribute(const char *name, int *value) const
bool BoolAttribute(const char *name) const
See IntAttribute()
void SetAttribute(const char *name, const char *value)
Sets the named attribute to value.
XMLError QueryBoolAttribute(const char *name, bool *value) const
See QueryIntAttribute()
int QueryAttribute(const char *name, unsigned int *value) const
XMLElement(const XMLElement &)
void SetAttribute(const char *name, double value)
Sets the named attribute to value.
XMLError QueryUnsignedAttribute(const char *name, unsigned int *value) const
See QueryIntAttribute()
unsigned UnsignedAttribute(const char *name) const
See IntAttribute()
int QueryAttribute(const char *name, float *value) const
const XMLAttribute * FirstAttribute() const
Return the first attribute in the list.
void SetAttribute(const char *name, float value)
Sets the named attribute to value.
XMLError QueryDoubleAttribute(const char *name, double *value) const
See QueryIntAttribute()
float FloatAttribute(const char *name) const
See IntAttribute()
XMLAttribute * FindAttribute(const char *name)
int QueryAttribute(const char *name, double *value) const
double DoubleAttribute(const char *name) const
See IntAttribute()
XMLError QueryIntAttribute(const char *name, int *value) const
void SetName(const char *str, bool staticMem=false)
Set the name of the element.
virtual const XMLElement * ToElement() const
int QueryAttribute(const char *name, bool *value) const
void SetAttribute(const char *name, bool value)
Sets the named attribute to value.
void SetAttribute(const char *name, int value)
Sets the named attribute to value.
virtual XMLElement * ToElement()
Safely cast to an Element, or null.
const char * Name() const
Get the name of an element (which is the Value() of the node.)
XMLError QueryFloatAttribute(const char *name, float *value) const
See QueryIntAttribute()
int IntAttribute(const char *name) const
XMLAttribute * _rootAttribute
void SetAttribute(const char *name, unsigned value)
Sets the named attribute to value.
void operator=(const XMLElement &)
XMLHandle PreviousSibling()
Get the previous sibling of this handle.
XMLHandle LastChildElement(const char *name=0)
Get the last child element of this handle.
XMLHandle FirstChild()
Get the first child of this handle.
XMLNode * ToNode()
Safe cast to XMLNode. This can return null.
XMLHandle FirstChildElement(const char *name=0)
Get the first child element of this handle.
XMLHandle PreviousSiblingElement(const char *name=0)
Get the previous sibling element of this handle.
XMLDeclaration * ToDeclaration()
Safe cast to XMLDeclaration. This can return null.
XMLHandle(XMLNode *node)
Create a handle from any node (at any depth of the tree.) This can be a null pointer.
XMLHandle LastChild()
Get the last child of this handle.
XMLHandle & operator=(const XMLHandle &ref)
Assignment.
XMLHandle(XMLNode &node)
Create a handle from a node.
XMLHandle NextSibling()
Get the next sibling of this handle.
XMLElement * ToElement()
Safe cast to XMLElement. This can return null.
XMLText * ToText()
Safe cast to XMLText. This can return null.
XMLUnknown * ToUnknown()
Safe cast to XMLUnknown. This can return null.
XMLHandle NextSiblingElement(const char *name=0)
Get the next sibling element of this handle.
XMLHandle(const XMLHandle &ref)
Copy constructor.
virtual const XMLText * ToText() const
virtual XMLText * ToText()
Safely cast to Text, or null.
virtual XMLDeclaration * ToDeclaration()
Safely cast to a Declaration, or null.
XMLElement * FirstChildElement(const char *name=0)
XMLDocument * GetDocument()
Get the XMLDocument that owns this XMLNode.
XMLElement * LastChildElement(const char *name=0)
const XMLNode * Parent() const
Get the parent of this node on the DOM.
XMLNode & operator=(const XMLNode &)
XMLNode * PreviousSibling()
virtual XMLComment * ToComment()
Safely cast to a Comment, or null.
virtual XMLDocument * ToDocument()
Safely cast to a Document, or null.
const XMLNode * LastChild() const
Get the last child node, or null if none exists.
const XMLDocument * GetDocument() const
Get the XMLDocument that owns this XMLNode.
virtual const XMLElement * ToElement() const
virtual bool ShallowEqual(const XMLNode *compare) const =0
virtual bool Accept(XMLVisitor *visitor) const =0
XMLElement * NextSiblingElement(const char *name=0)
virtual XMLNode * ShallowClone(XMLDocument *document) const =0
const XMLNode * PreviousSibling() const
Get the previous (left) sibling node of this node.
virtual const XMLDeclaration * ToDeclaration() const
virtual XMLElement * ToElement()
Safely cast to an Element, or null.
virtual XMLUnknown * ToUnknown()
Safely cast to an Unknown, or null.
virtual const XMLUnknown * ToUnknown() const
const XMLNode * FirstChild() const
Get the first child node, or null if none exists.
XMLElement * PreviousSiblingElement(const char *name=0)
bool NoChildren() const
Returns true if this node has no children.
virtual const XMLDocument * ToDocument() const
XMLNode * LinkEndChild(XMLNode *addThis)
virtual const XMLComment * ToComment() const
const XMLNode * NextSibling() const
Get the next (right) sibling node of this node.
virtual bool VisitExit(const XMLDocument &)
Visit a document.
DynArray< char, 20 > _buffer
virtual bool CompactMode(const XMLElement &)
DynArray< const char *, 10 > _stack
const char * CStr() const
virtual const XMLText * ToText() const
virtual XMLText * ToText()
Safely cast to Text, or null.
XMLText & operator=(const XMLText &)
bool CData() const
Returns true if this is a CDATA text element.
void SetCData(bool isCData)
Declare whether this should be CDATA or standard text.
XMLText(XMLDocument *doc)
virtual XMLUnknown * ToUnknown()
Safely cast to an Unknown, or null.
XMLUnknown(const XMLUnknown &)
virtual const XMLUnknown * ToUnknown() const
XMLUnknown & operator=(const XMLUnknown &)
static bool IsNameChar(unsigned char ch)
static const char * SkipWhiteSpace(const char *p)
static bool ToUnsigned(const char *str, unsigned *value)
static void ConvertUTF32ToUTF8(unsigned long input, char *output, int *length)
static bool IsWhiteSpace(char p)
static bool ToFloat(const char *str, float *value)
static void ToStr(int v, char *buffer, int bufferSize)
static const char * GetCharacterRef(const char *p, char *value, int *length)
static char * SkipWhiteSpace(char *p)
static bool IsNameStartChar(unsigned char ch)
static bool StringEqual(const char *p, const char *q, int nChar=INT_MAX)
static bool ToInt(const char *str, int *value)
static bool IsUTF8Continuation(char p)
static bool ToDouble(const char *str, double *value)
static bool ToBool(const char *str, bool *value)
static const char * ReadBOM(const char *p, bool *hasBOM)
virtual bool Visit(const XMLUnknown &)
Visit an unknown node.
virtual bool VisitExit(const XMLDocument &)
Visit a document.
virtual bool VisitExit(const XMLElement &)
Visit an element.
virtual bool VisitEnter(const XMLDocument &)
Visit a document.
virtual bool Visit(const XMLComment &)
Visit a comment node.
virtual bool Visit(const XMLDeclaration &)
Visit a declaration.
virtual bool Visit(const XMLText &)
Visit a text node.
virtual bool VisitEnter(const XMLElement &, const XMLAttribute *)
Visit an element.
static WCHAR unknown[MAX_STRING_RESOURCE_LEN]
GLint GLint GLsizei GLsizei GLsizei depth
GLuint GLuint GLsizei count
GLdouble GLdouble GLdouble GLdouble q
GLboolean GLboolean GLboolean b
GLuint GLsizei GLsizei * length
GLboolean GLboolean GLboolean GLboolean a
GLenum GLenum GLenum input
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
void * LoadFile(const char *pszFileName, size_t *pFileSize)
NTSTATUS FindAttribute(PDEVICE_EXTENSION Vcb, PFILE_RECORD_HEADER MftRecord, ULONG Type, PCWSTR Name, ULONG NameLength, PNTFS_ATTR_CONTEXT *AttrCtx, PULONG Offset)
#define memcpy(s1, s2, n)
#define comment(fmt, arg1)
@ XML_ERROR_MISMATCHED_ELEMENT
@ XML_ERROR_EMPTY_DOCUMENT
@ XML_ERROR_ELEMENT_MISMATCH
@ XML_ERROR_PARSING_ATTRIBUTE
@ XML_ERROR_FILE_NOT_FOUND
@ XML_ERROR_IDENTIFYING_TAG
@ XML_ERROR_PARSING_COMMENT
@ XML_ERROR_FILE_READ_ERROR
@ XML_ERROR_PARSING_UNKNOWN
@ XML_ERROR_PARSING_CDATA
@ XML_ERROR_PARSING_DECLARATION
@ XML_WRONG_ATTRIBUTE_TYPE
@ XML_ERROR_PARSING_ELEMENT
@ XML_ERROR_FILE_COULD_NOT_BE_OPENED
@ XML_CAN_NOT_CONVERT_TEXT
VOID PrintString(LPCWSTR String, UINT MaxWidth, BOOL bAlignLeft)
VOID PrintSpace(UINT Length)
static const int TIXML2_PATCH_VERSION
static const int TIXML2_MAJOR_VERSION
static const int TIXML2_MINOR_VERSION
static int Unlink(const char **args)
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
static unsigned int block