tinyxml.h | tinyxml.h | |||
---|---|---|---|---|
skipping to change at line 90 | skipping to change at line 90 | |||
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 = 5; | const int TIXML_MINOR_VERSION = 5; | |||
const int TIXML_PATCH_VERSION = 1; | const int TIXML_PATCH_VERSION = 2; | |||
/* 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 552 | skipping to change at line 552 | |||
@verbatim | @verbatim | |||
child = 0; | child = 0; | |||
while( child = parent->IterateChildren( child ) ) | while( child = parent->IterateChildren( child ) ) | |||
@endverbatim | @endverbatim | |||
IterateChildren takes the previous child as input and finds | IterateChildren takes the previous child as input and finds | |||
the next one. If the previous child is null, it returns the | the next one. If the previous child is null, it returns the | |||
first. IterateChildren will return null when done. | first. IterateChildren will return null when done. | |||
*/ | */ | |||
const TiXmlNode* IterateChildren( const TiXmlNode* previous ) const; | const TiXmlNode* IterateChildren( const TiXmlNode* previous ) const; | |||
TiXmlNode* IterateChildren( TiXmlNode* previous ) { | TiXmlNode* IterateChildren( const TiXmlNode* previous ) { | |||
return const_cast< TiXmlNode* >( (const_cast< const TiXmlNod e* >(this))->IterateChildren( previous ) ); | return const_cast< TiXmlNode* >( (const_cast< const TiXmlNod e* >(this))->IterateChildren( previous ) ); | |||
} | } | |||
/// This flavor of IterateChildren searches for children with a part icular 'value' | /// This flavor of IterateChildren searches for children with a part icular 'value' | |||
const TiXmlNode* IterateChildren( const char * value, const TiXmlNod e* previous ) const; | const TiXmlNode* IterateChildren( const char * value, const TiXmlNod e* previous ) const; | |||
TiXmlNode* IterateChildren( const char * _value, TiXmlNode* previous | TiXmlNode* IterateChildren( const char * _value, const TiXmlNode* pr | |||
) { | evious ) { | |||
return const_cast< TiXmlNode* >( const_cast< const TiXmlNode | return const_cast< TiXmlNode* >( (const_cast< const TiXmlNod | |||
* >(this)->IterateChildren( _value, previous ) ); | e* >(this))->IterateChildren( _value, previous ) ); | |||
} | } | |||
#ifdef TIXML_USE_STL | #ifdef TIXML_USE_STL | |||
const TiXmlNode* IterateChildren( const std::string& _value, const T iXmlNode* previous ) const { return IterateChildren (_value.c_str () , previous); } ///< STL std::string form. | const TiXmlNode* IterateChildren( const std::string& _value, const T iXmlNode* previous ) const { return IterateChildren (_value.c_str () , previous); } ///< STL std::string form. | |||
TiXmlNode* IterateChildren( const std::string& _value, TiXmlNode* pr evious ) { return IterateChildren (_value.c_str (), previous); } ///< STL std::string form. | TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNo de* previous ) { return IterateChildren (_value.c_str (), previous); } ///< STL std::string form. | |||
#endif | #endif | |||
/** Add a new node related to this. Adds a child past the LastChild. | /** Add a new node related to this. Adds a child past the LastChild. | |||
Returns a pointer to the new object or NULL if an error occu red. | Returns a pointer to the new object or NULL if an error occu red. | |||
*/ | */ | |||
TiXmlNode* InsertEndChild( const TiXmlNode& addThis ); | TiXmlNode* InsertEndChild( const TiXmlNode& addThis ); | |||
/** Add a new node related to this. Adds a child past the LastChild. | /** Add a new node related to this. Adds a child past the LastChild. | |||
NOTE: the node to be added is passed by pointer, and will be | NOTE: the node to be added is passed by pointer, and will be | |||
skipping to change at line 608 | skipping to change at line 608 | |||
/// Delete a child of this node. | /// Delete a child of this node. | |||
bool RemoveChild( TiXmlNode* removeThis ); | bool RemoveChild( TiXmlNode* removeThis ); | |||
/// Navigate to a sibling node. | /// Navigate to a sibling node. | |||
const TiXmlNode* PreviousSibling() const { re turn prev; } | const TiXmlNode* PreviousSibling() const { re turn prev; } | |||
TiXmlNode* PreviousSibling() { return prev; } | TiXmlNode* PreviousSibling() { return prev; } | |||
/// Navigate to a sibling node. | /// Navigate to a sibling node. | |||
const TiXmlNode* PreviousSibling( const char * ) const; | const TiXmlNode* PreviousSibling( const char * ) const; | |||
TiXmlNode* PreviousSibling( const char *_prev ) { | TiXmlNode* PreviousSibling( const char *_prev ) { | |||
return const_cast< TiXmlNode* >( const_cast< const TiXmlNode * >(this)->PreviousSibling( _prev ) ); | return const_cast< TiXmlNode* >( (const_cast< const TiXmlNod e* >(this))->PreviousSibling( _prev ) ); | |||
} | } | |||
#ifdef TIXML_USE_STL | #ifdef TIXML_USE_STL | |||
const TiXmlNode* PreviousSibling( const std::string& _value ) const { return PreviousSibling (_value.c_str ()); } ///< ST L std::string form. | const TiXmlNode* PreviousSibling( const std::string& _value ) const { return PreviousSibling (_value.c_str ()); } ///< ST L std::string form. | |||
TiXmlNode* PreviousSibling( const std::string& _value ) { return PreviousSibling (_value.c_str ()); } ///< STL std::string form. | TiXmlNode* PreviousSibling( const std::string& _value ) { return PreviousSibling (_value.c_str ()); } ///< STL std::string form. | |||
const TiXmlNode* NextSibling( const std::string& _value) const { return NextSibling (_value.c_str ()); } ///< STL std::s tring form. | const TiXmlNode* NextSibling( const std::string& _value) const { return NextSibling (_value.c_str ()); } ///< STL std::s tring form. | |||
TiXmlNode* NextSibling( const std::string& _value) { return NextSibling (_value.c_str ()); } ///< STL std::string form. | TiXmlNode* NextSibling( const std::string& _value) { return NextSibling (_value.c_str ()); } ///< STL std::string form. | |||
#endif | #endif | |||
/// Navigate to a sibling node. | /// Navigate to a sibling node. | |||
const TiXmlNode* NextSibling() const { re turn next; } | const TiXmlNode* NextSibling() const { re turn next; } | |||
TiXmlNode* NextSibling() { return next; } | TiXmlNode* NextSibling() { return next; } | |||
/// Navigate to a sibling node with the given 'value'. | /// Navigate to a sibling node with the given 'value'. | |||
const TiXmlNode* NextSibling( const char * ) const; | const TiXmlNode* NextSibling( const char * ) const; | |||
TiXmlNode* NextSibling( const char* _next ) { | TiXmlNode* NextSibling( const char* _next ) { | |||
return const_cast< TiXmlNode* >( const_cast< const TiXmlNode * >(this)->NextSibling( _next ) ); | return const_cast< TiXmlNode* >( (const_cast< const TiXmlNod e* >(this))->NextSibling( _next ) ); | |||
} | } | |||
/** Convenience function to get through elements. | /** Convenience function to get through elements. | |||
Calls NextSibling and ToElement. Will skip all non-Element | Calls NextSibling and ToElement. Will skip all non-Element | |||
nodes. Returns 0 if there is not another element. | nodes. Returns 0 if there is not another element. | |||
*/ | */ | |||
const TiXmlElement* NextSiblingElement() const; | const TiXmlElement* NextSiblingElement() const; | |||
TiXmlElement* NextSiblingElement() { | TiXmlElement* NextSiblingElement() { | |||
return const_cast< TiXmlElement* >( const_cast< const TiXmlN ode* >(this)->NextSiblingElement() ); | return const_cast< TiXmlElement* >( (const_cast< const TiXml Node* >(this))->NextSiblingElement() ); | |||
} | } | |||
/** Convenience function to get through elements. | /** Convenience function to get through elements. | |||
Calls NextSibling and ToElement. Will skip all non-Element | Calls NextSibling and ToElement. Will skip all non-Element | |||
nodes. Returns 0 if there is not another element. | nodes. Returns 0 if there is not another element. | |||
*/ | */ | |||
const TiXmlElement* NextSiblingElement( const char * ) const; | const TiXmlElement* NextSiblingElement( const char * ) const; | |||
TiXmlElement* NextSiblingElement( const char *_next ) { | TiXmlElement* NextSiblingElement( const char *_next ) { | |||
return const_cast< TiXmlElement* >( const_cast< const TiXmlN ode* >(this)->NextSiblingElement( _next ) ); | return const_cast< TiXmlElement* >( (const_cast< const TiXml Node* >(this))->NextSiblingElement( _next ) ); | |||
} | } | |||
#ifdef TIXML_USE_STL | #ifdef TIXML_USE_STL | |||
const TiXmlElement* NextSiblingElement( const std::string& _value) c onst { return NextSiblingElement (_value.c_str ()); } ///< STL std::string form. | const TiXmlElement* NextSiblingElement( const std::string& _value) c onst { return NextSiblingElement (_value.c_str ()); } ///< STL std::string form. | |||
TiXmlElement* NextSiblingElement( const std::string& _value) { return NextSiblingElement (_value.c_str ()); } ///< STL std::string form. | TiXmlElement* NextSiblingElement( const std::string& _value) { return NextSiblingElement (_value.c_str ()); } ///< STL std::string form. | |||
#endif | #endif | |||
/// Convenience function to get through elements. | /// Convenience function to get through elements. | |||
const TiXmlElement* FirstChildElement() const; | const TiXmlElement* FirstChildElement() const; | |||
TiXmlElement* FirstChildElement() { | TiXmlElement* FirstChildElement() { | |||
return const_cast< TiXmlElement* >( const_cast< const TiXmlN ode* >(this)->FirstChildElement() ); | return const_cast< TiXmlElement* >( (const_cast< const TiXml Node* >(this))->FirstChildElement() ); | |||
} | } | |||
/// Convenience function to get through elements. | /// Convenience function to get through elements. | |||
const TiXmlElement* FirstChildElement( const char * _value ) const; | const TiXmlElement* FirstChildElement( const char * _value ) const; | |||
TiXmlElement* FirstChildElement( const char * _value ) { | TiXmlElement* FirstChildElement( const char * _value ) { | |||
return const_cast< TiXmlElement* >( const_cast< const TiXmlN ode* >(this)->FirstChildElement( _value ) ); | return const_cast< TiXmlElement* >( (const_cast< const TiXml Node* >(this))->FirstChildElement( _value ) ); | |||
} | } | |||
#ifdef TIXML_USE_STL | #ifdef TIXML_USE_STL | |||
const TiXmlElement* FirstChildElement( const std::string& _value ) c onst { return FirstChildElement (_value.c_str ()); } ///< STL std::string form. | const TiXmlElement* FirstChildElement( const std::string& _value ) c onst { return FirstChildElement (_value.c_str ()); } ///< STL std::string form. | |||
TiXmlElement* FirstChildElement( const std::string& _value ) { return FirstChildElement (_value.c_str ()); } ///< STL std::string form. | TiXmlElement* FirstChildElement( const std::string& _value ) { return FirstChildElement (_value.c_str ()); } ///< STL std::string form. | |||
#endif | #endif | |||
/** Query the type (as an enumerated value, above) of this node. | /** Query the type (as an enumerated value, above) of this node. | |||
The possible types are: DOCUMENT, ELEMENT, COMMENT, | The possible types are: DOCUMENT, ELEMENT, COMMENT, | |||
UNKNOWN, TEX T, and DECLARATION. | UNKNOWN, TEX T, and DECLARATION. | |||
*/ | */ | |||
int Type() const { return type; } | int Type() const { return type; } | |||
/** 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() { | |||
return const_cast< TiXmlDocument* >( const_cast< const TiXml Node* >(this)->GetDocument() ); | return const_cast< TiXmlDocument* >( (const_cast< const TiXm lNode* >(this))->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; } | |||
virtual const TiXmlDocument* ToDocument() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. | virtual const TiXmlDocument* ToDocument() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. | |||
virtual const TiXmlElement* ToElement() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. | virtual const TiXmlElement* ToElement() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. | |||
virtual const TiXmlComment* ToComment() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. | virtual const TiXmlComment* ToComment() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. | |||
virtual const TiXmlUnknown* ToUnknown() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. | virtual const TiXmlUnknown* ToUnknown() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. | |||
virtual const TiXmlText* ToText() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. | virtual const TiXmlText* ToText() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. | |||
skipping to change at line 838 | skipping to change at line 838 | |||
#ifdef TIXML_USE_STL | #ifdef TIXML_USE_STL | |||
/// STL std::string form. | /// STL std::string form. | |||
void SetName( const std::string& _name ) { name = _name; } | void SetName( const std::string& _name ) { name = _name; } | |||
/// STL std::string form. | /// STL std::string form. | |||
void SetValue( const std::string& _value ) { value = _value; } | void SetValue( const std::string& _value ) { value = _value; } | |||
#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() { | |||
return const_cast< TiXmlAttribute* >( const_cast< const TiXm lAttribute* >(this)->Next() ); | return const_cast< TiXmlAttribute* >( (const_cast< const TiX mlAttribute* >(this))->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() { | |||
return const_cast< TiXmlAttribute* >( const_cast< const TiXm lAttribute* >(this)->Previous() ); | return const_cast< TiXmlAttribute* >( (const_cast< const TiX mlAttribute* >(this))->Previous() ); | |||
} | } | |||
bool operator==( const TiXmlAttribute& rhs ) const { return rhs.name == name; } | bool operator==( const TiXmlAttribute& rhs ) const { return rhs.name == name; } | |||
bool operator<( const TiXmlAttribute& rhs ) const { return name < rhs.name; } | bool operator<( const TiXmlAttribute& rhs ) const { return name < rhs.name; } | |||
bool operator>( const TiXmlAttribute& rhs ) const { return name > r hs.name; } | bool operator>( const TiXmlAttribute& rhs ) const { return name > r hs.name; } | |||
/* Attribute parsing starts: first letter of the name | /* Attribute parsing starts: first letter of the name | |||
returns: the next char afte r the value end quote | returns: the next char afte r the value end quote | |||
*/ | */ | |||
virtual const char* Parse( const char* p, TiXmlParsingData* data, Ti XmlEncoding encoding ); | virtual const char* Parse( const char* p, TiXmlParsingData* data, Ti XmlEncoding encoding ); | |||
skipping to change at line 905 | skipping to change at line 905 | |||
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 char* _name ) const; | |||
TiXmlAttribute* Find( const char* _name ) { | TiXmlAttribute* Find( const char* _name ) { | |||
return const_cast< TiXmlAttribute* >( const_cast< const TiXm lAttributeSet* >(this)->Find( _name ) ); | return const_cast< TiXmlAttribute* >( (const_cast< const TiX mlAttributeSet* >(this))->Find( _name ) ); | |||
} | } | |||
#ifdef TIXML_USE_STL | #ifdef TIXML_USE_STL | |||
const TiXmlAttribute* Find( const std::string& _name ) const; | const TiXmlAttribute* Find( const std::string& _name ) const; | |||
TiXmlAttribute* Find( const std::string& _name ) { | TiXmlAttribute* Find( const std::string& _name ) { | |||
return const_cast< TiXmlAttribute* >( const_cast< const TiXm lAttributeSet* >(this)->Find( _name ) ); | return const_cast< TiXmlAttribute* >( (const_cast< const TiX mlAttributeSet* >(this))->Find( _name ) ); | |||
} | } | |||
#endif | #endif | |||
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) | |||
skipping to change at line 1434 | skipping to change at line 1434 | |||
*/ | */ | |||
int ErrorId() const { return errorId; } | int ErrorId() const { return errorId; } | |||
/** Returns the location (if known) of the error. The first column i s column 1, | /** Returns the location (if known) of the error. The first column i s column 1, | |||
and the first row is row 1. A value of 0 means the row and c olumn wasn't applicable | and the first row is row 1. A value of 0 means the row and c olumn wasn't applicable | |||
(memory errors, for example, have no row/column) or the pars er lost the error. (An | (memory errors, for example, have no row/column) or the pars er lost the error. (An | |||
error in the error reporting, in that case.) | error in the error reporting, in that case.) | |||
@sa SetTabSize, Row, Column | @sa SetTabSize, Row, Column | |||
*/ | */ | |||
int ErrorRow() { return errorLocation.row+1; } | int ErrorRow() const { return errorLocation.row+1; } | |||
int ErrorCol() { return errorLocation.col+1; } ///< The column wher | int ErrorCol() const { return errorLocation.col+1; } ///< The col | |||
e the error occured. See ErrorRow() | umn where the error occured. See ErrorRow() | |||
/** SetTabSize() allows the error reporting functions (ErrorRow() an d ErrorCol()) | /** SetTabSize() allows the error reporting functions (ErrorRow() an d ErrorCol()) | |||
to report the correct values for row and column. It does not change the output | to report the correct values for row and column. It does not change the output | |||
or input in any way. | or input in any way. | |||
By calling this method, with a tab size | By calling this method, with a tab size | |||
greater than 0, the row and column of each node and attribut e is stored | greater than 0, the row and column of each node and attribut e is stored | |||
when the file is loaded. Very useful for tracking the DOM ba ck in to | when the file is loaded. Very useful for tracking the DOM ba ck in to | |||
the source file. | the source file. | |||
End of changes. 16 change blocks. | ||||
21 lines changed or deleted | 21 lines changed or added | |||