26 #ifndef TINYXML_INCLUDED 27 #define TINYXML_INCLUDED 36 #pragma warning( push ) 37 #pragma warning( disable : 4530 ) 38 #pragma warning( disable : 4786 ) 48 #if defined( _DEBUG ) && !defined( DEBUG ) 56 #define TIXML_STRING std::string 59 #define TIXML_STRING TiXmlString 69 #if defined(_MSC_VER) && (_MSC_VER >= 1400 ) 71 #define TIXML_SNPRINTF _snprintf_s 72 #define TIXML_SSCANF sscanf_s 73 #elif defined(_MSC_VER) && (_MSC_VER >= 1200 ) 76 #define TIXML_SNPRINTF _snprintf 77 #define TIXML_SSCANF sscanf 78 #elif defined(__GNUC__) && (__GNUC__ >= 3 ) 81 #define TIXML_SNPRINTF snprintf 82 #define TIXML_SSCANF sscanf 84 #define TIXML_SNPRINTF snprintf 85 #define TIXML_SSCANF sscanf 219 virtual void Print( FILE* cfile,
int depth )
const = 0;
261 virtual const char*
Parse(
const char* p,
298 return ( isspace( (
unsigned char) c ) || c ==
'\n' || c ==
'\r' );
321 static const char*
ReadText(
const char* in,
323 bool ignoreWhiteSpace,
338 *length = utf8ByteTable[ *((
const unsigned char*)p) ];
339 assert( *length >= 0 && *length < 5 );
349 return GetEntity( p, _value, length, encoding );
357 for(
int i=0; p[i] && i<*length; ++i ) {
360 return p + (*length);
392 if ( v < 128 )
return tolower( v );
415 MAX_ENTITY_LENGTH = 6
517 void SetValue(
const std::string& _value ) {
value = _value; }
535 return const_cast< TiXmlNode*
> ((
const_cast< const TiXmlNode*
>(
this))->FirstChild( _value ));
542 return const_cast< TiXmlNode*
> ((
const_cast< const TiXmlNode*
>(
this))->LastChild( _value ));
570 return const_cast< TiXmlNode*
>( (
const_cast< const TiXmlNode*
>(
this))->IterateChildren( previous ) );
576 return const_cast< TiXmlNode*
>( (
const_cast< const TiXmlNode*
>(
this))->IterateChildren( _value, previous ) );
626 return const_cast< TiXmlNode*
>( (
const_cast< const TiXmlNode*
>(
this))->PreviousSibling( _prev ) );
643 return const_cast< TiXmlNode*
>( (
const_cast< const TiXmlNode*
>(
this))->NextSibling( _next ) );
661 return const_cast< TiXmlElement*
>( (
const_cast< const TiXmlNode*
>(
this))->NextSiblingElement( _next ) );
678 return const_cast< TiXmlElement*
>( (
const_cast< const TiXmlNode*
>(
this))->FirstChildElement( _value ) );
798 TiXmlAttribute(
const std::string& _name,
const std::string& _value )
822 int IntValue()
const;
823 double DoubleValue()
const;
837 int QueryIntValue(
int* _value )
const;
839 int QueryDoubleValue(
double* _value )
const;
844 void SetIntValue(
int _value );
845 void SetDoubleValue(
double _value );
848 void SetName(
const std::string& _name ) {
name = _name; }
876 virtual void Print( FILE* cfile,
int depth )
const {
877 Print( cfile, depth, 0 );
879 void Print( FILE* cfile,
int depth,
TIXML_STRING* str )
const;
926 # ifdef TIXML_USE_STL 966 const char* Attribute(
const char*
name )
const;
974 const char* Attribute(
const char* name,
int* i )
const;
982 const char* Attribute(
const char* name,
double*
d )
const;
991 int QueryIntAttribute(
const char* name,
int* _value )
const;
993 int QueryUnsignedAttribute(
const char* name,
unsigned* _value )
const;
998 int QueryBoolAttribute(
const char* name,
bool* _value )
const;
1000 int QueryDoubleAttribute(
const char* name,
double* _value )
const;
1004 int result = QueryDoubleAttribute( name, &d );
1011 #ifdef TIXML_USE_STL 1012 int QueryStringAttribute(
const char* name, std::string* _value )
const {
1014 const char* cstr = Attribute( name );
1016 *_value = std::string( cstr );
1036 std::stringstream sstream( node->
ValueStr() );
1037 sstream >> *outValue;
1038 if ( !sstream.fail() )
1056 void SetAttribute(
const char* name,
const char * _value );
1058 #ifdef TIXML_USE_STL 1059 const std::string* Attribute(
const std::string& name )
const;
1060 const std::string* Attribute(
const std::string& name,
int* i )
const;
1061 const std::string* Attribute(
const std::string& name,
double* d )
const;
1062 int QueryIntAttribute(
const std::string& name,
int* _value )
const;
1063 int QueryDoubleAttribute(
const std::string& name,
double* _value )
const;
1066 void SetAttribute(
const std::string& name,
const std::string& _value );
1068 void SetAttribute(
const std::string& name,
int _value );
1070 void SetDoubleAttribute(
const std::string& name,
double value );
1076 void SetAttribute(
const char * name,
int value );
1081 void SetDoubleAttribute(
const char * name,
double value );
1085 void RemoveAttribute(
const char * name );
1086 #ifdef TIXML_USE_STL 1127 const char* GetText()
const;
1132 virtual void Print( FILE* cfile,
int depth )
const;
1152 #ifdef TIXML_USE_STL 1153 virtual void StreamIn( std::istream * in,
TIXML_STRING * tag );
1185 virtual void Print( FILE* cfile,
int depth )
const;
1203 #ifdef TIXML_USE_STL 1204 virtual void StreamIn( std::istream * in,
TIXML_STRING * tag );
1233 #ifdef TIXML_USE_STL 1246 virtual void Print( FILE* cfile,
int depth )
const;
1269 #ifdef TIXML_USE_STL 1297 #ifdef TIXML_USE_STL 1300 const std::string& _encoding,
1301 const std::string& _standalone );
1306 const char* _encoding,
1307 const char* _standalone );
1315 const char *
Version()
const {
return version.c_str (); }
1317 const char *
Encoding()
const {
return encoding.c_str (); }
1324 virtual void Print( FILE* cfile,
int depth,
TIXML_STRING* str )
const;
1325 virtual void Print( FILE* cfile,
int depth )
const {
1326 Print( cfile, depth, 0 );
1341 #ifdef TIXML_USE_STL 1342 virtual void StreamIn( std::istream * in,
TIXML_STRING * tag );
1372 virtual void Print( FILE* cfile,
int depth )
const;
1386 #ifdef TIXML_USE_STL 1387 virtual void StreamIn( std::istream * in,
TIXML_STRING * tag );
1407 #ifdef TIXML_USE_STL 1423 bool SaveFile()
const;
1427 bool SaveFile(
const char * filename )
const;
1435 bool SaveFile( FILE* )
const;
1437 #ifdef TIXML_USE_STL 1440 return LoadFile( filename.c_str(), encoding );
1444 return SaveFile( filename.c_str() );
1469 const char *
ErrorDesc()
const {
return errorDesc.c_str (); }
1520 errorLocation.row = errorLocation.col = 0;
1534 virtual void Print( FILE* cfile,
int depth = 0 )
const;
1548 #ifdef TIXML_USE_STL 1549 virtual void StreamIn( std::istream * in,
TIXML_STRING * tag );
1660 TiXmlHandle FirstChildElement(
const char * value )
const;
1665 TiXmlHandle Child(
const char* value,
int index )
const;
1674 TiXmlHandle ChildElement(
const char* value,
int index )
const;
1681 #ifdef TIXML_USE_STL 1747 buffer(), indent(
" " ), lineBreak(
"\n" ) {}
1756 virtual bool Visit(
const TiXmlText& text );
1763 void SetIndent(
const char* _indent ) { indent = _indent ? _indent :
"" ; }
1765 const char*
Indent() {
return indent.c_str(); }
1770 void SetLineBreak(
const char* _lineBreak ) { lineBreak = _lineBreak ? _lineBreak :
""; }
1781 const char*
CStr() {
return buffer.c_str(); }
1783 size_t Size() {
return buffer.size(); }
1785 #ifdef TIXML_USE_STL 1786 const std::string& Str() {
return buffer; }
1792 for(
int i=0; i<depth; ++i )
1796 buffer += lineBreak;
1808 #pragma warning( pop )
static const int utf8ByteTable[256]
virtual const char * Parse(const char *p, TiXmlParsingData *data, TiXmlEncoding encoding)
int ErrorCol() const
The column where the error occured. See ErrorRow()
TiXmlNode * LastChild(const char *_value)
The last child of this node matching 'value'. Will be null if there are no children.
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 SetUserData(void *user)
Set a pointer to arbitrary user data.
virtual const TiXmlElement * ToElement() const
Cast to a more defined type. Will return null not of the requested type.
TiXmlUnknown(const TiXmlUnknown ©)
void SetLineBreak(const char *_lineBreak)
TiXmlElement * NextSiblingElement()
TiXmlHandle(const TiXmlHandle &ref)
Copy constructor.
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 TiXmlElement * ToElement()
Cast to a more defined type. Will return null if not of the requested type.
virtual bool Visit(const TiXmlUnknown &)
Visit an unknown node.
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.
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.
bool operator<(const TiXmlAttribute &rhs) const
static int ToLower(int v, TiXmlEncoding encoding)
TiXmlNode * IterateChildren(const std::string &_value, const TiXmlNode *previous)
STL std::string form.
TiXmlElement * Element() const
TiXmlNode * IterateChildren(const char *_value, const TiXmlNode *previous)
static int IsAlphaNum(unsigned char anyByte, TiXmlEncoding encoding)
TiXmlElement & operator=(const TiXmlElement &base)
const TiXmlNode * IterateChildren(const std::string &_value, const TiXmlNode *previous) const
STL std::string form.
virtual const TiXmlElement * ToElement() const
Cast to a more defined type. Will return null if not of the requested type.
TiXmlHandle FirstChildElement(const std::string &_value) const
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()
GeneratorWrapper< T > value(T &&value)
int Column() const
See Row()
void operator=(const TiXmlAttributeSet &)
TiXmlElement * FirstChildElement(const char *_value)
void SetValue(const std::string &_value)
STL std::string form.
static const char * ReadName(const char *p, TIXML_STRING *name, TiXmlEncoding encoding)
virtual void StreamIn(std::istream *in, TIXML_STRING *tag)
TiXmlNode * ReplaceChild(TiXmlNode *replaceThis, const TiXmlNode &withThis)
const std::string & ValueStr() const
virtual bool VisitExit(const TiXmlElement &)
Visit an element.
bool CDATA() const
Queries whether this represents text using a CDATA section.
void SetName(const char *_name)
Set the name of this attribute.
TiXmlNode * NextSibling()
void SetTabSize(int _tabsize)
TiXmlAttribute()
Construct an empty attribute.
const int TIXML_PATCH_VERSION
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 CopyTo(TiXmlUnknown *target) const
const TiXmlElement * NextSiblingElement(const std::string &_value) const
STL std::string form.
virtual void Print(FILE *cfile, int depth) const
static const char * errorString[TIXML_ERROR_STRING_COUNT]
void SetValue(const char *_value)
TiXmlNode * InsertEndChild(const TiXmlNode &addThis)
static void ConvertUTF32ToUTF8(unsigned long input, char *output, int *length)
TiXmlNode * ToNode() const
virtual TiXmlElement * ToElement()
Cast to a more defined type. Will return null not of the requested type.
const TIXML_STRING & ValueTStr() const
TiXmlNode * InsertBeforeChild(TiXmlNode *beforeThis, const TiXmlNode &addThis)
static bool condenseWhiteSpace
const std::string & ValueStr() const
Return the value of this attribute.
TiXmlNode * PreviousSibling()
virtual bool VisitEnter(const TiXmlDocument &)
Visit a document.
TiXmlNode * LinkEndChild(TiXmlNode *addThis)
const TiXmlElement * RootElement() const
const TiXmlElement * FirstChildElement() const
Convenience function to get through elements.
const TiXmlNode * PreviousSibling(const std::string &_value) const
STL std::string form.
const char * Encoding() const
Encoding. Will return an empty string if none was found.
void * userData
Field containing a generic user pointer.
TiXmlDocument * GetDocument()
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
virtual bool Visit(const TiXmlText &)
Visit a text node.
virtual const TiXmlText * ToText() const
Cast to a more defined type. Will return null not of the requested type.
const TiXmlEncoding TIXML_DEFAULT_ENCODING
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)
const char * Version() const
Version. Will return an empty string if none was found.
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
const int TIXML_MAJOR_VERSION
int QueryValueAttribute(const std::string &name, std::string *outValue) const
const TiXmlNode * LastChild(const std::string &_value) const
STL std::string form.
void SetIndent(const char *_indent)
const TiXmlAttribute * LastAttribute() const
Access the last attribute in this element.
int QueryValueAttribute(const std::string &name, T *outValue) const
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.
void SetCDATA(bool _cdata)
Turns on or off a CDATA representation of text.
const char * Indent()
Query the indention string.
virtual void Print(FILE *cfile, int depth) const
TiXmlElement * FirstChildElement(const std::string &_value)
STL std::string form.
virtual TiXmlDeclaration * ToDeclaration()
Cast to a more defined type. Will return null not of the requested type.
const TiXmlElement * NextSiblingElement() const
const TiXmlAttribute * Last() const
TiXmlElement * ToElement() const
static const char * SkipWhiteSpace(const char *, TiXmlEncoding encoding)
TiXmlNode * Identify(const char *start, TiXmlEncoding encoding)
TiXmlNode * InsertAfterChild(TiXmlNode *afterThis, const TiXmlNode &addThis)
TiXmlUnknown * Unknown() const
TiXmlText & operator=(const TiXmlText &base)
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.
static bool IsWhiteSpace(int c)
virtual TiXmlComment * ToComment()
Cast to a more defined type. Will return null if not of the requested type.
const TiXmlDocument * GetDocument() const
TiXmlUnknown * ToUnknown() const
USBInterfaceDescriptor data
static const char * GetEntity(const char *in, char *value, int *length, TiXmlEncoding encoding)
static void SetCondenseWhiteSpace(bool condense)
bool operator>(const TiXmlAttribute &rhs) const
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.
virtual const TiXmlUnknown * ToUnknown() const
Cast to a more defined type. Will return null not of the requested type.
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.
virtual const char * Parse(const char *p, TiXmlParsingData *data=0, TiXmlEncoding encoding=TIXML_DEFAULT_ENCODING)
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)
virtual const TiXmlDeclaration * ToDeclaration() const
Cast to a more defined type. Will return null if not of the requested type.
TiXmlAttribute * Previous()
TiXmlNode(NodeType _type)
TiXmlElement * RootElement()
static void EncodeString(const TIXML_STRING &str, TIXML_STRING *out)
TiXmlHandle ChildElement(const std::string &_value, int index) const
void * GetUserData()
Get a pointer to arbitrary user data.
const TiXmlAttribute * First() const
TiXmlNode * LastChild(const std::string &_value)
STL std::string form.
size_t Size()
Return the length of the result string.
TiXmlNode * PreviousSibling(const std::string &_value)
STL std::string form.
TiXmlHandle Child(const std::string &_value, int index) const
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 bool VisitExit(const TiXmlDocument &)
Visit a document.
virtual bool Visit(const TiXmlComment &)
Visit a comment node.
static const char * GetChar(const char *p, char *_value, int *length, TiXmlEncoding encoding)
TiXmlText(const char *initValue)
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.
TFSIMD_FORCE_INLINE tfScalar length(const Quaternion &q)
TiXmlDocument & operator=(const TiXmlDocument ©)
TiXmlUnknown & operator=(const TiXmlUnknown ©)
virtual void Print(FILE *cfile, int depth) const
const TiXmlElement * FirstChildElement(const std::string &_value) const
STL std::string form.
bool SaveFile(const std::string &filename) const
< STL std::string version.
int QueryFloatAttribute(const char *name, float *_value) const
QueryFloatAttribute examines the attribute - see QueryIntAttribute().
const TiXmlNode * Parent() const
bool RemoveChild(TiXmlNode *removeThis)
Delete a child of this node.
void RemoveAttribute(const std::string &name)
STL std::string form.
void SetDocument(TiXmlDocument *doc)
virtual TiXmlUnknown * ToUnknown()
Cast to a more defined type. Will return null not of the requested type.
void SetValue(const char *_value)
Set the value.
virtual ~TiXmlDeclaration()
const TiXmlNode * IterateChildren(const TiXmlNode *previous) const
virtual bool Accept(TiXmlVisitor *visitor) const
virtual TiXmlText * ToText()
Cast to a more defined type. Will return null not of the requested type.
TiXmlAttribute * LastAttribute()
std::ostream & operator<<(std::ostream &, Catch_global_namespace_dummy)
TiXmlDeclaration()
Construct an empty declaration.
static int IsAlpha(unsigned char anyByte, TiXmlEncoding encoding)
const TiXmlNode * FirstChild(const std::string &_value) const
STL std::string form.
TiXmlHandle FirstChild(const std::string &_value) const
const TiXmlNode * NextSibling() const
Navigate to a sibling node.
TiXmlText * ToText() const
static bool StreamWhiteSpace(std::istream *in, TIXML_STRING *tag)
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
TiXmlCursor errorLocation
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.