26 #ifndef TINYXML_INCLUDED 27 #define TINYXML_INCLUDED 29 #define TIXML_USE_TICPP 33 #pragma warning(disable : 4530
) 34 #pragma warning(disable : 4786
) 46 #if defined(_DEBUG) && !defined(DEBUG) 60 #define TIXML_STRING std::string 63 #define TIXML_STRING TiXmlString 73 #if defined(_MSC_VER) && (_MSC_VER >= 1400
) 75 #define TIXML_SNPRINTF _snprintf_s 76 #define TIXML_SNSCANF _snscanf_s 77 #define TIXML_SSCANF sscanf_s 78 #elif defined(_MSC_VER) && (_MSC_VER >= 1200
) 81 #define TIXML_SNPRINTF _snprintf 82 #define TIXML_SNSCANF _snscanf 83 #define TIXML_SSCANF sscanf 84 #elif defined( __GNUC__
) && ( __GNUC__
>= 3
) 87 #define TIXML_SNPRINTF snprintf 88 #define TIXML_SNSCANF snscanf 89 #define TIXML_SSCANF sscanf 91 #define TIXML_SSCANF sscanf 234 virtual void Print(FILE* cfile,
int depth)
const = 0;
329 return (std::isspace((
unsigned char)c) || c ==
'\n' || c ==
'\r');
356 bool ignoreWhiteSpace,
367 inline static const char*
373 assert(*length >= 0 && *length < 5);
383 }
else if (*length) {
387 for (
int i = 0; p[i] && i < *length; ++i) {
391 return p + (*length);
421 if (v < 128)
return std::tolower(v);
425 return std::tolower(v);
517 const char*
Value()
const {
return value.c_str(); }
538 void SetValue(
const char* _value) { value = _value; }
588 return FirstChild(_value.c_str());
591 return FirstChild(_value.c_str());
594 return LastChild(_value.c_str());
597 return LastChild(_value.c_str());
635 return IterateChildren(_value.c_str(), previous);
639 return IterateChildren(_value.c_str(), previous);
690 return PreviousSibling(_value.c_str());
693 return PreviousSibling(_value.c_str());
696 return NextSibling(_value.c_str());
699 return NextSibling(_value.c_str());
736 return NextSiblingElement(_value.c_str());
739 return NextSiblingElement(_value.c_str());
759 return FirstChildElement(_value.c_str());
762 return FirstChildElement(_value.c_str());
777 return const_cast< TiXmlDocument* >(
778 (
const_cast<
const TiXmlNode* >(
this))->GetDocument());
948 return value.c_str();
979 void SetValue(
const char* _value) { value = _value; }
1055 return (sentinel.next == &sentinel) ? 0 : sentinel.next;
1058 return (sentinel.next == &sentinel) ? 0 : sentinel.next;
1061 return (sentinel.prev == &sentinel) ? 0 : sentinel.prev;
1064 return (sentinel.prev == &sentinel) ? 0 : sentinel.prev;
1114 const char*
Attribute(
const char* name)
const;
1122 const char*
Attribute(
const char* name,
int* i)
const;
1130 const char*
Attribute(
const char* name,
double* d)
const;
1163 template <
typename T >
1170 sstream >> *outValue;
1203 void SetAttribute(
const char* name,
const char* _value);
1206 const std::string*
Attribute(
const std::string& name)
const;
1207 const std::string*
Attribute(
const std::string& name,
int* i)
const;
1208 const std::string*
Attribute(
const std::string& name,
double* d)
const;
1213 void SetAttribute(
const std::string& name,
const std::string& _value);
1215 void SetAttribute(
const std::string& name,
int _value);
1233 RemoveAttribute(name.c_str());
1238 return attributeSet.First();
1242 return attributeSet.Last();
1288 virtual void Print(FILE* cfile,
int depth)
const;
1348 virtual void Print(FILE* cfile,
int depth)
const;
1396 SetValue(initValue);
1405 SetValue(initValue);
1417 virtual void Print(FILE* cfile,
int depth)
const;
1478 const std::string& _encoding,
1479 const std::string& _standalone);
1484 const char* _encoding,
1485 const char* _standalone);
1493 const char*
Version()
const {
return version.c_str(); }
1495 const char*
Encoding()
const {
return encoding.c_str(); }
1563 const char*
Type()
const {
return type.c_str(); }
1565 const char*
Href()
const {
return href.c_str(); }
1623 virtual void Print(FILE* cfile,
int depth)
const;
1682 bool LoadFile(
const char* filename,
1685 bool SaveFile(
const char* filename)
const;
1704 return LoadFile(filename.c_str(), encoding);
1709 return SaveFile(filename.c_str());
1721 virtual const char*
Parse(
const char* p,
1820 virtual void Print(FILE* cfile,
int depth = 0)
const;
1823 const char* errorLocation,
1996 return FirstChild(_value.c_str());
1999 return FirstChildElement(_value.c_str());
2003 return Child(_value.c_str(), index);
2006 return ChildElement(_value.c_str(), index);
2095 void SetIndent(
const char* _indent) { indent = _indent ? _indent :
""; }
2097 const char*
Indent() {
return indent.c_str(); }
2103 lineBreak = _lineBreak ? _lineBreak :
"";
2117 const char*
CStr() {
return buffer.c_str(); }
2119 size_t
Size() {
return buffer.size(); }
2128 for (
int i = 0; i <
depth; ++i)
2141 #pragma warning(pop)
static const int utf8ByteTable[256]
virtual void StreamIn(std::istream *in, TIXML_STRING *tag)
TiXmlStylesheetReference(const std::string &_type, const std::string &_href)
Constructor.
virtual const char * Parse(const char *p, TiXmlParsingData *data, TiXmlEncoding encoding)
int QueryIntValue(int *_value) const
QueryIntValue examines the value string.
int ErrorCol() const
The column where the error occured. See ErrorRow()
TiXmlNode * FirstChild(const char *_value)
virtual bool VisitExit(const TiXmlElement &element)
Visit an element.
TiXmlNode * LastChild(const char *_value)
The last child of this node matching 'value'. Will be null if there are no children.
bool SaveFile(FILE *) const
Save a file using the given FILE*. Returns true if successful.
An attribute is a name-value pair.
TiXmlHandle(TiXmlNode *_node)
Create a handle from any node (at any depth of the tree.) This can be a null pointer.
TiXmlNode * FirstChild(const std::string &_value)
STL std::string form.
void Print(FILE *cfile, int depth, TIXML_STRING *str) const
void SetUserData(void *user)
Set a pointer to arbitrary user data.
TiXmlDocument(const char *documentName)
Create a document with a name. The name of the document is also the filename of the xml...
If you call the Accept() method, it requires being passed a TiXmlVisitor class to handle callbacks...
TiXmlDeclaration(const std::string &_version, const std::string &_encoding, const std::string &_standalone)
Constructor.
virtual const TiXmlElement * ToElement() const
Cast to a more defined type. Will return null not of the requested type.
TiXmlDeclaration(const TiXmlDeclaration ©)
TiXmlUnknown(const TiXmlUnknown ©)
virtual const char * Parse(const char *p, TiXmlParsingData *data, TiXmlEncoding encoding)
virtual ~TiXmlStylesheetReference()
const char * Type() const
Type. Will return an empty string if none was found.
void SetLineBreak(const char *_lineBreak)
Set the line breaking string.
TiXmlElement * NextSiblingElement()
TiXmlHandle(const TiXmlHandle &ref)
Copy constructor.
void operator=(const TiXmlNode &base)
TiXmlNode * PreviousSibling(const char *_prev)
TiXmlNode * LastChild()
The last child of this node. Will be null if there are no children.
const char * LineBreak()
Query the current line breaking string.
const TiXmlNode * LastChild() const
virtual void Print(FILE *cfile, int depth) const
All TinyXml classes can print themselves to a filestream or the string class (TiXmlString in non-STL ...
virtual TiXmlElement * ToElement()
Cast to a more defined type. Will return null if not of the requested type.
virtual bool Visit(const TiXmlUnknown &)
Visit an unknow node.
void SetAttribute(const std::string &name, const std::string &_value)
STL std::string form.
bool operator==(const TiXmlAttribute &rhs) const
TiXmlAttribute(const char *_name, const char *_value)
Construct an attribute with a name and value.
virtual const TiXmlDocument * ToDocument() const
Cast to a more defined type. Will return null not of the requested type.
virtual void StreamIn(std::istream *in, TIXML_STRING *tag)=0
const char * Name() const
Return the name of this attribute.
const char * ErrorDesc() const
Contains a textual (english) description of the error if one occurs.
virtual void StreamIn(std::istream *in, TIXML_STRING *tag)
virtual const char * Parse(const char *p, TiXmlParsingData *data, TiXmlEncoding encoding)
const TiXmlNode * PreviousSibling(const char *) const
Navigate to a sibling node.
bool operator<(const TiXmlAttribute &rhs) const
void Print() const
Write the document to standard out using formatted printing ("pretty print").
static int ToLower(int v, TiXmlEncoding encoding)
virtual void Print(FILE *cfile, int depth, TIXML_STRING *str) const
int QueryDoubleAttribute(const char *name, double *_value) const
QueryDoubleAttribute examines the attribute - see QueryIntAttribute().
TiXmlNode * IterateChildren(const std::string &_value, const TiXmlNode *previous)
STL std::string form.
TiXmlElement * Element() const
TiXmlNode * IterateChildren(const char *_value, const TiXmlNode *previous)
int QueryDoubleValue(double *_value) const
QueryDoubleValue examines the value string. See QueryIntValue().
static int IsAlphaNum(unsigned char anyByte, TiXmlEncoding encoding)
const TiXmlNode * IterateChildren(const std::string &_value, const TiXmlNode *previous) const
STL std::string form.
void SetDoubleAttribute(const char *name, double value)
Sets an attribute of name to a given value.
virtual const TiXmlElement * ToElement() const
Cast to a more defined type. Will return null if not of the requested type.
void CopyTo(TiXmlDocument *target) const
void operator=(const TiXmlUnknown ©)
TiXmlAttributeSet(const TiXmlAttributeSet &)
TiXmlHandle FirstChildElement(const std::string &_value) const
std::string & operator<<(std::string &out, const TiXmlNode &base)
TiXmlHandle ChildElement(const char *value, int index) const
Return a handle to the "index" child element with the given name.
virtual void Print(FILE *cfile, int depth=0) const
Print this Document to a FILE stream.
const char * GetText() const
Convenience function for easy access to the text inside an element.
virtual bool Accept(TiXmlVisitor *content) const
Walk the XML tree visiting this node and all of its children.
virtual const TiXmlText * ToText() const
Cast to a more defined type. Will return null if not of the requested type.
TiXmlElement * NextSiblingElement(const std::string &_value)
STL std::string form.
TiXmlAttribute * FirstAttribute()
bool Error() const
If an error occurs, Error will be set to true.
void operator=(const TiXmlDeclaration ©)
int Column() const
See Row()
void operator=(const TiXmlAttributeSet &)
TiXmlElement * FirstChildElement(const char *_value)
void operator=(const TiXmlDocument ©)
void SetValue(const std::string &_value)
STL std::string form.
TiXmlHandle FirstChildElement(const char *value) const
Return a handle to the first child element with the given name.
static const char * ReadName(const char *p, TIXML_STRING *name, TiXmlEncoding encoding)
virtual void StreamIn(std::istream *in, TIXML_STRING *tag)
TiXmlHandle Child(int index) const
Return a handle to the "index" child.
virtual TiXmlNode * Clone() const
Creates a copy of this Unknown and returns it.
TiXmlNode * ReplaceChild(TiXmlNode *replaceThis, const TiXmlNode &withThis)
Replace a child of this node.
void SetName(const std::string &_name)
STL std::string form.
const std::string & ValueStr() const
Return Value() as a std::string.
virtual bool VisitExit(const TiXmlElement &)
Visit an element.
bool CDATA() const
Queries whether this represents text using a CDATA section.
friend class TiXmlDocument
void SetName(const char *_name)
Set the name of this attribute.
TiXmlNode * NextSibling()
void SetTabSize(int _tabsize)
SetTabSize() allows the error reporting functions (ErrorRow() and ErrorCol()) to report the correct v...
TiXmlDocument()
Create an empty document, that has no name.
TiXmlAttribute()
Construct an empty attribute.
const int TIXML_PATCH_VERSION
virtual bool Accept(TiXmlVisitor *visitor) const
Walk the XML tree visiting this node and all of its children.
const char * Standalone() const
Is this a standalone document?
void CopyTo(TiXmlElement *target) const
TiXmlElement * NextSiblingElement(const char *_next)
const TIXML_STRING & NameTStr() const
TiXmlElement * FirstChildElement()
virtual TiXmlDocument * ToDocument()
Cast to a more defined type. Will return null if not of the requested type.
void ClearError()
If you have handled the error, it can be reset with this call.
virtual TiXmlStylesheetReference * ToStylesheetReference()
Cast to a more defined type. Will return null not of the requested type.
void SetAttribute(const char *name, int value)
Sets an attribute of name to a given value.
void CopyTo(TiXmlUnknown *target) const
const TiXmlElement * NextSiblingElement(const std::string &_value) const
STL std::string form.
virtual void Print(FILE *cfile, int depth) const
All TinyXml classes can print themselves to a filestream or the string class (TiXmlString in non-STL ...
TiXmlDocument(const TiXmlDocument ©)
const char * Href() const
Href. Will return an empty string if none was found.
bool LoadFile(TiXmlEncoding encoding=TIXML_DEFAULT_ENCODING)
Load a file using the current document value.
static const char * errorString[TIXML_ERROR_STRING_COUNT]
void SetValue(const char *_value)
Changes the value of the node.
TiXmlNode * InsertEndChild(const TiXmlNode &addThis)
Add a new node related to this.
virtual bool VisitExit(const TiXmlDocument &doc)
Visit a document.
static void ConvertUTF32ToUTF8(unsigned long input, char *output, int *length)
TiXmlNode * ToNode() const
Return the handle as a TiXmlNode.
virtual TiXmlElement * ToElement()
Cast to a more defined type. Will return null not of the requested type.
const TiXmlNode * NextSibling(const char *) const
Navigate to a sibling node with the given 'value'.
const TIXML_STRING & ValueTStr() const
TiXmlNode * InsertBeforeChild(TiXmlNode *beforeThis, const TiXmlNode &addThis)
Add a new node related to this.
void CopyTo(TiXmlDeclaration *target) const
static bool condenseWhiteSpace
bool LoadFile(const char *filename, TiXmlEncoding encoding=TIXML_DEFAULT_ENCODING)
Load a file using the given filename. Returns true if successful.
const TiXmlElement * NextSiblingElement(const char *) const
Convenience function to get through elements.
TiXmlNode(const TiXmlNode &)
const std::string & ValueStr() const
Return the value of this attribute.
TiXmlNode * PreviousSibling()
NodeType
The types of XML nodes supported by TinyXml.
TiXmlAttribute * Find(const char *_name)
virtual bool VisitEnter(const TiXmlDocument &)
Visit a document.
virtual TiXmlStylesheetReference * ToStylesheetReference()
Cast to a more defined type. Will return null if not of the requested type.
TiXmlNode * LinkEndChild(TiXmlNode *addThis)
Add a new node related to this.
bool SaveFile() const
Save a file using the current document value. Returns true if successful.
const TiXmlElement * RootElement() const
Get the root element – the only top level element – of the document.
TiXmlHandle Child(const char *value, int index) const
Return a handle to the "index" child with the given name.
const TiXmlElement * FirstChildElement() const
Convenience function to get through elements.
const TiXmlNode * PreviousSibling(const std::string &_value) const
STL std::string form.
void SetDoubleValue(double _value)
Set the value from a double.
const char * Encoding() const
Encoding. Will return an empty string if none was found.
void * userData
Field containing a generic user pointer.
A stylesheet reference looks like this:
virtual bool Accept(TiXmlVisitor *visitor) const =0
Accept a hierchical visit the nodes in the TinyXML DOM.
TiXmlDocument * GetDocument()
const TiXmlNode * IterateChildren(const char *value, const TiXmlNode *previous) const
This flavor of IterateChildren searches for children with a particular 'value'.
In correct XML the declaration is the first entry in the file.
const TiXmlNode * PreviousSibling() const
Navigate to a sibling node.
virtual const TiXmlDocument * ToDocument() const
Cast to a more defined type. Will return null if not of the requested type.
const char * Value() const
Return the value of this attribute.
static bool IsWhiteSpace(char c)
std::istream & operator>>(std::istream &in, TiXmlNode &base)
TiXmlAttributeSet attributeSet
Any tag that tinyXml doesn't recognize is saved as an unknown.
int QueryIntAttribute(const char *name, int *_value) const
QueryIntAttribute examines the attribute - it is an alternative to the Attribute() method with richer...
virtual bool Visit(const TiXmlText &)
Visit a text node.
void SetValue(const std::string &_value)
STL std::string form.
virtual const TiXmlText * ToText() const
Cast to a more defined type. Will return null not of the requested type.
const TiXmlEncoding TIXML_DEFAULT_ENCODING
int IntValue() const
Return the value of this attribute, converted to an integer.
virtual const TiXmlComment * ToComment() const
Cast to a more defined type. Will return null if not of the requested type.
TiXmlNode * NextSibling(const char *_next)
TiXmlStylesheetReference()
Construct an empty declaration.
const char * Version() const
Version. Will return an empty string if none was found.
void CopyTo(TiXmlStylesheetReference *target) const
virtual TiXmlNode * Clone() const
Creates a copy of this Declaration and returns it.
virtual TiXmlNode * Clone() const
[internal use] Creates a new Element and returns it.
static bool IsWhiteSpaceCondensed()
Return the current white space setting.
TiXmlText(const TiXmlText ©)
static const char * ReadText(const char *in, TIXML_STRING *text, bool ignoreWhiteSpace, const char *endTag, bool ignoreCase, TiXmlEncoding encoding)
const char * Value() const
The meaning of 'value' changes for the specific type of TiXmlNode.
const int TIXML_MAJOR_VERSION
const TiXmlNode * LastChild(const std::string &_value) const
STL std::string form.
void SetIndent(const char *_indent)
Set the indent characters for printing.
const TiXmlAttribute * LastAttribute() const
Access the last attribute in this element.
int QueryValueAttribute(const std::string &name, T *outValue) const
Template form of the attribute query which will try to read the attribute into the specified type...
void CopyTo(TiXmlText *target) const
bool LoadFile(const std::string &filename, TiXmlEncoding encoding=TIXML_DEFAULT_ENCODING)
virtual TiXmlDocument * ToDocument()
Cast to a more defined type. Will return null not of the requested type.
const TiXmlAttribute * Find(const std::string &_name) const
void RemoveAttribute(const char *name)
Deletes an attribute with the given name.
void SetAttribute(const char *name, const char *_value)
Sets an attribute of name to a given value.
virtual const char * Parse(const char *p, TiXmlParsingData *data, TiXmlEncoding encoding)
void SetCDATA(bool _cdata)
Turns on or off a CDATA representation of text.
const char * Indent()
Query the indention string.
TiXmlAttribute(const TiXmlAttribute &)
virtual void Print(FILE *cfile, int depth) const
All TinyXml classes can print themselves to a filestream or the string class (TiXmlString in non-STL ...
double DoubleValue() const
Return the value of this attribute, converted to a double.
virtual bool Visit(const TiXmlStylesheetReference &)
Visit a stylesheet reference.
friend class TiXmlElement
TiXmlElement * FirstChildElement(const std::string &_value)
STL std::string form.
virtual bool VisitEnter(const TiXmlElement &element, const TiXmlAttribute *firstAttribute)
Visit an element.
virtual TiXmlDeclaration * ToDeclaration()
Cast to a more defined type. Will return null not of the requested type.
const TiXmlElement * NextSiblingElement() const
Convenience function to get through elements.
Always the top level node.
TiXmlHandle FirstChild() const
Return a handle to the first child node.
const TiXmlAttribute * Last() const
virtual const char * Parse(const char *p, TiXmlParsingData *data, TiXmlEncoding encoding)=0
virtual void Print(FILE *cfile, int depth) const
All TinyXml classes can print themselves to a filestream or the string class (TiXmlString in non-STL ...
virtual const char * Parse(const char *p, TiXmlParsingData *data, TiXmlEncoding encoding)
TiXmlElement(const char *in_value)
Construct an element.
const std::string * Attribute(const std::string &name, int *i) const
TiXmlElement * ToElement() const
Return the handle as a TiXmlElement.
const char * Attribute(const char *name, double *d) const
Given an attribute name, Attribute() returns the value for the attribute of that name, or null if none exists.
void operator=(const TiXmlStylesheetReference ©)
virtual bool Visit(const TiXmlText &text)
Visit a text node.
static Entity entity[NUM_ENTITY]
static const char * SkipWhiteSpace(const char *, TiXmlEncoding encoding)
TiXmlNode * Identify(const char *start, TiXmlEncoding encoding)
TiXmlNode * InsertAfterChild(TiXmlNode *afterThis, const TiXmlNode &addThis)
Add a new node related to this.
virtual void StreamIn(std::istream *in, TIXML_STRING *tag)
int ErrorRow() const
Returns the location (if known) of the error.
void operator=(const TiXmlAttribute &base)
TiXmlUnknown * Unknown() const
static bool StreamTo(std::istream *in, int character, TIXML_STRING *tag)
virtual TiXmlDeclaration * ToDeclaration()
Cast to a more defined type. Will return null if not of the requested type.
TiXmlHandle FirstChild(const char *value) const
Return a handle to the first child node with the given name.
const char * ReadValue(const char *in, TiXmlParsingData *prevData, TiXmlEncoding encoding)
void CopyTo(TiXmlNode *target) const
int Row() const
Return the position, in the original source file, of this node or attribute.
void Add(TiXmlAttribute *attribute)
A TiXmlHandle is a class that wraps a node pointer with null checks; this is an incredibly useful thi...
virtual bool Visit(const TiXmlUnknown &unknown)
Visit an unknow node.
static bool IsWhiteSpace(int c)
virtual TiXmlComment * ToComment()
Cast to a more defined type. Will return null if not of the requested type.
const TiXmlAttribute * Next() const
Get the next sibling attribute in the DOM. Returns null at end.
const TiXmlDocument * GetDocument() const
Return a pointer to the Document this node lives in.
bool LoadFile(FILE *, TiXmlEncoding encoding=TIXML_DEFAULT_ENCODING)
Load a file using the given FILE*.
TiXmlUnknown * ToUnknown() const
Return the handle as a TiXmlUnknown.
static const char * GetEntity(const char *in, char *value, int *length, TiXmlEncoding encoding)
virtual bool Accept(TiXmlVisitor *visitor) const
Walk the XML tree visiting this node and all of its children.
void operator=(const TiXmlBase &base)
const TiXmlAttribute * Find(const char *_name) const
static void SetCondenseWhiteSpace(bool condense)
The world does not agree on whether white space should be kept or not.
TiXmlStylesheetReference(const TiXmlStylesheetReference ©)
bool operator>(const TiXmlAttribute &rhs) const
TiXmlBase is a base class for every class in TinyXml.
TiXmlNode * Parent()
One step up the DOM.
virtual TiXmlUnknown * ToUnknown()
Cast to a more defined type. Will return null if not of the requested type.
int Type() const
Query the type (as an enumerated value, above) of this node.
virtual const char * Parse(const char *p, TiXmlParsingData *data, TiXmlEncoding encoding)
virtual const TiXmlUnknown * ToUnknown() const
Cast to a more defined type. Will return null not of the requested type.
int QueryIntAttribute(const std::string &name, int *_value) const
static bool StringEqual(const char *p, const char *endTag, bool ignoreCase, TiXmlEncoding encoding)
const void * GetUserData() const
Get a pointer to arbitrary user data.
const TiXmlNode * FirstChild() const
The first child of this node. Will be null if there are no children.
const char * Attribute(const char *name, int *i) const
Given an attribute name, Attribute() returns the value for the attribute of that name, or null if none exists.
virtual bool VisitEnter(const TiXmlDocument &doc)
Visit a document.
virtual const char * Parse(const char *p, TiXmlParsingData *data=0, TiXmlEncoding encoding=TIXML_DEFAULT_ENCODING)
Parse the given null terminated block of xml data.
void operator=(const TiXmlElement &base)
virtual TiXmlNode * Clone() const
Creates a new Element and returns it - the returned element is a copy.
TiXmlHandle operator=(const TiXmlHandle &ref)
TiXmlNode * IterateChildren(const TiXmlNode *previous)
TiXmlDocument(const std::string &documentName)
Constructor.
virtual const TiXmlDeclaration * ToDeclaration() const
Cast to a more defined type. Will return null if not of the requested type.
void SetError(int err, const char *errorLocation, TiXmlParsingData *prevData, TiXmlEncoding encoding)
Base class for reference counting functionality.
TiXmlAttribute * Previous()
TiXmlNode(NodeType _type)
TiXmlElement * RootElement()
TiXmlHandle ChildElement(int index) const
Return a handle to the "index" child element.
static void EncodeString(const TIXML_STRING &str, TIXML_STRING *out)
Expands entities in a string.
TiXmlHandle ChildElement(const std::string &_value, int index) const
void * GetUserData()
Get a pointer to arbitrary user data.
The parent class for everything in the Document Object Model.
TiXmlText(const std::string &initValue)
Constructor.
const TiXmlAttribute * First() const
TiXmlNode * LastChild(const std::string &_value)
STL std::string form.
size_t Size()
Return the length of the result string.
void SetIntValue(int _value)
Set the value from an integer.
Print to memory functionality.
virtual TiXmlNode * Clone() const
Creates a copy of this StylesheetReference and returns it.
TiXmlNode * PreviousSibling(const std::string &_value)
STL std::string form.
TiXmlHandle Child(const std::string &_value, int index) const
TiXmlBase(const TiXmlBase &)
bool NoChildren() const
Returns true if this node has no children.
virtual const TiXmlUnknown * ToUnknown() const
Cast to a more defined type. Will return null if not of the requested type.
virtual void StreamIn(std::istream *in, TIXML_STRING *tag)
const std::string * Attribute(const std::string &name, double *d) const
TiXmlElement(const std::string &_value)
std::string constructor.
virtual bool VisitExit(const TiXmlDocument &)
Visit a document.
virtual bool Visit(const TiXmlComment &)
Visit a comment node.
const TiXmlNode * FirstChild(const char *value) const
The first child of this node with the matching 'value'. Will be null if none found. The first child of this node with the matching 'value'. Will be null if none found.
virtual TiXmlNode * Clone() const
Create an exact duplicate of this node and return it.
const std::string * Attribute(const std::string &name) const
const char * Attribute(const char *name) const
Given an attribute name, Attribute() returns the value for the attribute of that name, or null if none exists.
static const char * GetChar(const char *p, char *_value, int *length, TiXmlEncoding encoding)
void operator=(const TiXmlText &base)
virtual bool Visit(const TiXmlComment &comment)
Visit a comment node.
TiXmlText(const char *initValue)
Constructor for text element.
virtual const TiXmlStylesheetReference * ToStylesheetReference() const
Cast to a more defined type. Will return null if not of the requested type.
virtual const TiXmlDeclaration * ToDeclaration() const
Cast to a more defined type. Will return null not of the requested type.
TiXmlNode * NextSibling(const std::string &_value)
STL std::string form.
virtual void StreamIn(std::istream *in, TIXML_STRING *tag)
virtual const TiXmlStylesheetReference * ToStylesheetReference() const
Cast to a more defined type. Will return null not of the requested type.
virtual void Print(FILE *cfile, int depth) const
All TinyXml classes can print themselves to a filestream or the string class (TiXmlString in non-STL ...
TiXmlDeclaration(const char *_version, const char *_encoding, const char *_standalone)
Construct.
const TiXmlElement * FirstChildElement(const char *_value) const
Convenience function to get through elements.
const TiXmlElement * FirstChildElement(const std::string &_value) const
STL std::string form.
TiXmlAttribute(const std::string &_name, const std::string &_value)
std::string constructor.
bool SaveFile(const std::string &filename) const
int QueryFloatAttribute(const char *name, float *_value) const
QueryFloatAttribute examines the attribute - see QueryIntAttribute().
const TiXmlNode * Parent() const
int QueryDoubleAttribute(const std::string &name, double *_value) const
bool RemoveChild(TiXmlNode *removeThis)
Delete a child of this node.
void RemoveAttribute(const std::string &name)
STL std::string form.
bool SaveFile(const char *filename) const
Save a file using the given filename. Returns true if successful.
TiXmlStylesheetReference(const char *_type, const char *_href)
Construct.
void SetDocument(TiXmlDocument *doc)
virtual TiXmlUnknown * ToUnknown()
Cast to a more defined type. Will return null not of the requested type.
const TiXmlNode * LastChild(const char *value) const
void Remove(TiXmlAttribute *attribute)
void Clear()
Delete all the children of this node. Does not affect 'this'.
void SetValue(const char *_value)
Set the value.
const TiXmlAttribute * Previous() const
Get the previous sibling attribute in the DOM. Returns null at beginning.
const std::string & Str()
Return the result.
virtual ~TiXmlDeclaration()
const TiXmlNode * IterateChildren(const TiXmlNode *previous) const
An alternate way to walk the children of a node.
virtual bool Accept(TiXmlVisitor *content) const
Walk the XML tree visiting this node and all of its children.
virtual bool Accept(TiXmlVisitor *visitor) const
Walk the XML tree visiting this node and all of its children.
virtual TiXmlText * ToText()
Cast to a more defined type. Will return null not of the requested type.
TiXmlAttribute * LastAttribute()
TiXmlHandle FirstChildElement() const
Return a handle to the first child element.
TiXmlDeclaration()
Construct an empty declaration.
void SetStreamPrinting()
Switch over to "stream printing" which is the most dense formatting without linebreaks.
static int IsAlpha(unsigned char anyByte, TiXmlEncoding encoding)
const TiXmlNode * FirstChild(const std::string &_value) const
STL std::string form.
virtual void Print(FILE *cfile, int depth) const =0
All TinyXml classes can print themselves to a filestream or the string class (TiXmlString in non-STL ...
TiXmlHandle FirstChild(const std::string &_value) const
virtual TiXmlNode * Clone() const =0
Create an exact duplicate of this node and return it.
virtual void Print(FILE *cfile, int depth, TIXML_STRING *str) const
const TiXmlNode * NextSibling() const
Navigate to a sibling node.
TiXmlText * ToText() const
Return the handle as a TiXmlText.
static bool StreamWhiteSpace(std::istream *in, TIXML_STRING *tag)
virtual bool Visit(const TiXmlDeclaration &declaration)
Visit a declaration.
TiXmlElement(const TiXmlElement &)
const char * CStr()
Return the result.
virtual TiXmlText * ToText()
Cast to a more defined type. Will return null if not of the requested type.
const TiXmlNode * NextSibling(const std::string &_value) const
STL std::string form.
const int TIXML_MINOR_VERSION
int ErrorId() const
Generally, you probably want the error string ( ErrorDesc() ).
The element is a container class.
void SetAttribute(const std::string &name, int _value)
TiXmlCursor errorLocation
virtual bool Visit(const TiXmlStylesheetReference &stylesheet)
Visit a stylesheet reference.
virtual bool Accept(TiXmlVisitor *content) const
Walk the XML tree visiting this node and all of its children.
virtual void Print(FILE *cfile, int depth) const
All TinyXml classes can print themselves to a filestream or the string class (TiXmlString in non-STL ...
virtual bool VisitEnter(const TiXmlElement &, const TiXmlAttribute *)
Visit an element.
virtual bool Visit(const TiXmlDeclaration &)
Visit a declaration.
const TiXmlAttribute * FirstAttribute() const
Access the first attribute in this element.
TiXmlAttribute * Find(const std::string &_name)