24 #ifndef TINYXML2_INCLUDED 25 #define TINYXML2_INCLUDED 27 #if defined(ANDROID_NDK) || defined(__BORLANDC__) || defined(__QNXNTO__) 56 #if defined( _DEBUG ) || defined (__DEBUG__) 57 # ifndef TINYXML2_DEBUG 58 # define TINYXML2_DEBUG 63 # pragma warning(push) 64 # pragma warning(disable: 4251) 68 # ifdef TINYXML2_EXPORT 69 # define TINYXML2_LIB __declspec(dllexport) 70 # elif defined(TINYXML2_IMPORT) 71 # define TINYXML2_LIB __declspec(dllimport) 76 # define TINYXML2_LIB __attribute__((visibility("default"))) 82 #if defined(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 ) {} 101 static const int TIXML2_MAJOR_VERSION = 6;
102 static const int TIXML2_MINOR_VERSION = 2;
103 static const int TIXML2_PATCH_VERSION = 0;
105 #define TINYXML2_MAJOR_VERSION 6 106 #define TINYXML2_MINOR_VERSION 2 107 #define TINYXML2_PATCH_VERSION 0 114 static const int TINYXML2_MAX_ELEMENT_DEPTH = 100;
123 class XMLDeclaration;
149 StrPair() : _flags( 0 ), _start( 0 ), _end( 0 ) {}
152 void Set(
char* start,
char* end,
int flags ) {
158 _flags = flags | NEEDS_FLUSH;
164 return _start == _end;
169 _start =
const_cast<char*
>(str);
172 void SetStr(
const char* str,
int flags=0 );
174 char*
ParseText(
char* in,
const char* endTag,
int strFlags,
int* curLineNumPtr );
181 void CollapseWhitespace();
193 void operator=(
StrPair& other );
202 template <
class T,
int INITIAL_SIZE>
208 _allocated( INITIAL_SIZE ),
214 if ( _mem != _pool ) {
225 EnsureCapacity( _size+1 );
233 EnsureCapacity( _size+count );
234 T* ret = &_mem[_size];
266 return _mem[ _size - 1];
282 _mem[i] = _mem[_size - 1];
300 void EnsureCapacity(
int cap ) {
302 if ( cap > _allocated ) {
304 int newAllocated = cap * 2;
305 T* newMem =
new T[newAllocated];
307 memcpy( newMem, _mem,
sizeof(T)*_size );
308 if ( _mem != _pool ) {
312 _allocated = newAllocated;
317 T _pool[INITIAL_SIZE];
334 virtual void*
Alloc() = 0;
335 virtual void Free(
void* ) = 0;
337 virtual void Clear() = 0;
344 template<
int ITEM_SIZE >
345 class MemPoolT :
public MemPool
348 MemPoolT() : _blockPtrs(), _root(0), _currentAllocs(0), _nAllocs(0), _maxAllocs(0), _nUntracked(0) {}
355 while( !_blockPtrs.
Empty()) {
356 Block* lastBlock = _blockPtrs.
Pop();
370 return _currentAllocs;
376 Block* block =
new Block();
377 _blockPtrs.
Push( block );
379 Item* blockItems = block->items;
381 blockItems[i].next = &(blockItems[i + 1]);
386 Item*
const result = _root;
391 if ( _currentAllocs > _maxAllocs ) {
392 _maxAllocs = _currentAllocs;
399 virtual void Free(
void* mem ) {
404 Item* item =
static_cast<Item*
>( mem );
405 #ifdef TINYXML2_DEBUG 406 memset( item, 0xfe,
sizeof( *item ) );
412 printf(
"Mempool %s watermark=%d [%dk] current=%d size=%d nAlloc=%d blocks=%d\n",
413 name, _maxAllocs, _maxAllocs * ITEM_SIZE / 1024, _currentAllocs,
414 ITEM_SIZE, _nAllocs, _blockPtrs.
Size() );
444 char itemData[ITEM_SIZE];
449 DynArray< Block*, 10 > _blockPtrs;
555 while( IsWhiteSpace(*p) ) {
556 if (curLineNumPtr && *p ==
'\n') {
565 return const_cast<char*
>( SkipWhiteSpace( const_cast<const char*>(p), curLineNumPtr ) );
571 return !IsUTF8Continuation(p) && isspace( static_cast<unsigned char>(p) );
579 if ( isalpha( ch ) ) {
582 return ch ==
':' || ch ==
'_';
586 return IsNameStartChar( ch )
592 inline static bool StringEqual(
const char* p,
const char* q,
int nChar=INT_MAX ) {
599 return strncmp( p, q, nChar ) == 0;
603 return ( p & 0x80 ) != 0;
606 static const char* ReadBOM(
const char* p,
bool* hasBOM );
609 static const char* GetCharacterRef(
const char* p,
char* value,
int* length );
610 static void ConvertUTF32ToUTF8(
unsigned long input,
char* output,
int* length );
613 static void ToStr(
int v,
char* buffer,
int bufferSize );
614 static void ToStr(
unsigned v,
char* buffer,
int bufferSize );
615 static void ToStr(
bool v,
char* buffer,
int bufferSize );
616 static void ToStr(
float v,
char* buffer,
int bufferSize );
617 static void ToStr(
double v,
char* buffer,
int bufferSize );
618 static void ToStr(int64_t v,
char* buffer,
int bufferSize);
621 static bool ToInt(
const char* str,
int* value );
622 static bool ToUnsigned(
const char* str,
unsigned* value );
623 static bool ToBool(
const char* str,
bool* value );
624 static bool ToFloat(
const char* str,
float* value );
625 static bool ToDouble(
const char* str,
double* value );
626 static bool ToInt64(
const char* str, int64_t* value);
633 static void SetBoolSerialization(
const char* writeTrue,
const char* writeFalse);
636 static const char* writeBoolTrue;
637 static const char* writeBoolFalse;
668 friend class XMLDocument;
669 friend class XMLElement;
736 const char* Value()
const;
741 void SetValue(
const char* val,
bool staticMem=
false );
772 const XMLElement* FirstChildElement(
const char*
name = 0 )
const;
806 const XMLElement* PreviousSiblingElement(
const char*
name = 0 )
const ;
822 const XMLElement* NextSiblingElement(
const char*
name = 0 )
const;
838 return InsertEndChild( addThis );
861 void DeleteChildren();
866 void DeleteChild(
XMLNode* node );
900 virtual bool ShallowEqual(
const XMLNode* compare )
const = 0;
924 virtual bool Accept(
XMLVisitor* visitor )
const = 0;
944 virtual char* ParseDeep(
char* p,
StrPair* parentEndTag,
int* curLineNumPtr);
962 static void DeleteNode(
XMLNode* node );
963 void InsertChildPreamble(
XMLNode* insertThis )
const;
985 friend class XMLDocument;
987 virtual bool Accept( XMLVisitor* visitor )
const;
1006 virtual bool ShallowEqual(
const XMLNode* compare )
const;
1012 char* ParseDeep(
char* p,
StrPair* parentEndTag,
int* curLineNumPtr );
1025 friend class XMLDocument;
1034 virtual bool Accept(
XMLVisitor* visitor )
const;
1037 virtual bool ShallowEqual(
const XMLNode* compare )
const;
1043 char* ParseDeep(
char* p,
StrPair* parentEndTag,
int* curLineNumPtr);
1064 friend class XMLDocument;
1073 virtual bool Accept(
XMLVisitor* visitor )
const;
1076 virtual bool ShallowEqual(
const XMLNode* compare )
const;
1082 char* ParseDeep(
char* p,
StrPair* parentEndTag,
int* curLineNumPtr );
1099 friend class XMLDocument;
1108 virtual bool Accept(
XMLVisitor* visitor )
const;
1111 virtual bool ShallowEqual(
const XMLNode* compare )
const;
1117 char* ParseDeep(
char* p,
StrPair* parentEndTag,
int* curLineNumPtr );
1134 friend class XMLElement;
1137 const char* Name()
const;
1140 const char* Value()
const;
1162 QueryInt64Value(&i);
1169 QueryUnsignedValue( &i );
1175 QueryBoolValue( &b );
1181 QueryDoubleValue( &d );
1187 QueryFloatValue( &f );
1195 XMLError QueryIntValue(
int* value )
const;
1197 XMLError QueryUnsignedValue(
unsigned int* value )
const;
1199 XMLError QueryInt64Value(int64_t* value)
const;
1201 XMLError QueryBoolValue(
bool* value )
const;
1203 XMLError QueryDoubleValue(
double* value )
const;
1205 XMLError QueryFloatValue(
float* value )
const;
1208 void SetAttribute(
const char* value );
1210 void SetAttribute(
int value );
1212 void SetAttribute(
unsigned value );
1214 void SetAttribute(int64_t value);
1216 void SetAttribute(
bool value );
1218 void SetAttribute(
double value );
1220 void SetAttribute(
float value );
1223 enum { BUF_SIZE = 200 };
1225 XMLAttribute() : _name(), _value(),_parseLineNum( 0 ), _next( 0 ), _memPool( 0 ) {}
1226 virtual ~XMLAttribute() {}
1228 XMLAttribute(
const XMLAttribute& );
1229 void operator=(
const XMLAttribute& );
1230 void SetName(
const char*
name );
1232 char* ParseDeep(
char* p,
bool processEntities,
int* curLineNumPtr );
1234 mutable StrPair _name;
1235 mutable StrPair _value;
1237 XMLAttribute* _next;
1248 friend class XMLDocument;
1255 void SetName(
const char* str,
bool staticMem=
false ) {
1256 SetValue( str, staticMem );
1265 virtual bool Accept(
XMLVisitor* visitor )
const;
1290 const char* Attribute(
const char*
name,
const char* value=0 )
const;
1298 int IntAttribute(
const char*
name,
int defaultValue = 0)
const;
1300 unsigned UnsignedAttribute(
const char*
name,
unsigned defaultValue = 0)
const;
1302 int64_t Int64Attribute(
const char*
name, int64_t defaultValue = 0)
const;
1304 bool BoolAttribute(
const char*
name,
bool defaultValue =
false)
const;
1306 double DoubleAttribute(
const char*
name,
double defaultValue = 0)
const;
1308 float FloatAttribute(
const char*
name,
float defaultValue = 0)
const;
1380 *value = a->
Value();
1404 return QueryIntAttribute(
name, value );
1408 return QueryUnsignedAttribute(
name, value );
1412 return QueryInt64Attribute(
name, value);
1416 return QueryBoolAttribute(
name, value );
1420 return QueryDoubleAttribute(
name, value );
1424 return QueryFloatAttribute(
name, value );
1468 void DeleteAttribute(
const char*
name );
1472 return _rootAttribute;
1505 const char* GetText()
const;
1541 void SetText(
const char* inText );
1543 void SetText(
int value );
1545 void SetText(
unsigned value );
1547 void SetText(int64_t value);
1549 void SetText(
bool value );
1551 void SetText(
double value );
1553 void SetText(
float value );
1581 XMLError QueryIntText(
int* ival )
const;
1583 XMLError QueryUnsignedText(
unsigned* uval )
const;
1585 XMLError QueryInt64Text(int64_t* uval)
const;
1587 XMLError QueryBoolText(
bool* bval )
const;
1589 XMLError QueryDoubleText(
double* dval )
const;
1591 XMLError QueryFloatText(
float* fval )
const;
1593 int IntText(
int defaultValue = 0)
const;
1596 unsigned UnsignedText(
unsigned defaultValue = 0)
const;
1598 int64_t Int64Text(int64_t defaultValue = 0)
const;
1600 bool BoolText(
bool defaultValue =
false)
const;
1602 double DoubleText(
double defaultValue = 0)
const;
1604 float FloatText(
float defaultValue = 0)
const;
1613 return _closingType;
1616 virtual bool ShallowEqual(
const XMLNode* compare )
const;
1619 char* ParseDeep(
char* p,
StrPair* parentEndTag,
int* curLineNumPtr );
1628 char* ParseAttributes(
char* p,
int* curLineNumPtr );
1629 static void DeleteAttribute(
XMLAttribute* attribute );
1632 enum { BUF_SIZE = 200 };
1633 ElementClosingType _closingType;
1637 XMLAttribute* _rootAttribute;
1654 friend class XMLElement;
1657 friend class XMLNode;
1658 friend class XMLText;
1659 friend class XMLComment;
1660 friend class XMLDeclaration;
1661 friend class XMLUnknown;
1686 XMLError Parse(
const char* xml,
size_t nBytes=(
size_t)(-1) );
1693 XMLError LoadFile(
const char* filename );
1713 XMLError SaveFile(
const char* filename,
bool compact =
false );
1722 XMLError SaveFile( FILE* fp,
bool compact =
false );
1725 return _processEntities;
1728 return _whitespaceMode;
1747 return FirstChildElement();
1750 return FirstChildElement();
1768 virtual bool Accept(
XMLVisitor* visitor )
const;
1781 XMLComment* NewComment(
const char* comment );
1787 XMLText* NewText(
const char* text );
1811 void DeleteNode(
XMLNode* node );
1825 const char* ErrorName()
const;
1826 static const char* ErrorIDToName(
XMLError errorID);
1831 const char* ErrorStr()
const;
1834 void PrintError()
const;
1839 return _errorLineNum;
1855 char* Identify(
char* p,
XMLNode** node );
1872 bool _processEntities;
1878 int _parseCurLineNum;
1897 void SetError(
XMLError error,
int lineNum,
const char* format, ... );
1902 class DepthTracker {
1905 this->_document = document;
1906 document->PushDepth();
1909 _document->PopDepth();
1912 XMLDocument * _document;
1917 template<
class NodeType,
int PoolElementSize>
1918 NodeType* CreateUnlinkedNode( MemPoolT<PoolElementSize>& pool );
1921 template<
class NodeType,
int PoolElementSize>
1922 inline NodeType* XMLDocument::CreateUnlinkedNode( MemPoolT<PoolElementSize>& pool )
1924 TIXMLASSERT(
sizeof( NodeType ) == PoolElementSize );
1925 TIXMLASSERT(
sizeof( NodeType ) == pool.ItemSize() );
1926 NodeType* returnNode =
new (pool.Alloc()) NodeType(
this );
1928 returnNode->_memPool = &pool;
1930 _unlinked.Push(returnNode);
2009 return XMLHandle( _node ? _node->FirstChild() : 0 );
2013 return XMLHandle( _node ? _node->FirstChildElement(
name ) : 0 );
2017 return XMLHandle( _node ? _node->LastChild() : 0 );
2021 return XMLHandle( _node ? _node->LastChildElement(
name ) : 0 );
2025 return XMLHandle( _node ? _node->PreviousSibling() : 0 );
2029 return XMLHandle( _node ? _node->PreviousSiblingElement(
name ) : 0 );
2033 return XMLHandle( _node ? _node->NextSibling() : 0 );
2037 return XMLHandle( _node ? _node->NextSiblingElement(
name ) : 0 );
2046 return ( _node ? _node->ToElement() : 0 );
2050 return ( _node ? _node->ToText() : 0 );
2054 return ( _node ? _node->ToUnknown() : 0 );
2058 return ( _node ? _node->ToDeclaration() : 0 );
2115 return ( _node ? _node->ToElement() : 0 );
2118 return ( _node ? _node->ToText() : 0 );
2121 return ( _node ? _node->ToUnknown() : 0 );
2124 return ( _node ? _node->ToDeclaration() : 0 );
2183 XMLPrinter( FILE* file=0,
bool compact =
false,
int depth = 0 );
2187 void PushHeader(
bool writeBOM,
bool writeDeclaration );
2191 void OpenElement(
const char*
name,
bool compactMode=
false );
2193 void PushAttribute(
const char*
name,
const char* value );
2194 void PushAttribute(
const char*
name,
int value );
2195 void PushAttribute(
const char*
name,
unsigned value );
2196 void PushAttribute(
const char*
name, int64_t value);
2197 void PushAttribute(
const char*
name,
bool value );
2198 void PushAttribute(
const char*
name,
double value );
2200 virtual void CloseElement(
bool compactMode=
false );
2203 void PushText(
const char* text,
bool cdata=
false );
2205 void PushText(
int value );
2207 void PushText(
unsigned value );
2209 void PushText(int64_t value);
2211 void PushText(
bool value );
2213 void PushText(
float value );
2215 void PushText(
double value );
2218 void PushComment(
const char* comment );
2220 void PushDeclaration(
const char* value );
2221 void PushUnknown(
const char* value );
2229 virtual bool VisitExit(
const XMLElement& element );
2231 virtual bool Visit(
const XMLText& text );
2232 virtual bool Visit(
const XMLComment& comment );
2234 virtual bool Visit(
const XMLUnknown& unknown );
2241 return _buffer.Mem();
2249 return _buffer.Size();
2258 _firstElement =
true;
2267 virtual void PrintSpace(
int depth );
2268 void Print(
const char* format, ... );
2269 void Write(
const char* data,
size_t size );
2270 inline void Write(
const char* data ) {
Write( data, strlen( data ) ); }
2271 void Putc(
char ch );
2273 void SealElementIfJustOpened();
2274 bool _elementJustOpened;
2278 void PrintString(
const char*,
bool restrictedEntitySet );
2284 bool _processEntities;
2291 bool _entityFlag[ENTITY_RANGE];
2292 bool _restrictedEntityFlag[ENTITY_RANGE];
2297 XMLPrinter(
const XMLPrinter& );
2298 XMLPrinter& operator=(
const XMLPrinter& );
2304 #if defined(_MSC_VER) 2305 # pragma warning(pop) 2308 #endif // TINYXML2_INCLUDED
XMLError QueryInt64Attribute(const char *name, int64_t *value) const
See QueryIntAttribute()
XMLError QueryIntValue(int *value) const
const XMLNode * ToNode() const
XMLError QueryBoolAttribute(const char *name, bool *value) const
See QueryIntAttribute()
virtual bool VisitExit(const XMLDocument &)
Visit a document.
virtual XMLNode * ShallowClone(XMLDocument *) const
const XMLDeclaration * ToDeclaration() const
static bool IsUTF8Continuation(char p)
void SetInternedStr(const char *str)
virtual bool ShallowEqual(const XMLNode *) const
XMLHandle FirstChildElement(const char *name=0)
Get the first child element of this handle.
virtual const XMLComment * ToComment() const
const XMLConstHandle LastChild() const
XMLText * ToText()
Safe cast to XMLText. This can return null.
XMLError QueryFloatValue(float *value) const
See QueryIntValue.
XMLText(XMLDocument *doc)
const char * CStr() const
const XMLElement * ToElement() const
XMLError ErrorID() const
Return the errorID.
virtual const XMLDeclaration * ToDeclaration() const
XMLElement * PreviousSiblingElement(const char *name=0)
virtual void Free(void *)=0
XMLElement * ToElement()
Safe cast to XMLElement. This can return null.
virtual bool CompactMode(const XMLElement &)
virtual XMLElement * ToElement()
Safely cast to an Element, or null.
XMLError QueryStringAttribute(const char *name, const char **value) const
See QueryIntAttribute()
virtual XMLText * ToText()
Safely cast to Text, or null.
virtual const XMLDocument * ToDocument() const
Whitespace WhitespaceMode() const
virtual const XMLElement * ToElement() const
static const char * SkipWhiteSpace(const char *p, int *curLineNumPtr)
XMLError QueryUnsignedAttribute(const char *name, unsigned int *value) const
See QueryIntAttribute()
XMLNode * LinkEndChild(XMLNode *addThis)
virtual const XMLUnknown * ToUnknown() const
float FloatValue() const
Query as a float. See IntValue()
virtual XMLDocument * ToDocument()
Safely cast to a Document, or null.
XMLUnknown * ToUnknown()
Safe cast to XMLUnknown. This can return null.
const char * Name() const
Get the name of an element (which is the Value() of the node.)
ElementClosingType ClosingType() const
XMLHandle(const XMLHandle &ref)
Copy constructor.
XMLHandle FirstChild()
Get the first child of this handle.
void SetCData(bool isCData)
Declare whether this should be CDATA or standard text.
void SetUserData(void *userData)
const XMLNode * NextSibling() const
Get the next (right) sibling node of this node.
unsigned UnsignedValue() const
Query as an unsigned integer. See IntValue()
XMLHandle LastChildElement(const char *name=0)
Get the last child element of this handle.
static char * SkipWhiteSpace(char *p, int *curLineNumPtr)
const XMLConstHandle PreviousSibling() const
XMLHandle LastChild()
Get the last child of this handle.
static bool StringEqual(const char *p, const char *q, int nChar=INT_MAX)
XMLElement * RootElement()
virtual const XMLDeclaration * ToDeclaration() const
virtual void SetTracked()=0
virtual XMLText * ToText()
Safely cast to Text, or null.
XMLHandle(XMLNode &node)
Create a handle from a node.
void SetName(const char *str, bool staticMem=false)
Set the name of the element.
XMLHandle(XMLNode *node)
Create a handle from any node (at any depth of the tree.) This can be a null pointer.
void Trace(const char *name)
void Write(const char *data)
const XMLConstHandle NextSiblingElement(const char *name=0) const
virtual XMLElement * ToElement()
Safely cast to an Element, or null.
static bool IsNameChar(unsigned char ch)
XMLError QueryFloatAttribute(const char *name, float *value) const
See QueryIntAttribute()
XMLError QueryUnsignedValue(unsigned int *value) const
See QueryIntValue.
XMLNode * ToNode()
Safe cast to XMLNode. This can return null.
bool BoolValue() const
Query as a boolean. See IntValue()
virtual int ItemSize() const =0
const XMLNode * FirstChild() const
Get the first child node, or null if none exists.
const XMLConstHandle FirstChild() const
const XMLConstHandle PreviousSiblingElement(const char *name=0) const
const XMLConstHandle NextSibling() const
virtual XMLDeclaration * ToDeclaration()
Safely cast to a Declaration, or null.
virtual bool Visit(const XMLDeclaration &)
Visit a declaration.
virtual bool Visit(const XMLUnknown &)
Visit an unknown node.
void SetAttribute(const char *name, unsigned value)
Sets the named attribute to value.
XMLError QueryDoubleAttribute(const char *name, double *value) const
See QueryIntAttribute()
XMLError QueryInt64Value(int64_t *value) const
See QueryIntValue.
XMLHandle NextSibling()
Get the next sibling of this handle.
virtual int ItemSize() const
int GetLineNum() const
Gets the line number the attribute is in, if the document was parsed from a file. ...
void Set(char *start, char *end, int flags)
virtual XMLUnknown * ToUnknown()
Safely cast to an Unknown, or null.
bool CData() const
Returns true if this is a CDATA text element.
int64_t Int64Value() const
XMLHandle PreviousSibling()
Get the previous sibling of this handle.
const T & operator[](int i) const
XMLHandle & operator=(const XMLHandle &ref)
Assignment.
virtual const XMLUnknown * ToUnknown() const
XMLConstHandle(const XMLNode &node)
virtual bool VisitExit(const XMLDocument &)
Visit a document.
char * ParseName(char *in)
const T & PeekTop() const
virtual bool VisitEnter(const XMLElement &, const XMLAttribute *)
Visit an element.
bool Error() const
Return true if there was an error parsing the document.
const XMLConstHandle LastChildElement(const char *name=0) const
const XMLText * ToText() const
virtual bool VisitEnter(const XMLDocument &)
Visit a document.
virtual XMLDocument * ToDocument()
Safely cast to a Document, or null.
const XMLNode * LastChild() const
Get the last child node, or null if none exists.
XMLElement * LastChildElement(const char *name=0)
XMLError QueryAttribute(const char *name, int *value) const
void SetAttribute(const char *name, bool value)
Sets the named attribute to value.
virtual const XMLElement * ToElement() const
XMLDeclaration * ToDeclaration()
Safe cast to XMLDeclaration. This can return null.
const XMLElement * RootElement() const
void SetAttribute(const char *value)
Set the attribute to a string value.
void SetAttribute(const char *name, const char *value)
Sets the named attribute to value.
static bool IsWhiteSpace(char p)
virtual bool VisitExit(const XMLElement &)
Visit an element.
virtual const XMLText * ToText() const
void * GetUserData() const
virtual void Free(void *mem)
void SetAttribute(const char *name, int64_t value)
Sets the named attribute to value.
void SetAttribute(const char *name, double value)
Sets the named attribute to value.
XMLError QueryDoubleValue(double *value) const
See QueryIntValue.
void TransferTo(StrPair *other)
virtual const XMLDocument * ToDocument() const
const XMLNode * Parent() const
Get the parent of this node on the DOM.
virtual bool Visit(const XMLComment &)
Visit a comment node.
static bool IsNameStartChar(unsigned char ch)
XMLError QueryBoolValue(bool *value) const
See QueryIntValue.
const XMLNode * PreviousSibling() const
Get the previous (left) sibling node of this node.
XMLHandle NextSiblingElement(const char *name=0)
Get the next sibling element of this handle.
XMLConstHandle(const XMLConstHandle &ref)
XMLElement * NextSiblingElement(const char *name=0)
const char * Value() const
The value of the attribute.
XMLElement * FirstChildElement(const char *name=0)
XMLConstHandle(const XMLNode *node)
XMLError QueryIntAttribute(const char *name, int *value) const
char * ParseText(char *in, const char *endTag, int strFlags, int *curLineNumPtr)
const XMLUnknown * ToUnknown() const
int GetLineNum() const
Gets the line number the node is in, if the document was parsed from a file.
XMLError QueryAttribute(const char *name, double *value) const
virtual bool Visit(const XMLText &)
Visit a text node.
XMLError QueryAttribute(const char *name, float *value) const
int ErrorLineNum() const
Return the line where the error occured, or zero if unknown.
XMLDocument * GetDocument()
Get the XMLDocument that owns this XMLNode.
virtual XMLUnknown * ToUnknown()
Safely cast to an Unknown, or null.
XMLConstHandle & operator=(const XMLConstHandle &ref)
void SetAttribute(const char *name, float value)
Sets the named attribute to value.
const XMLAttribute * Next() const
The next attribute in the list.
const XMLConstHandle FirstChildElement(const char *name=0) const
bool NoChildren() const
Returns true if this node has no children.
int CurrentAllocs() const
double DoubleValue() const
Query as a double. See IntValue()
XMLError QueryAttribute(const char *name, unsigned int *value) const
virtual XMLDeclaration * ToDeclaration()
Safely cast to a Declaration, or null.
const XMLDocument * GetDocument() const
Get the XMLDocument that owns this XMLNode.
bool ProcessEntities() const
void SetStr(const char *str, int flags=0)
XMLError QueryAttribute(const char *name, int64_t *value) const
XMLHandle PreviousSiblingElement(const char *name=0)
Get the previous sibling element of this handle.
XMLNode * PreviousSibling()
void SetAttribute(const char *name, int value)
Sets the named attribute to value.
const XMLAttribute * FirstAttribute() const
Return the first attribute in the list.
virtual XMLComment * ToComment()
Safely cast to a Comment, or null.
XMLError QueryAttribute(const char *name, bool *value) const
virtual const XMLText * ToText() const