| tinyxml.h | | tinyxml.h | |
| | | | |
| skipping to change at line 123 | | skipping to change at line 123 | |
| A Decleration contains: Attributes (not on tree) | | A Decleration contains: Attributes (not on tree) | |
| @endverbatim | | @endverbatim | |
| */ | | */ | |
| class TiXmlBase | | class TiXmlBase | |
| { | | { | |
| friend class TiXmlNode; | | friend class TiXmlNode; | |
| friend class TiXmlElement; | | friend class TiXmlElement; | |
| friend class TiXmlDocument; | | friend class TiXmlDocument; | |
| | | | |
| public: | | public: | |
|
| TiXmlBase()
{} | | TiXmlBase()
{userData = 0;} | |
| virtual ~TiXmlBase() {} | | virtual ~TiXmlBase() {} | |
| | | | |
| /** All TinyXml classes can print themselves to a filestream. | | /** All TinyXml classes can print themselves to a filestream. | |
| This is a formatted print, and will insert tabs and newlines
. | | This is a formatted print, and will insert tabs and newlines
. | |
| | | | |
| (For an unformatted stream, use the << operator.) | | (For an unformatted stream, use the << operator.) | |
| */ | | */ | |
| virtual void Print( FILE* cfile, int depth ) const = 0; | | virtual void Print( FILE* cfile, int depth ) const = 0; | |
| | | | |
| /** The world does not agree on whether white space should be ke
pt or | | /** The world does not agree on whether white space should be ke
pt or | |
| | | | |
| skipping to change at line 165 | | skipping to change at line 165 | |
| reflect changes in the document. | | reflect changes in the document. | |
| | | | |
| There is a minor performance cost to computing the row and c
olumn. Computation | | There is a minor performance cost to computing the row and c
olumn. Computation | |
| can be disabled if TiXmlDocument::SetTabSize() is called wit
h 0 as the value. | | can be disabled if TiXmlDocument::SetTabSize() is called wit
h 0 as the value. | |
| | | | |
| @sa TiXmlDocument::SetTabSize() | | @sa TiXmlDocument::SetTabSize() | |
| */ | | */ | |
| int Row() const { return location.row + 1; } | | int Row() const { return location.row + 1; } | |
| int Column() const { return location.col + 1; } ///<
See Row() | | int Column() const { return location.col + 1; } ///<
See Row() | |
| | | | |
|
| | | void SetUserData( void* user ) { userData = user; } | |
| | | void* GetUserData() { re | |
| | | turn userData; } | |
| | | | |
| | | // Table that returs, for a given lead byte, the total number of byt | |
| | | es | |
| | | // in the UTF-8 sequence. | |
| | | static const int utf8ByteTable[256]; | |
| | | | |
| protected: | | protected: | |
|
| | | | |
| // See STL_STRING_BUG | | // See STL_STRING_BUG | |
| // Utility class to overcome a bug. | | // Utility class to overcome a bug. | |
| class StringToBuffer | | class StringToBuffer | |
| { | | { | |
| public: | | public: | |
| StringToBuffer( const TIXML_STRING& str ); | | StringToBuffer( const TIXML_STRING& str ); | |
| ~StringToBuffer(); | | ~StringToBuffer(); | |
| char* buffer; | | char* buffer; | |
| }; | | }; | |
| | | | |
| | | | |
| skipping to change at line 177 | | skipping to change at line 185 | |
| // Utility class to overcome a bug. | | // Utility class to overcome a bug. | |
| class StringToBuffer | | class StringToBuffer | |
| { | | { | |
| public: | | public: | |
| StringToBuffer( const TIXML_STRING& str ); | | StringToBuffer( const TIXML_STRING& str ); | |
| ~StringToBuffer(); | | ~StringToBuffer(); | |
| char* buffer; | | char* buffer; | |
| }; | | }; | |
| | | | |
| static const char* SkipWhiteSpace( const char* ); | | static const char* SkipWhiteSpace( const char* ); | |
|
| inline static bool IsWhiteSpace( int c ) { return ( i | | inline static bool IsWhiteSpace( char c ) | |
| sspace( c ) || c == '\n' || c == '\r' ); } | | { | |
| | | return ( isspace( (unsigned char) c ) || c == '\n' || c == ' | |
| | | \r' ); | |
| | | } | |
| | | | |
| 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 204 | | skipping to change at line 215 | |
| */ | | */ | |
| static const char* ReadText( const char* in,
// where to start | | static const char* ReadText( const char* in,
// where to start | |
| TIXM
L_STRING* text, // the string read | | TIXM
L_STRING* text, // the string read | |
| bool
ignoreWhiteSpace, // whether to keep the white space | | bool
ignoreWhiteSpace, // whether to keep the white space | |
| cons
t char* endTag, // what ends this text | | cons
t char* endTag, // what ends this text | |
| bool
ignoreCase ); // whether to ignore case in the end ta
g | | bool
ignoreCase ); // whether to ignore case in the end ta
g | |
| | | | |
| virtual const char* Parse( const char* p, TiXmlParsingData* data ) =
0; | | virtual const char* Parse( const char* p, TiXmlParsingData* data ) =
0; | |
| | | | |
| // If an entity has been found, transform it into a character. | | // If an entity has been found, transform it into a character. | |
|
| static const char* GetEntity( const char* in, char* value ); | | static const char* GetEntity( const char* in, char* value, int* leng
th ); | |
| | | | |
| // Get a character, while interpreting entities. | | // Get a character, while interpreting entities. | |
|
| inline static const char* GetChar( const char* p, char* _value ) | | // The length can be from 0 to 4 bytes. | |
| | | inline static const char* GetCharUTF8( const char* p, char* _value, | |
| | | int* length ) | |
| { | | { | |
| assert( p ); | | assert( p ); | |
|
| if ( *p == '&' ) | | *length = utf8ByteTable[ *((unsigned char*)p) ]; | |
| | | assert( *length >= 0 && *length < 5 ); | |
| | | | |
| | | if ( *length == 1 ) | |
| { | | { | |
|
| return GetEntity( p, _value ); | | if ( *p == '&' ) | |
| | | return GetEntity( p, _value, length ); | |
| | | *_value = *p; | |
| | | return p+1; | |
| | | } | |
| | | else if ( *length ) | |
| | | { | |
| | | strncpy( _value, p, *length ); | |
| | | return p + (*length); | |
| } | | } | |
| else | | else | |
| { | | { | |
|
| *_value = *p; | | // Not valid text. | |
| return p+1; | | return 0; | |
| } | | } | |
| } | | } | |
| | | | |
| // Puts a string to a stream, expanding entities as it goes. | | // Puts a string to a stream, expanding entities as it goes. | |
| // Note this should not contian the '<', '>', etc, or they will be t
ransformed into entities! | | // Note this should not contian the '<', '>', etc, or they will be t
ransformed into entities! | |
| static void PutString( const TIXML_STRING& str, TIXML_OSTREAM* out )
; | | static void PutString( const TIXML_STRING& str, TIXML_OSTREAM* out )
; | |
| | | | |
| static void PutString( const TIXML_STRING& str, TIXML_STRING* out ); | | static void PutString( const TIXML_STRING& str, TIXML_STRING* out ); | |
| | | | |
| // Return true if the next characters in the stream are any of the e
ndTag sequences. | | // Return true if the next characters in the stream are any of the e
ndTag sequences. | |
|
| | | // Ignore case only works for english, and should only be relied on | |
| | | when comparing | |
| | | // to Engilish words: StringEqual( p, "version", true ) is fine. | |
| static bool StringEqual( const char* p, | | static bool StringEqual( const char* p, | |
| const char*
endTag, | | const char*
endTag, | |
| bool ignoreC
ase ); | | bool ignoreC
ase ); | |
| | | | |
| enum | | enum | |
| { | | { | |
| TIXML_NO_ERROR = 0, | | TIXML_NO_ERROR = 0, | |
| TIXML_ERROR, | | TIXML_ERROR, | |
| TIXML_ERROR_OPENING_FILE, | | TIXML_ERROR_OPENING_FILE, | |
| TIXML_ERROR_OUT_OF_MEMORY, | | TIXML_ERROR_OUT_OF_MEMORY, | |
| | | | |
| skipping to change at line 255 | | skipping to change at line 280 | |
| TIXML_ERROR_PARSING_COMMENT, | | TIXML_ERROR_PARSING_COMMENT, | |
| TIXML_ERROR_PARSING_DECLARATION, | | TIXML_ERROR_PARSING_DECLARATION, | |
| TIXML_ERROR_DOCUMENT_EMPTY, | | TIXML_ERROR_DOCUMENT_EMPTY, | |
| | | | |
| TIXML_ERROR_STRING_COUNT | | TIXML_ERROR_STRING_COUNT | |
| }; | | }; | |
| static const char* errorString[ TIXML_ERROR_STRING_COUNT ]; | | static const char* errorString[ TIXML_ERROR_STRING_COUNT ]; | |
| | | | |
| TiXmlCursor location; | | TiXmlCursor location; | |
| | | | |
|
| | | /// Field containing a generic user pointer | |
| | | void* userData; | |
| | | | |
| | | // None of these methods are reliable for any language except Englis | |
| | | h. | |
| | | // Good for approximation, not great for accuracy. | |
| | | static int IsAlphaUTF8( unsigned char anyByte ); | |
| | | static int IsAlphaNumUTF8( unsigned char anyByte ); | |
| | | inline static int ToLowerUTF8( int v ) | |
| | | { | |
| | | if ( v < 128 ) return tolower( v ); | |
| | | return v; | |
| | | } | |
| | | static void ConvertUTF32ToUTF8( unsigned long input, char* output, i | |
| | | nt* length ); | |
| | | | |
| private: | | private: | |
|
| | | TiXmlBase( const TiXmlBase& ); // not imple | |
| | | mented. | |
| | | void operator=( const TiXmlBase& base ); // not allowed. | |
| | | | |
| struct Entity | | struct Entity | |
| { | | { | |
| const char* str; | | const char* str; | |
| unsigned int strLength; | | unsigned int strLength; | |
| char chr; | | char chr; | |
| }; | | }; | |
| enum | | enum | |
| { | | { | |
| NUM_ENTITY = 5, | | NUM_ENTITY = 5, | |
| MAX_ENTITY_LENGTH = 6 | | MAX_ENTITY_LENGTH = 6 | |
| | | | |
| skipping to change at line 509 | | skipping to change at line 551 | |
| | | | |
| TiXmlDocument* ToDocument() const { return ( this && t
ype == DOCUMENT ) ? (TiXmlDocument*) this : 0; } ///< Cast to a more define
d type. Will return null not of the requested type. | | TiXmlDocument* ToDocument() const { return ( this && t
ype == DOCUMENT ) ? (TiXmlDocument*) this : 0; } ///< Cast to a more define
d type. Will return null not of the requested type. | |
| TiXmlElement* ToElement() const { return ( this && t
ype == ELEMENT ) ? (TiXmlElement*) this : 0; } ///< Cast to a more define
d type. Will return null not of the requested type. | | TiXmlElement* ToElement() const { return ( this && t
ype == ELEMENT ) ? (TiXmlElement*) this : 0; } ///< Cast to a more define
d type. Will return null not of the requested type. | |
| TiXmlComment* ToComment() const { return ( this && t
ype == COMMENT ) ? (TiXmlComment*) this : 0; } ///< Cast to a more define
d type. Will return null not of the requested type. | | TiXmlComment* ToComment() const { return ( this && t
ype == COMMENT ) ? (TiXmlComment*) this : 0; } ///< Cast to a more define
d type. Will return null not of the requested type. | |
| TiXmlUnknown* ToUnknown() const { return ( this && t
ype == UNKNOWN ) ? (TiXmlUnknown*) this : 0; } ///< Cast to a more define
d type. Will return null not of the requested type. | | TiXmlUnknown* ToUnknown() const { return ( this && t
ype == UNKNOWN ) ? (TiXmlUnknown*) this : 0; } ///< Cast to a more define
d type. Will return null not of the requested type. | |
| TiXmlText* ToText() const { return ( this && t
ype == TEXT ) ? (TiXmlText*) this : 0; } ///< Cast to a more define
d type. Will return null not of the requested type. | | TiXmlText* ToText() const { return ( this && t
ype == TEXT ) ? (TiXmlText*) this : 0; } ///< Cast to a more define
d type. Will return null not of the requested type. | |
| TiXmlDeclaration* ToDeclaration() const { return ( this && type == D
ECLARATION ) ? (TiXmlDeclaration*) this : 0; } ///< Cast to a more defined
type. Will return null not of the requested type. | | TiXmlDeclaration* ToDeclaration() const { return ( this && type == D
ECLARATION ) ? (TiXmlDeclaration*) this : 0; } ///< Cast to a more defined
type. Will return null not of the requested type. | |
| | | | |
| virtual TiXmlNode* Clone() const = 0; | | virtual TiXmlNode* Clone() const = 0; | |
| | | | |
|
| void SetUserData( void* user ) { userData = user; } | | | |
| void* GetUserData() { re | | | |
| turn userData; } | | | |
| | | | |
| protected: | | protected: | |
|
| TiXmlNode( NodeType type ); | | TiXmlNode( NodeType _type ); | |
| | | | |
| #ifdef TIXML_USE_STL | | #ifdef TIXML_USE_STL | |
| // The real work of the input operator. | | // The real work of the input operator. | |
| virtual void StreamIn( TIXML_ISTREAM* in, TIXML_STRING* tag ) =
0; | | virtual void StreamIn( TIXML_ISTREAM* in, TIXML_STRING* tag ) =
0; | |
| #endif | | #endif | |
| | | | |
| // Figure out what is at *p, and parse it. Returns null if it is not
an xml node. | | // Figure out what is at *p, and parse it. Returns null if it is not
an xml node. | |
| TiXmlNode* Identify( const char* start ); | | TiXmlNode* Identify( const char* start ); | |
| void CopyToClone( TiXmlNode* target ) const { target->SetValue (
value.c_str() ); | | void CopyToClone( TiXmlNode* target ) const { target->SetValue (
value.c_str() ); | |
|
target->userData = userData; } | |
target->userData = userData; } | |
| | | | |
| // Internal Value function returning a TIXML_STRING | | // Internal Value function returning a TIXML_STRING | |
|
| TIXML_STRING SValue() const { return value ; } | | const TIXML_STRING& SValue() const { return value ; } | |
| | | | |
| TiXmlNode* parent; | | TiXmlNode* parent; | |
| NodeType type; | | NodeType type; | |
| | | | |
| TiXmlNode* firstChild; | | TiXmlNode* firstChild; | |
| TiXmlNode* lastChild; | | TiXmlNode* lastChild; | |
| | | | |
| TIXML_STRING value; | | TIXML_STRING value; | |
| | | | |
| TiXmlNode* prev; | | TiXmlNode* prev; | |
| TiXmlNode* next; | | TiXmlNode* next; | |
|
| void* userData; | | | |
| | | private: | |
| | | TiXmlNode( const TiXmlNode& ); // not imple | |
| | | mented. | |
| | | void operator=( const TiXmlNode& base ); // not allowed. | |
| }; | | }; | |
| | | | |
| /** An attribute is a name-value pair. Elements have an arbitrary | | /** An attribute is a name-value pair. Elements have an arbitrary | |
| number of attributes, each with a unique name. | | number of attributes, each with a unique name. | |
| | | | |
| @note The attributes are not TiXmlNodes, since they are not | | @note The attributes are not TiXmlNodes, since they are not | |
| part of the tinyXML document object model. There are other | | part of the tinyXML document object model. There are other | |
| suggested ways to look at this problem. | | suggested ways to look at this problem. | |
| */ | | */ | |
| class TiXmlAttribute : public TiXmlBase | | class TiXmlAttribute : public TiXmlBase | |
| { | | { | |
| friend class TiXmlAttributeSet; | | friend class TiXmlAttributeSet; | |
| | | | |
| public: | | public: | |
| /// Construct an empty attribute. | | /// Construct an empty attribute. | |
|
| TiXmlAttribute() | | TiXmlAttribute() : TiXmlBase() | |
| { | | { | |
| document = 0; | | document = 0; | |
| prev = next = 0; | | prev = next = 0; | |
| } | | } | |
| | | | |
| #ifdef TIXML_USE_STL | | #ifdef TIXML_USE_STL | |
| /// std::string constructor. | | /// std::string constructor. | |
| TiXmlAttribute( const std::string& _name, const std::string& _value
) | | TiXmlAttribute( const std::string& _name, const std::string& _value
) | |
| { | | { | |
| name = _name; | | name = _name; | |
| | | | |
| skipping to change at line 643 | | skipping to change at line 685 | |
| | | | |
| // [internal use] | | // [internal use] | |
| virtual void Print( FILE* cfile, int depth ) const; | | virtual void Print( FILE* cfile, int depth ) const; | |
| | | | |
| virtual void StreamOut( TIXML_OSTREAM * out ) const; | | virtual void StreamOut( TIXML_OSTREAM * out ) const; | |
| // [internal use] | | // [internal use] | |
| // Set the document pointer so the attribute can report errors. | | // Set the document pointer so the attribute can report errors. | |
| void SetDocument( TiXmlDocument* doc ) { document = doc; } | | void SetDocument( TiXmlDocument* doc ) { document = doc; } | |
| | | | |
| private: | | private: | |
|
| | | TiXmlAttribute( const TiXmlAttribute& ); | |
| | | // not implemented. | |
| | | void operator=( const TiXmlAttribute& base ); // not allowed. | |
| | | | |
| TiXmlDocument* document; // A pointer back to a document, for
error reporting. | | TiXmlDocument* document; // A pointer back to a document, for
error reporting. | |
| TIXML_STRING name; | | TIXML_STRING name; | |
| TIXML_STRING value; | | TIXML_STRING value; | |
| TiXmlAttribute* prev; | | TiXmlAttribute* prev; | |
| TiXmlAttribute* next; | | TiXmlAttribute* next; | |
| }; | | }; | |
| | | | |
| /* A class used to manage a group of attributes. | | /* A class used to manage a group of attributes. | |
| It is only used internally, both by the ELEMENT and the DECLARATION. | | It is only used internally, both by the ELEMENT and the DECLARATION. | |
| | | | |
| | | | |
| skipping to change at line 763 | | skipping to change at line 808 | |
| if ( n.buffer ) | | if ( n.buffer ) | |
| SetAttribute (n.buffer, _value); | | 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 | |
| | | will be created if it does not exist, or changed if it does. | |
| | | */ | |
| | | void SetDoubleAttribute( const char * name, double value ); | |
| | | | |
| /** Deletes an attribute with the given name. | | /** Deletes an attribute with the given name. | |
| */ | | */ | |
| void RemoveAttribute( const char * name ); | | void RemoveAttribute( const char * name ); | |
| #ifdef TIXML_USE_STL | | #ifdef TIXML_USE_STL | |
| void RemoveAttribute( const std::string& name ) { RemoveAttrib
ute (name.c_str ()); } ///< STL std::string form. | | void RemoveAttribute( const std::string& name ) { RemoveAttrib
ute (name.c_str ()); } ///< STL std::string form. | |
| #endif | | #endif | |
| | | | |
| TiXmlAttribute* FirstAttribute() const { return attributeSet.First(
); } ///< Access the first attribute in this element. | | TiXmlAttribute* FirstAttribute() const { return attributeSet.First(
); } ///< Access the first attribute in this element. | |
| TiXmlAttribute* LastAttribute() const { return attributeSet.Last()
; } ///< Access the last attribute in this element. | | TiXmlAttribute* LastAttribute() const { return attributeSet.Last()
; } ///< Access the last attribute in this element. | |
| | | | |
| | | | |
| skipping to change at line 800 | | skipping to change at line 850 | |
| */ | | */ | |
| virtual const char* Parse( const char* p, TiXmlParsingData* data ); | | virtual const char* Parse( const char* p, TiXmlParsingData* data ); | |
| | | | |
| /* [internal use] | | /* [internal use] | |
| Reads the "value" of the element -- another element, or text
. | | Reads the "value" of the element -- another element, or text
. | |
| This should terminate with the current end tag. | | This should terminate with the current end tag. | |
| */ | | */ | |
| const char* ReadValue( const char* in, TiXmlParsingData* prevData ); | | const char* ReadValue( const char* in, TiXmlParsingData* prevData ); | |
| | | | |
| private: | | private: | |
|
| | | TiXmlElement( const TiXmlElement& ); // n | |
| | | ot implemented. | |
| | | void operator=( const TiXmlElement& base ); // not allowed. | |
| | | | |
| TiXmlAttributeSet attributeSet; | | TiXmlAttributeSet attributeSet; | |
| }; | | }; | |
| | | | |
| /** An XML comment. | | /** An XML comment. | |
| */ | | */ | |
| class TiXmlComment : public TiXmlNode | | class TiXmlComment : public TiXmlNode | |
| { | | { | |
| public: | | public: | |
| /// Constructs an empty comment. | | /// Constructs an empty comment. | |
| TiXmlComment() : TiXmlNode( TiXmlNode::COMMENT ) {} | | TiXmlComment() : TiXmlNode( TiXmlNode::COMMENT ) {} | |
| | | | |
| skipping to change at line 827 | | skipping to change at line 881 | |
| // 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; | |
| /* [internal use] | | /* [internal use] | |
| 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 ); | | virtual const char* Parse( const char* p, TiXmlParsingData* data ); | |
|
| | | | |
| | | private: | |
| | | TiXmlComment( const TiXmlComment& ); // n | |
| | | ot implemented. | |
| | | void operator=( const TiXmlComment& base ); // not allowed. | |
| | | | |
| }; | | }; | |
| | | | |
| /** XML text. Contained in an element. | | /** XML text. Contained in an element. | |
| */ | | */ | |
| class TiXmlText : public TiXmlNode | | class TiXmlText : public TiXmlNode | |
| { | | { | |
| friend class TiXmlElement; | | friend class TiXmlElement; | |
| public: | | public: | |
| /// Constructor. | | /// Constructor. | |
| TiXmlText (const char * initValue) : TiXmlNode (TiXmlNode::TEXT) | | TiXmlText (const char * initValue) : TiXmlNode (TiXmlNode::TEXT) | |
| | | | |
| skipping to change at line 868 | | skipping to change at line 927 | |
| 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] | |
| Attribtue parsing starts: First char of the text | | Attribtue parsing starts: First char of the text | |
| returns: next char
past '>' | | returns: next char
past '>' | |
| */ | | */ | |
| virtual const char* Parse( const char* p, TiXmlParsingData* data ); | | virtual const char* Parse( const char* p, TiXmlParsingData* data ); | |
| // [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 ); | |
| #endif | | #endif | |
|
| | | | |
| | | private: | |
| | | TiXmlText( const TiXmlText& ); // not imple | |
| | | mented. | |
| | | void operator=( const TiXmlText& base ); // not allowed. | |
| }; | | }; | |
| | | | |
| /** In correct XML the declaration is the first entry in the file. | | /** In correct XML the declaration is the first entry in the file. | |
| @verbatim | | @verbatim | |
| <?xml version="1.0" standalone="yes"?> | | <?xml version="1.0" standalone="yes"?> | |
| @endverbatim | | @endverbatim | |
| | | | |
| TinyXml will happily read or write files without a declaration, | | TinyXml will happily read or write files without a declaration, | |
| however. There are 3 possible attributes to the declaration: | | however. There are 3 possible attributes to the declaration: | |
| version, encoding, and standalone. | | version, encoding, and standalone. | |
| | | | |
| skipping to change at line 934 | | skipping to change at line 997 | |
| 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; | |
| // [internal use] | | // [internal use] | |
| // 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 ); | | virtual const char* Parse( const char* p, TiXmlParsingData* data ); | |
| | | | |
| private: | | private: | |
|
| | | TiXmlDeclaration( const TiXmlDeclaration& copy ); | |
| | | void operator=( const TiXmlDeclaration& copy ); | |
| | | | |
| TIXML_STRING version; | | TIXML_STRING version; | |
| TIXML_STRING encoding; | | TIXML_STRING encoding; | |
| TIXML_STRING standalone; | | TIXML_STRING standalone; | |
| }; | | }; | |
| | | | |
| /** Any tag that tinyXml doesn't recognize is saved as an | | /** Any tag that tinyXml doesn't recognize is saved as an | |
| unknown. It is a tag of text, but should not be modified. | | unknown. It is a tag of text, but should not be modified. | |
| It will be written back to the XML, unchanged, when the file | | It will be written back to the XML, unchanged, when the file | |
| is saved. | | is saved. | |
|
| | | | |
| | | DTD tags get thrown into TiXmlUnknowns. | |
| */ | | */ | |
| class TiXmlUnknown : public TiXmlNode | | class TiXmlUnknown : public TiXmlNode | |
| { | | { | |
| public: | | public: | |
| TiXmlUnknown() : TiXmlNode( TiXmlNode::UNKNOWN ) {} | | TiXmlUnknown() : TiXmlNode( TiXmlNode::UNKNOWN ) {} | |
| virtual ~TiXmlUnknown() {} | | virtual ~TiXmlUnknown() {} | |
| | | | |
| // [internal use] | | // [internal use] | |
| virtual TiXmlNode* Clone() const; | | virtual TiXmlNode* Clone() const; | |
| // [internal use] | | // [internal use] | |
| | | | |
| skipping to change at line 964 | | skipping to change at line 1032 | |
| protected: | | protected: | |
| #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; | |
| /* [internal use] | | /* [internal use] | |
| Attribute parsing starts: First char of the text | | Attribute parsing starts: First char of the text | |
| returns: next char past '>' | | returns: next char past '>' | |
| */ | | */ | |
| virtual const char* Parse( const char* p, TiXmlParsingData* data ); | | virtual const char* Parse( const char* p, TiXmlParsingData* data ); | |
|
| | | | |
| | | private: | |
| | | TiXmlUnknown( const TiXmlUnknown& copy ); | |
| | | void operator=( const TiXmlUnknown& copy ); | |
| | | | |
| }; | | }; | |
| | | | |
| /** Always the top level node. A document binds together all the | | /** Always the top level node. A document binds together all the | |
| XML pieces. It can be saved, loaded, and printed to the screen. | | XML pieces. It can be saved, loaded, and printed to the screen. | |
| The 'value' of a document node is the xml file name. | | The 'value' of a document node is the xml file name. | |
| */ | | */ | |
| class TiXmlDocument : public TiXmlNode | | class TiXmlDocument : public TiXmlNode | |
| { | | { | |
| public: | | public: | |
| /// Create an empty document, that has no name. | | /// Create an empty document, that has no name. | |
| | | | |
| skipping to change at line 1101 | | skipping to change at line 1174 | |
| | | | |
| 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: | |
|
| | | TiXmlDocument( const TiXmlDocument& copy ); | |
| | | void operator=( const TiXmlDocument& copy ); | |
| | | | |
| bool error; | | bool error; | |
| int errorId; | | int errorId; | |
| TIXML_STRING errorDesc; | | TIXML_STRING errorDesc; | |
| int tabsize; | | int tabsize; | |
| TiXmlCursor errorLocation; | | TiXmlCursor errorLocation; | |
| }; | | }; | |
| | | | |
| /** | | /** | |
| A TiXmlHandle is a class that wraps a node pointer with null checks;
this is | | A TiXmlHandle is a class that wraps a node pointer with null checks;
this is | |
| an incredibly useful thing. Note that TiXmlHandle is not part of the
TinyXml | | an incredibly useful thing. Note that TiXmlHandle is not part of the
TinyXml | |
| | | | |
| skipping to change at line 1192 | | skipping to change at line 1268 | |
| for( child; child; child=child->NextSiblingElement() ) | | for( child; child; child=child->NextSiblingElement() ) | |
| { | | { | |
| // do something | | // do something | |
| } | | } | |
| @endverbatim | | @endverbatim | |
| */ | | */ | |
| class TiXmlHandle | | class TiXmlHandle | |
| { | | { | |
| public: | | public: | |
| /// Create a handle from any node (at any depth of the tree.) This c
an be a null pointer. | | /// Create a handle from any node (at any depth of the tree.) This c
an be a null pointer. | |
|
| TiXmlHandle( TiXmlNode* node ) { this->node = node;
} | | TiXmlHandle( TiXmlNode* node ) { th
is->node = node; } | |
| /// Copy constructor | | /// Copy constructor | |
|
| TiXmlHandle( const TiXmlHandle& ref ) { this->node = ref.node; } | | TiXmlHandle( const TiXmlHandle& ref ) { this->node | |
| | | = ref.node; } | |
| | | TiXmlHandle operator=( const TiXmlHandle& ref ) { this->node = ref.n | |
| | | ode; return *this; } | |
| | | | |
| /// Return a handle to the first child node. | | /// Return a handle to the first child node. | |
| TiXmlHandle FirstChild() const; | | TiXmlHandle FirstChild() const; | |
| /// Return a handle to the first child node with the given name. | | /// Return a handle to the first child node with the given name. | |
| TiXmlHandle FirstChild( const char * value ) const; | | TiXmlHandle FirstChild( const char * value ) const; | |
| /// Return a handle to the first child element. | | /// Return a handle to the first child element. | |
| TiXmlHandle FirstChildElement() const; | | TiXmlHandle FirstChildElement() const; | |
| /// Return a handle to the first child element with the given name. | | /// Return a handle to the first child element with the given name. | |
| TiXmlHandle FirstChildElement( const char * value ) const; | | TiXmlHandle FirstChildElement( const char * value ) const; | |
| | | | |
| | | | |
| skipping to change at line 1225 | | skipping to change at line 1302 | |
| are indexed: other types are not counted. | | are indexed: other types are not counted. | |
| */ | | */ | |
| TiXmlHandle ChildElement( const char* value, int index ) const; | | TiXmlHandle ChildElement( const char* value, int index ) const; | |
| /** Return a handle to the "index" child element. | | /** Return a handle to the "index" child element. | |
| The first child element is 0, the second 1, etc. Note that o
nly TiXmlElements | | The first child element is 0, the second 1, etc. Note that o
nly TiXmlElements | |
| are indexed: other types are not counted. | | are indexed: other types are not counted. | |
| */ | | */ | |
| TiXmlHandle ChildElement( int index ) const; | | TiXmlHandle ChildElement( int index ) const; | |
| | | | |
| #ifdef TIXML_USE_STL | | #ifdef TIXML_USE_STL | |
|
| TiXmlHandle FirstChild( const std::string& _value ) const
{ return FirstChild( _value.c_str() ); } | | TiXmlHandle FirstChild( const std::string& _value ) const
{ return FirstChild( _value.c_str() ); } | |
| TiXmlHandle FirstChildElement( const std::string& _value ) const
{ return FirstChildElement( _value.c_str() ); } | | TiXmlHandle FirstChildElement( const std::string& _value ) const
{ return FirstChildElement( _value.c_str() ); } | |
| | | | |
| TiXmlHandle Child( const std::string& _value, int index ) const
{ return Child( _value.c_str(), index ); } | | TiXmlHandle Child( const std::string& _value, int index ) const
{ return Child( _value.c_str(), index ); } | |
| TiXmlHandle ChildElement( const std::string& _value, int index ) con
st { return ChildElement( _value.c_str(), index ); } | | TiXmlHandle ChildElement( const std::string& _value, int index ) con
st { return ChildElement( _value.c_str(), index ); } | |
| #endif | | #endif | |
| | | | |
| /// Return the handle as a TiXmlNode. This may return null. | | /// Return the handle as a TiXmlNode. This may return null. | |
| TiXmlNode* Node() const { return node; } | | TiXmlNode* Node() const { return node; } | |
| /// Return the handle as a TiXmlElement. This may return null. | | /// Return the handle as a TiXmlElement. This may return null. | |
| TiXmlElement* Element() const { return ( ( node && node->ToElement
() ) ? node->ToElement() : 0 ); } | | TiXmlElement* Element() const { return ( ( node && node->ToElement
() ) ? node->ToElement() : 0 ); } | |
| /// Return the handle as a TiXmlText. This may return null. | | /// Return the handle as a TiXmlText. This may return null. | |
| TiXmlText* Text() const { return ( ( node && node->T
oText() ) ? node->ToText() : 0 ); } | | TiXmlText* Text() const { return ( ( node && node->T
oText() ) ? node->ToText() : 0 ); } | |
|
| | | /// Return the handle as a TiXmlUnknown. This may return null; | |
| | | TiXmlUnknown* Unknown() const { return ( ( node && | |
| | | node->ToUnknown() ) ? node->ToUnknown() : 0 ); } | |
| | | | |
| private: | | private: | |
| TiXmlNode* node; | | TiXmlNode* node; | |
| }; | | }; | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 30 change blocks. |
| 20 lines changed or deleted | | 112 lines changed or added | |
|