| tinyxml.h | | tinyxml.h | |
| | | | |
| skipping to change at line 45 | | skipping to change at line 45 | |
| #include <stdio.h> | | #include <stdio.h> | |
| #include <stdlib.h> | | #include <stdlib.h> | |
| #include <string.h> | | #include <string.h> | |
| #include <assert.h> | | #include <assert.h> | |
| | | | |
| // Help out windows: | | // Help out windows: | |
| #if defined( _DEBUG ) && !defined( DEBUG ) | | #if defined( _DEBUG ) && !defined( DEBUG ) | |
| #define DEBUG | | #define DEBUG | |
| #endif | | #endif | |
| | | | |
|
| #if defined( DEBUG ) && defined( _MSC_VER ) | | | |
| #include <windows.h> | | | |
| #define TIXML_LOG OutputDebugString | | | |
| #else | | | |
| #define TIXML_LOG printf | | | |
| #endif | | | |
| | | | |
| #ifdef TIXML_USE_STL | | #ifdef TIXML_USE_STL | |
| #include <string> | | #include <string> | |
| #include <iostream> | | #include <iostream> | |
| #define TIXML_STRING std::string | | #define TIXML_STRING std::string | |
| #define TIXML_ISTREAM std::istream | | #define TIXML_ISTREAM std::istream | |
| #define TIXML_OSTREAM std::ostream | | #define TIXML_OSTREAM std::ostream | |
| #else | | #else | |
| #include "tinystr.h" | | #include "tinystr.h" | |
| #define TIXML_STRING TiXmlString | | #define TIXML_STRING TiXmlString | |
| #define TIXML_OSTREAM TiXmlOutStream | | #define TIXML_OSTREAM TiXmlOutStream | |
| #endif | | #endif | |
| | | | |
| // Deprecated library function hell. Compilers want to use the | | // Deprecated library function hell. Compilers want to use the | |
| // new safe versions. This probably doesn't fully address the problem, | | // new safe versions. This probably doesn't fully address the problem, | |
| // but it gets closer. There are too many compilers for me to fully | | // but it gets closer. There are too many compilers for me to fully | |
| // test. If you get compilation troubles, undefine TIXML_SAFE | | // test. If you get compilation troubles, undefine TIXML_SAFE | |
| | | | |
| #define TIXML_SAFE // TinyXml isn't fully buffer overrun protec
ted, safe code. This is work in progress. | | #define TIXML_SAFE // TinyXml isn't fully buffer overrun protec
ted, safe code. This is work in progress. | |
| #ifdef TIXML_SAFE | | #ifdef TIXML_SAFE | |
|
| #if defined(_MSC_VER) && (_MSC_VER >= 1200 ) | | #if defined(_MSC_VER) && (_MSC_VER >= 1400 ) | |
| | | // Microsoft visual studio, version 2005 and higher. | |
| | | #define TIXML_SNPRINTF _snprintf_s | |
| | | #define TIXML_SNSCANF _snscanf_s | |
| | | #elif defined(_MSC_VER) && (_MSC_VER >= 1200 ) | |
| // Microsoft visual studio, version 6 and higher. | | // Microsoft visual studio, version 6 and higher. | |
| //#pragma message( "Using _sn* functions." ) | | //#pragma message( "Using _sn* functions." ) | |
| #define TIXML_SNPRINTF _snprintf | | #define TIXML_SNPRINTF _snprintf | |
| #define TIXML_SNSCANF _snscanf | | #define TIXML_SNSCANF _snscanf | |
| #elif defined(__GNUC__) && (__GNUC__ >= 3 ) | | #elif defined(__GNUC__) && (__GNUC__ >= 3 ) | |
| // GCC version 3 and higher.s | | // GCC version 3 and higher.s | |
| //#warning( "Using sn* functions." ) | | //#warning( "Using sn* functions." ) | |
| #define TIXML_SNPRINTF snprintf | | #define TIXML_SNPRINTF snprintf | |
| #define TIXML_SNSCANF snscanf | | #define TIXML_SNSCANF snscanf | |
| #endif | | #endif | |
| | | | |
| skipping to change at line 95 | | skipping to change at line 92 | |
| class TiXmlElement; | | class TiXmlElement; | |
| class TiXmlComment; | | class TiXmlComment; | |
| class TiXmlUnknown; | | class TiXmlUnknown; | |
| class TiXmlAttribute; | | class TiXmlAttribute; | |
| class TiXmlText; | | class TiXmlText; | |
| class TiXmlDeclaration; | | class TiXmlDeclaration; | |
| class TiXmlParsingData; | | class TiXmlParsingData; | |
| | | | |
| const int TIXML_MAJOR_VERSION = 2; | | const int TIXML_MAJOR_VERSION = 2; | |
| const int TIXML_MINOR_VERSION = 4; | | const int TIXML_MINOR_VERSION = 4; | |
|
| const int TIXML_PATCH_VERSION = 2; | | const int TIXML_PATCH_VERSION = 3; | |
| | | | |
| /* Internal structure for tracking location of items | | /* Internal structure for tracking location of items | |
| in the XML file. | | in the XML file. | |
| */ | | */ | |
| struct TiXmlCursor | | struct TiXmlCursor | |
| { | | { | |
| TiXmlCursor() { Clear(); } | | TiXmlCursor() { Clear(); } | |
| void Clear() { row = col = -1; } | | void Clear() { row = col = -1; } | |
| | | | |
| int row; // 0 based. | | int row; // 0 based. | |
| | | | |
| skipping to change at line 248 | | skipping to change at line 245 | |
| StringToBuffer( const TIXML_STRING& str ); | | StringToBuffer( const TIXML_STRING& str ); | |
| ~StringToBuffer(); | | ~StringToBuffer(); | |
| char* buffer; | | char* buffer; | |
| }; | | }; | |
| | | | |
| static const char* SkipWhiteSpace( const char*, TiXmlEncoding e
ncoding ); | | static const char* SkipWhiteSpace( const char*, TiXmlEncoding e
ncoding ); | |
| inline static bool IsWhiteSpace( char c ) | | inline static bool IsWhiteSpace( char c ) | |
| { | | { | |
| return ( isspace( (unsigned char) c ) || c == '\n' || c == '
\r' ); | | return ( isspace( (unsigned char) c ) || c == '\n' || c == '
\r' ); | |
| } | | } | |
|
| | | inline static bool IsWhiteSpace( int c ) | |
| | | { | |
| | | if ( c < 256 ) | |
| | | return IsWhiteSpace( (char) c ); | |
| | | return false; // Again, only truly correct for English/Lat | |
| | | in...but usually works. | |
| | | } | |
| | | | |
| virtual void StreamOut (TIXML_OSTREAM *) const = 0; | | virtual void StreamOut (TIXML_OSTREAM *) const = 0; | |
| | | | |
| #ifdef TIXML_USE_STL | | #ifdef TIXML_USE_STL | |
| static bool StreamWhiteSpace( TIXML_ISTREAM * in, TIXML_STRING *
tag ); | | static bool StreamWhiteSpace( TIXML_ISTREAM * in, TIXML_STRING *
tag ); | |
| static bool StreamTo( TIXML_ISTREAM * in, int character, TIXML_S
TRING * tag ); | | static bool StreamTo( TIXML_ISTREAM * in, int character, TIXML_S
TRING * tag ); | |
| #endif | | #endif | |
| | | | |
| /* Reads an XML name into the string provided. Returns | | /* Reads an XML name into the string provided. Returns | |
| a pointer just past the last character of the name, | | a pointer just past the last character of the name, | |
| | | | |
| skipping to change at line 468 | | skipping to change at line 471 | |
| Element: name of the element | | Element: name of the element | |
| Comment: the comment text | | Comment: the comment text | |
| Unknown: the tag contents | | Unknown: the tag contents | |
| Text: the text string | | Text: the text string | |
| @endverbatim | | @endverbatim | |
| */ | | */ | |
| void SetValue(const char * _value) { value = _value;} | | void SetValue(const char * _value) { value = _value;} | |
| | | | |
| #ifdef TIXML_USE_STL | | #ifdef TIXML_USE_STL | |
| /// STL std::string form. | | /// STL std::string form. | |
|
| void SetValue( const std::string& _value ) | | void SetValue( const std::string& _value ) { value = _value; } | |
| { | | | |
| StringToBuffer buf( _value ); | | | |
| SetValue( buf.buffer ? buf.buffer : "" ); | | | |
| } | | | |
| #endif | | #endif | |
| | | | |
| /// Delete all the children of this node. Does not affect 'this'. | | /// Delete all the children of this node. Does not affect 'this'. | |
| void Clear(); | | void Clear(); | |
| | | | |
| /// One step up the DOM. | | /// One step up the DOM. | |
| TiXmlNode* Parent()
{ return parent; } | | TiXmlNode* Parent()
{ return parent; } | |
| const TiXmlNode* Parent() const { return par
ent; } | | const TiXmlNode* Parent() const { return par
ent; } | |
| | | | |
| const TiXmlNode* FirstChild() const { return firstChild; }
///< The first child of this node. Will be null if there are no childre
n. | | const TiXmlNode* FirstChild() const { return firstChild; }
///< The first child of this node. Will be null if there are no childre
n. | |
| | | | |
| skipping to change at line 631 | | skipping to change at line 630 | |
| | | | |
| /** Return a pointer to the Document this node lives in. | | /** Return a pointer to the Document this node lives in. | |
| Returns null if not in a document. | | Returns null if not in a document. | |
| */ | | */ | |
| const TiXmlDocument* GetDocument() const; | | const TiXmlDocument* GetDocument() const; | |
| TiXmlDocument* GetDocument(); | | TiXmlDocument* GetDocument(); | |
| | | | |
| /// Returns true if this node has no children. | | /// Returns true if this node has no children. | |
| bool NoChildren() const { re
turn !firstChild; } | | bool NoChildren() const { re
turn !firstChild; } | |
| | | | |
|
| const TiXmlDocument* ToDocument() const { return ( t | | virtual const TiXmlDocument* ToDocument() const { return 0; } | |
| his && type == DOCUMENT ) ? (const TiXmlDocument*) this : 0; } ///< Cast to | | ///< Cast to a more defined type. Will return null if not of the requested | |
| a more defined type. Will return null not of the requested type. | | type. | |
| const TiXmlElement* ToElement() const { return ( t | | virtual const TiXmlElement* ToElement() const { return 0; } | |
| his && type == ELEMENT ) ? (const TiXmlElement*) this : 0; } ///< Cast to | | ///< Cast to a more defined type. Will return null if not of the requested | |
| a more defined type. Will return null not of the requested type. | | type. | |
| const TiXmlComment* ToComment() const { return ( t | | virtual const TiXmlComment* ToComment() const { return 0; } | |
| his && type == COMMENT ) ? (const TiXmlComment*) this : 0; } ///< Cast to | | ///< Cast to a more defined type. Will return null if not of the requested | |
| a more defined type. Will return null not of the requested type. | | type. | |
| const TiXmlUnknown* ToUnknown() const { return ( t | | virtual const TiXmlUnknown* ToUnknown() const { return 0; } | |
| his && type == UNKNOWN ) ? (const TiXmlUnknown*) this : 0; } ///< Cast to | | ///< Cast to a more defined type. Will return null if not of the requested | |
| a more defined type. Will return null not of the requested type. | | type. | |
| const TiXmlText* ToText() const { return ( t | | virtual const TiXmlText* ToText() const { return 0; } | |
| his && type == TEXT ) ? (const TiXmlText*) this : 0; } ///< Cast to | | ///< Cast to a more defined type. Will return null if not of the requested | |
| a more defined type. Will return null not of the requested type. | | type. | |
| const TiXmlDeclaration* ToDeclaration() const { return ( this && t | | virtual const TiXmlDeclaration* ToDeclaration() const { return 0; } | |
| ype == DECLARATION ) ? (const TiXmlDeclaration*) this : 0; } ///< Cast to a | | ///< Cast to a more defined type. Will return null if not of the requested | |
| more defined type. Will return null not of the requested type. | | type. | |
| | | | |
|
| TiXmlDocument* ToDocument() { return ( this && t | | virtual TiXmlDocument* ToDocument() { return 0; } ///< C | |
| ype == DOCUMENT ) ? (TiXmlDocument*) this : 0; } ///< Cast to a more define | | ast to a more defined type. Will return null if not of the requested type. | |
| d type. Will return null not of the requested type. | | virtual TiXmlElement* ToElement() { return 0; } // | |
| TiXmlElement* ToElement() { return ( this && t | | /< Cast to a more defined type. Will return null if not of the requested ty | |
| ype == ELEMENT ) ? (TiXmlElement*) this : 0; } ///< Cast to a more define | | pe. | |
| d type. Will return null not of the requested type. | | virtual TiXmlComment* ToComment() { return 0; } ///< C | |
| TiXmlComment* ToComment() { return ( this && t | | ast to a more defined type. Will return null if not of the requested type. | |
| ype == COMMENT ) ? (TiXmlComment*) this : 0; } ///< Cast to a more define | | virtual TiXmlUnknown* ToUnknown() { return 0; } // | |
| d type. Will return null not of the requested type. | | /< Cast to a more defined type. Will return null if not of the requested ty | |
| TiXmlUnknown* ToUnknown() { return ( this && t | | pe. | |
| ype == UNKNOWN ) ? (TiXmlUnknown*) this : 0; } ///< Cast to a more define | | virtual TiXmlText* ToText() { return 0; } // | |
| d type. Will return null not of the requested type. | | /< Cast to a more defined type. Will return null if not of the requested ty | |
| TiXmlText* ToText() { return ( this && t | | pe. | |
| ype == TEXT ) ? (TiXmlText*) this : 0; } ///< Cast to a more define | | virtual TiXmlDeclaration* ToDeclaration() { return 0; } ///< C | |
| d type. Will return null not of the requested type. | | ast to a more defined type. Will return null if not of the requested type. | |
| TiXmlDeclaration* ToDeclaration() { return ( this && type == D | | | |
| ECLARATION ) ? (TiXmlDeclaration*) this : 0; } ///< Cast to a more defined | | | |
| type. Will return null not of the requested type. | | | |
| | | | |
| /** Create an exact duplicate of this node and return it. The memory
must be deleted | | /** Create an exact duplicate of this node and return it. The memory
must be deleted | |
| by the caller. | | by the caller. | |
| */ | | */ | |
| virtual TiXmlNode* Clone() const = 0; | | virtual TiXmlNode* Clone() const = 0; | |
| | | | |
| protected: | | protected: | |
| TiXmlNode( NodeType _type ); | | TiXmlNode( NodeType _type ); | |
| | | | |
| // Copy to the allocated object. Shared functionality between Clone,
Copy constructor, | | // Copy to the allocated object. Shared functionality between Clone,
Copy constructor, | |
| | | | |
| skipping to change at line 725 | | skipping to change at line 724 | |
| value = _value; | | value = _value; | |
| document = 0; | | document = 0; | |
| prev = next = 0; | | prev = next = 0; | |
| } | | } | |
| | | | |
| const char* Name() const { return name.c_str
(); } ///< Return the name of this attribute. | | const char* Name() const { return name.c_str
(); } ///< Return the name of this attribute. | |
| const char* Value() const { return value.c_str
(); } ///< Return the value of this attribute. | | const char* Value() const { return value.c_str
(); } ///< Return the value of this attribute. | |
| int IntValue() const;
///< Return the value o
f this attribute, converted to an integer. | | int IntValue() const;
///< Return the value o
f this attribute, converted to an integer. | |
| double DoubleValue() const;
///< Return the value of this attribute
, converted to a double. | | double DoubleValue() const;
///< Return the value of this attribute
, converted to a double. | |
| | | | |
|
| | | // Get the tinyxml string representation | |
| | | const TIXML_STRING& NameTStr() const { return name; } | |
| | | | |
| /** QueryIntValue examines the value string. It is an alternative to
the | | /** QueryIntValue examines the value string. It is an alternative to
the | |
| IntValue() method with richer error checking. | | IntValue() method with richer error checking. | |
| If the value is an integer, it is stored in 'value' and | | If the value is an integer, it is stored in 'value' and | |
| the call returns TIXML_SUCCESS. If it is not | | the call returns TIXML_SUCCESS. If it is not | |
| an integer, it returns TIXML_WRONG_TYPE. | | an integer, it returns TIXML_WRONG_TYPE. | |
| | | | |
| A specialized but useful call. Note that for success it retu
rns 0, | | A specialized but useful call. Note that for success it retu
rns 0, | |
| which is the opposite of almost all other TinyXml calls. | | which is the opposite of almost all other TinyXml calls. | |
| */ | | */ | |
| int QueryIntValue( int* _value ) const; | | int QueryIntValue( int* _value ) const; | |
| | | | |
| skipping to change at line 746 | | skipping to change at line 748 | |
| int QueryDoubleValue( double* _value ) const; | | int QueryDoubleValue( double* _value ) const; | |
| | | | |
| void SetName( const char* _name ) { name = _name; }
///< Set the name of this attribute. | | void SetName( const char* _name ) { name = _name; }
///< Set the name of this attribute. | |
| void SetValue( const char* _value ) { value = _value; }
///< Set the value. | | void SetValue( const char* _value ) { value = _value; }
///< Set the value. | |
| | | | |
| void SetIntValue( int _value );
///< Set the value from an integer. | | void SetIntValue( int _value );
///< Set the value from an integer. | |
| void SetDoubleValue( double _value );
///< Set the value from a double. | | void SetDoubleValue( double _value );
///< Set the value from a double. | |
| | | | |
| #ifdef TIXML_USE_STL | | #ifdef TIXML_USE_STL | |
| /// STL std::string form. | | /// STL std::string form. | |
|
| void SetName( const std::string& _name ) | | void SetName( const std::string& _name ) { name = _name; } | |
| { | | | |
| StringToBuffer buf( _name ); | | | |
| SetName ( buf.buffer ? buf.buffer : "error" ); | | | |
| } | | | |
| /// STL std::string form. | | /// STL std::string form. | |
|
| void SetValue( const std::string& _value ) | | void SetValue( const std::string& _value ) { value = _value; } | |
| { | | | |
| StringToBuffer buf( _value ); | | | |
| SetValue( buf.buffer ? buf.buffer : "error" ); | | | |
| } | | | |
| #endif | | #endif | |
| | | | |
| /// Get the next sibling attribute in the DOM. Returns null at end. | | /// Get the next sibling attribute in the DOM. Returns null at end. | |
| const TiXmlAttribute* Next() const; | | const TiXmlAttribute* Next() const; | |
| TiXmlAttribute* Next(); | | TiXmlAttribute* Next(); | |
| /// Get the previous sibling attribute in the DOM. Returns null at b
eginning. | | /// Get the previous sibling attribute in the DOM. Returns null at b
eginning. | |
| const TiXmlAttribute* Previous() const; | | const TiXmlAttribute* Previous() const; | |
| TiXmlAttribute* Previous(); | | TiXmlAttribute* Previous(); | |
| | | | |
| bool operator==( const TiXmlAttribute& rhs ) const { return rhs.name
== name; } | | bool operator==( const TiXmlAttribute& rhs ) const { return rhs.name
== name; } | |
| | | | |
| skipping to change at line 820 | | skipping to change at line 814 | |
| ~TiXmlAttributeSet(); | | ~TiXmlAttributeSet(); | |
| | | | |
| void Add( TiXmlAttribute* attribute ); | | void Add( TiXmlAttribute* attribute ); | |
| void Remove( TiXmlAttribute* attribute ); | | void Remove( TiXmlAttribute* attribute ); | |
| | | | |
| const TiXmlAttribute* First() const { return ( sentinel.next ==
&sentinel ) ? 0 : sentinel.next; } | | const TiXmlAttribute* First() const { return ( sentinel.next ==
&sentinel ) ? 0 : sentinel.next; } | |
| TiXmlAttribute* First() { return ( s
entinel.next == &sentinel ) ? 0 : sentinel.next; } | | TiXmlAttribute* First() { return ( s
entinel.next == &sentinel ) ? 0 : sentinel.next; } | |
| const TiXmlAttribute* Last() const { return ( sentinel.
prev == &sentinel ) ? 0 : sentinel.prev; } | | const TiXmlAttribute* Last() const { return ( sentinel.
prev == &sentinel ) ? 0 : sentinel.prev; } | |
| TiXmlAttribute* Last() { return ( s
entinel.prev == &sentinel ) ? 0 : sentinel.prev; } | | TiXmlAttribute* Last() { return ( s
entinel.prev == &sentinel ) ? 0 : sentinel.prev; } | |
| | | | |
|
| const TiXmlAttribute* Find( const char * name ) const; | | const TiXmlAttribute* Find( const TIXML_STRING& name ) const; | |
| TiXmlAttribute* Find( const char * name ); | | TiXmlAttribute* Find( const TIXML_STRING& name ); | |
| | | | |
| private: | | private: | |
| //*ME: Because of hidden/disabled copy-construktor in TiXmlAttribut
e (sentinel-element), | | //*ME: Because of hidden/disabled copy-construktor in TiXmlAttribut
e (sentinel-element), | |
| //*ME: this class must be also use a hidden/disabled copy-construct
or !!! | | //*ME: this class must be also use a hidden/disabled copy-construct
or !!! | |
| TiXmlAttributeSet( const TiXmlAttributeSet& ); // not allowed | | TiXmlAttributeSet( const TiXmlAttributeSet& ); // not allowed | |
| void operator=( const TiXmlAttributeSet& ); // not allowed (as T
iXmlAttribute) | | void operator=( const TiXmlAttributeSet& ); // not allowed (as T
iXmlAttribute) | |
| | | | |
| TiXmlAttribute sentinel; | | TiXmlAttribute sentinel; | |
| }; | | }; | |
| | | | |
| | | | |
| skipping to change at line 907 | | skipping to change at line 901 | |
| void SetAttribute( const char* name, const char * _value ); | | void SetAttribute( const char* name, const char * _value ); | |
| | | | |
| #ifdef TIXML_USE_STL | | #ifdef TIXML_USE_STL | |
| const char* Attribute( const std::string& name ) const
{ return Attribute( name.c_str() ); } | | const char* Attribute( const std::string& name ) const
{ return Attribute( name.c_str() ); } | |
| const char* Attribute( const std::string& name, int* i ) const
{ return Attribute( name.c_str(), i ); } | | const char* Attribute( const std::string& name, int* i ) const
{ return Attribute( name.c_str(), i ); } | |
| const char* Attribute( const std::string& name, double* d ) const
{ return Attribute( name.c_str(), d ); } | | const char* Attribute( const std::string& name, double* d ) const
{ return Attribute( name.c_str(), d ); } | |
| int QueryIntAttribute( const std::string& name, int* _value ) const
{ return QueryIntAttribute( name.c_str(), _value ); } | | int QueryIntAttribute( const std::string& name, int* _value ) const
{ return QueryIntAttribute( name.c_str(), _value ); } | |
| int QueryDoubleAttribute( const std::string& name, double* _value )
const { return QueryDoubleAttribute( name.c_str(), _value ); } | | int QueryDoubleAttribute( const std::string& name, double* _value )
const { return QueryDoubleAttribute( name.c_str(), _value ); } | |
| | | | |
| /// STL std::string form. | | /// STL std::string form. | |
|
| void SetAttribute( const std::string& name, const std::string& _valu | | void SetAttribute( const std::string& name, const std::string& _valu | |
| e ) | | e ); | |
| { | | | |
| StringToBuffer n( name ); | | | |
| StringToBuffer v( _value ); | | | |
| if ( n.buffer && v.buffer ) | | | |
| SetAttribute (n.buffer, v.buffer ); | | | |
| } | | | |
| ///< STL std::string form. | | ///< STL std::string form. | |
|
| void SetAttribute( const std::string& name, int _value ) | | void SetAttribute( const std::string& name, int _value ); | |
| { | | | |
| StringToBuffer n( name ); | | | |
| if ( n.buffer ) | | | |
| SetAttribute (n.buffer, _value); | | | |
| } | | | |
| #endif | | #endif | |
| | | | |
| /** Sets an attribute of name to a given value. The attribute | | /** Sets an attribute of name to a given value. The attribute | |
| will be created if it does not exist, or changed if it does. | | will be created if it does not exist, or changed if it does. | |
| */ | | */ | |
| void SetAttribute( const char * name, int value ); | | void SetAttribute( const char * name, int value ); | |
| | | | |
| /** Sets an attribute of name to a given value. The attribute | | /** Sets an attribute of name to a given value. The attribute | |
| will be created if it does not exist, or changed if it does. | | will be created if it does not exist, or changed if it does. | |
| */ | | */ | |
| | | | |
| skipping to change at line 989 | | skipping to change at line 972 | |
| /// Creates a new Element and returns it - the returned element is a
copy. | | /// Creates a new Element and returns it - the returned element is a
copy. | |
| virtual TiXmlNode* Clone() const; | | virtual TiXmlNode* Clone() const; | |
| // Print the Element to a FILE stream. | | // Print the Element to a FILE stream. | |
| virtual void Print( FILE* cfile, int depth ) const; | | virtual void Print( FILE* cfile, int depth ) const; | |
| | | | |
| /* Attribtue parsing starts: next char past '<' | | /* Attribtue parsing starts: next char past '<' | |
| returns: next char past '>' | | returns: next char past '>' | |
| */ | | */ | |
| virtual const char* Parse( const char* p, TiXmlParsingData* data, Ti
XmlEncoding encoding ); | | virtual const char* Parse( const char* p, TiXmlParsingData* data, Ti
XmlEncoding encoding ); | |
| | | | |
|
| | | virtual const TiXmlElement* ToElement() const { return this; | |
| | | } ///< Cast to a more defined type. Will return null not of the requested | |
| | | type. | |
| | | virtual TiXmlElement* ToElement() { return t | |
| | | his; } ///< Cast to a more defined type. Will return null not of the reques | |
| | | ted type. | |
| | | | |
| protected: | | protected: | |
| | | | |
| void CopyTo( TiXmlElement* target ) const; | | void CopyTo( TiXmlElement* target ) const; | |
| void ClearThis(); // like clear, but initializes 'this' object
as well | | void ClearThis(); // like clear, but initializes 'this' object
as well | |
| | | | |
| // Used to be public [internal use] | | // Used to be public [internal use] | |
| #ifdef TIXML_USE_STL | | #ifdef TIXML_USE_STL | |
| virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag ); | | virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag ); | |
| #endif | | #endif | |
| virtual void StreamOut( TIXML_OSTREAM * out ) const; | | virtual void StreamOut( TIXML_OSTREAM * out ) const; | |
| | | | |
| skipping to change at line 1033 | | skipping to change at line 1019 | |
| /// Returns a copy of this Comment. | | /// Returns a copy of this Comment. | |
| virtual TiXmlNode* Clone() const; | | virtual TiXmlNode* Clone() const; | |
| /// Write this Comment to a FILE stream. | | /// Write this Comment to a FILE stream. | |
| virtual void Print( FILE* cfile, int depth ) const; | | virtual void Print( FILE* cfile, int depth ) const; | |
| | | | |
| /* Attribtue parsing starts: at the ! of the !-- | | /* Attribtue parsing starts: at the ! of the !-- | |
| returns: next char past '>' | | returns: next char past '>' | |
| */ | | */ | |
| virtual const char* Parse( const char* p, TiXmlParsingData* data, Ti
XmlEncoding encoding ); | | virtual const char* Parse( const char* p, TiXmlParsingData* data, Ti
XmlEncoding encoding ); | |
| | | | |
|
| | | virtual const TiXmlComment* ToComment() const { return this; } ///< | |
| | | Cast to a more defined type. Will return null not of the requested type. | |
| | | virtual TiXmlComment* ToComment() { return this; } ///< Cast to a m | |
| | | ore defined type. Will return null not of the requested type. | |
| | | | |
| protected: | | protected: | |
| void CopyTo( TiXmlComment* target ) const; | | void CopyTo( TiXmlComment* target ) const; | |
| | | | |
| // used to be public | | // used to be public | |
| #ifdef TIXML_USE_STL | | #ifdef TIXML_USE_STL | |
| virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag ); | | virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag ); | |
| #endif | | #endif | |
| virtual void StreamOut( TIXML_OSTREAM * out ) const; | | virtual void StreamOut( TIXML_OSTREAM * out ) const; | |
| | | | |
| private: | | private: | |
| | | | |
| skipping to change at line 1088 | | skipping to change at line 1077 | |
| /// Write this text object to a FILE stream. | | /// Write this text object to a FILE stream. | |
| virtual void Print( FILE* cfile, int depth ) const; | | virtual void Print( FILE* cfile, int depth ) const; | |
| | | | |
| /// Queries whether this represents text using a CDATA section. | | /// Queries whether this represents text using a CDATA section. | |
| bool CDATA() { return cdata; } | | bool CDATA() { return cdata; } | |
| /// Turns on or off a CDATA representation of text. | | /// Turns on or off a CDATA representation of text. | |
| void SetCDATA( bool _cdata ) { cdata = _cdata; } | | void SetCDATA( bool _cdata ) { cdata = _cdata; } | |
| | | | |
| virtual const char* Parse( const char* p, TiXmlParsingData* data, Ti
XmlEncoding encoding ); | | virtual const char* Parse( const char* p, TiXmlParsingData* data, Ti
XmlEncoding encoding ); | |
| | | | |
|
| | | virtual const TiXmlText* ToText() const { return this; } ///< Cast t | |
| | | o a more defined type. Will return null not of the requested type. | |
| | | virtual TiXmlText* ToText() { return this; } ///< Cast t | |
| | | o a more defined type. Will return null not of the requested type. | |
| | | | |
| protected : | | protected : | |
| /// [internal use] Creates a new Element and returns it. | | /// [internal use] Creates a new Element and returns it. | |
| virtual TiXmlNode* Clone() const; | | virtual TiXmlNode* Clone() const; | |
| void CopyTo( TiXmlText* target ) const; | | void CopyTo( TiXmlText* target ) const; | |
| | | | |
| virtual void StreamOut ( TIXML_OSTREAM * out ) const; | | virtual void StreamOut ( TIXML_OSTREAM * out ) const; | |
| bool Blank() const; // returns true if all white space and new l
ines | | bool Blank() const; // returns true if all white space and new l
ines | |
| // [internal use] | | // [internal use] | |
| #ifdef TIXML_USE_STL | | #ifdef TIXML_USE_STL | |
| virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag ); | | virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag ); | |
| | | | |
| skipping to change at line 1154 | | skipping to change at line 1146 | |
| /// Is this a standalone document? | | /// Is this a standalone document? | |
| const char *Standalone() const { return standalone.c_str ()
; } | | const char *Standalone() const { return standalone.c_str ()
; } | |
| | | | |
| /// Creates a copy of this Declaration and returns it. | | /// Creates a copy of this Declaration and returns it. | |
| virtual TiXmlNode* Clone() const; | | virtual TiXmlNode* Clone() const; | |
| /// Print this declaration to a FILE stream. | | /// Print this declaration to a FILE stream. | |
| virtual void Print( FILE* cfile, int depth ) const; | | virtual void Print( FILE* cfile, int depth ) const; | |
| | | | |
| virtual const char* Parse( const char* p, TiXmlParsingData* data, Ti
XmlEncoding encoding ); | | virtual const char* Parse( const char* p, TiXmlParsingData* data, Ti
XmlEncoding encoding ); | |
| | | | |
|
| | | virtual const TiXmlDeclaration* ToDeclaration() const { return this; | |
| | | } ///< Cast to a more defined type. Will return null not of the requested | |
| | | type. | |
| | | virtual TiXmlDeclaration* ToDeclaration() { return this; | |
| | | } ///< Cast to a more defined type. Will return null not of the requested | |
| | | type. | |
| | | | |
| protected: | | protected: | |
| void CopyTo( TiXmlDeclaration* target ) const; | | void CopyTo( TiXmlDeclaration* target ) const; | |
| // used to be public | | // used to be public | |
| #ifdef TIXML_USE_STL | | #ifdef TIXML_USE_STL | |
| virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag ); | | virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag ); | |
| #endif | | #endif | |
| virtual void StreamOut ( TIXML_OSTREAM * out) const; | | virtual void StreamOut ( TIXML_OSTREAM * out) const; | |
| | | | |
| private: | | private: | |
| | | | |
| | | | |
| skipping to change at line 1192 | | skipping to change at line 1187 | |
| TiXmlUnknown( const TiXmlUnknown& copy ) : TiXmlNode( TiXmlNode::UNK
NOWN ) { copy.CopyTo( this ); } | | TiXmlUnknown( const TiXmlUnknown& copy ) : TiXmlNode( TiXmlNode::UNK
NOWN ) { copy.CopyTo( this ); } | |
| void operator=( const TiXmlUnknown& copy )
{ copy.CopyTo( this );
} | | void operator=( const TiXmlUnknown& copy )
{ copy.CopyTo( this );
} | |
| | | | |
| /// Creates a copy of this Unknown and returns it. | | /// Creates a copy of this Unknown and returns it. | |
| virtual TiXmlNode* Clone() const; | | virtual TiXmlNode* Clone() const; | |
| /// Print this Unknown to a FILE stream. | | /// Print this Unknown to a FILE stream. | |
| virtual void Print( FILE* cfile, int depth ) const; | | virtual void Print( FILE* cfile, int depth ) const; | |
| | | | |
| virtual const char* Parse( const char* p, TiXmlParsingData* data, Ti
XmlEncoding encoding ); | | virtual const char* Parse( const char* p, TiXmlParsingData* data, Ti
XmlEncoding encoding ); | |
| | | | |
|
| | | virtual const TiXmlUnknown* ToUnknown() const { return this; | |
| | | } ///< Cast to a more defined type. Will return null not of the requested | |
| | | type. | |
| | | virtual TiXmlUnknown* ToUnknown() { return this; } | |
| | | ///< Cast to a more defined type. Will return null not of the requested ty | |
| | | pe. | |
| | | | |
| protected: | | protected: | |
| void CopyTo( TiXmlUnknown* target ) const; | | void CopyTo( TiXmlUnknown* target ) const; | |
| | | | |
| #ifdef TIXML_USE_STL | | #ifdef TIXML_USE_STL | |
| virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag ); | | virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag ); | |
| #endif | | #endif | |
| virtual void StreamOut ( TIXML_OSTREAM * out ) const; | | virtual void StreamOut ( TIXML_OSTREAM * out ) const; | |
| | | | |
| private: | | private: | |
| | | | |
| | | | |
| skipping to change at line 1237 | | skipping to change at line 1235 | |
| Returns true if successful. Will delete any existing | | Returns true if successful. Will delete any existing | |
| document data before loading. | | document data before loading. | |
| */ | | */ | |
| bool LoadFile( TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); | | bool LoadFile( TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); | |
| /// Save a file using the current document value. Returns true if su
ccessful. | | /// Save a file using the current document value. Returns true if su
ccessful. | |
| bool SaveFile() const; | | bool SaveFile() const; | |
| /// Load a file using the given filename. Returns true if successful
. | | /// Load a file using the given filename. Returns true if successful
. | |
| bool LoadFile( const char * filename, TiXmlEncoding encoding = TIXML
_DEFAULT_ENCODING ); | | bool LoadFile( const char * filename, TiXmlEncoding encoding = TIXML
_DEFAULT_ENCODING ); | |
| /// Save a file using the given filename. Returns true if successful
. | | /// Save a file using the given filename. Returns true if successful
. | |
| bool SaveFile( const char * filename ) const; | | bool SaveFile( const char * filename ) const; | |
|
| | | /** Load a file using the given FILE*. Returns true if successful. N | |
| | | ote that this method | |
| | | doesn't stream - the entire object pointed at by the FILE* | |
| | | will be interpreted as an XML file. TinyXML doesn't stream i | |
| | | n XML from the current | |
| | | file location. Streaming may be added in the future. | |
| | | */ | |
| | | bool LoadFile( FILE*, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODIN | |
| | | G ); | |
| | | /// Save a file using the given FILE*. Returns true if successful. | |
| | | bool SaveFile( FILE* ) const; | |
| | | | |
| #ifdef TIXML_USE_STL | | #ifdef TIXML_USE_STL | |
| bool LoadFile( const std::string& filename, TiXmlEncoding encoding =
TIXML_DEFAULT_ENCODING ) ///< STL std::string version. | | bool LoadFile( const std::string& filename, TiXmlEncoding encoding =
TIXML_DEFAULT_ENCODING ) ///< STL std::string version. | |
| { | | { | |
| StringToBuffer f( filename ); | | StringToBuffer f( filename ); | |
| return ( f.buffer && LoadFile( f.buffer, encoding )); | | return ( f.buffer && LoadFile( f.buffer, encoding )); | |
| } | | } | |
| bool SaveFile( const std::string& filename ) const ///<
STL std::string version. | | bool SaveFile( const std::string& filename ) const ///<
STL std::string version. | |
| { | | { | |
| StringToBuffer f( filename ); | | StringToBuffer f( filename ); | |
| | | | |
| skipping to change at line 1335 | | skipping to change at line 1341 | |
|
} | |
} | |
| | | | |
| /** Dump the document to standard out. */ | | /** Dump the document to standard out. */ | |
| void Print() const { Pr
int( stdout, 0 ); } | | void Print() const { Pr
int( stdout, 0 ); } | |
| | | | |
| /// Print this Document to a FILE stream. | | /// Print this Document to a FILE stream. | |
| virtual void Print( FILE* cfile, int depth = 0 ) const; | | virtual void Print( FILE* cfile, int depth = 0 ) const; | |
| // [internal use] | | // [internal use] | |
| void SetError( int err, const char* errorLocation, TiXmlParsingData*
prevData, TiXmlEncoding encoding ); | | void SetError( int err, const char* errorLocation, TiXmlParsingData*
prevData, TiXmlEncoding encoding ); | |
| | | | |
|
| | | virtual const TiXmlDocument* ToDocument() const { return this; | |
| | | } ///< Cast to a more defined type. Will return null not of the requested | |
| | | type. | |
| | | virtual TiXmlDocument* ToDocument() { return this; | |
| | | } ///< Cast to a more defined type. Will return null not of the requested | |
| | | type. | |
| | | | |
| protected : | | protected : | |
| virtual void StreamOut ( TIXML_OSTREAM * out) const; | | virtual void StreamOut ( TIXML_OSTREAM * out) const; | |
| // [internal use] | | // [internal use] | |
| virtual TiXmlNode* Clone() const; | | virtual TiXmlNode* Clone() const; | |
| #ifdef TIXML_USE_STL | | #ifdef TIXML_USE_STL | |
| virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag ); | | virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag ); | |
| #endif | | #endif | |
| | | | |
| private: | | private: | |
| void CopyTo( TiXmlDocument* target ) const; | | void CopyTo( TiXmlDocument* target ) const; | |
| | | | |
End of changes. 20 change blocks. |
| 76 lines changed or deleted | | 106 lines changed or added | |
|