tinyxml.h   tinyxml.h 
skipping to change at line 49 skipping to change at line 49
// Help out windows: // Help out windows:
#if defined( _DEBUG ) && !defined( DEBUG ) #if defined( _DEBUG ) && !defined( DEBUG )
#define DEBUG #define DEBUG
#endif #endif
#ifdef TIXML_USE_STL #ifdef TIXML_USE_STL
#include <string> #include <string>
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
#define TIXML_STRING std::string #define TIXML_STRING std::string
#else #else
#include "tinystr.h" #include "tinystr.h"
#define TIXML_STRING TiXmlString #define TIXML_STRING TiXmlString
#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 #define TIXML_SAFE
#ifdef TIXML_SAFE #ifdef TIXML_SAFE
#if defined(_MSC_VER) && (_MSC_VER >= 1400 ) #if defined(_MSC_VER) && (_MSC_VER >= 1400 )
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 = 0; const int TIXML_PATCH_VERSION = 1;
/* 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 277 skipping to change at line 277
TIXML_ERROR_DOCUMENT_EMPTY, TIXML_ERROR_DOCUMENT_EMPTY,
TIXML_ERROR_EMBEDDED_NULL, TIXML_ERROR_EMBEDDED_NULL,
TIXML_ERROR_PARSING_CDATA, TIXML_ERROR_PARSING_CDATA,
TIXML_ERROR_DOCUMENT_TOP_ONLY, TIXML_ERROR_DOCUMENT_TOP_ONLY,
TIXML_ERROR_STRING_COUNT TIXML_ERROR_STRING_COUNT
}; };
protected: protected:
// See STL_STRING_BUG static const char* SkipWhiteSpace( const char*, TiXmlEncoding encodi
// Utility class to overcome a bug. ng );
class StringToBuffer inline static bool IsWhiteSpace( char c )
{
public:
StringToBuffer( const TIXML_STRING& str );
~StringToBuffer();
char* buffer;
};
static const char* SkipWhiteSpace( const char*, TiXmlEncoding e
ncoding );
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 ) inline static bool IsWhiteSpace( int c )
{ {
if ( c < 256 ) if ( c < 256 )
return IsWhiteSpace( (char) c ); return IsWhiteSpace( (char) c );
return false; // Again, only truly correct for English/Lat in...but usually works. return false; // Again, only truly correct for English/Lat in...but usually works.
} }
#ifdef TIXML_USE_STL #ifdef TIXML_USE_STL
static bool StreamWhiteSpace( std::istream * in, TIXML_STRING * tag ); static bool StreamWhiteSpace( std::istream * in, TIXML_STRING * tag );
static bool StreamTo( std::istream * in, int character, TIXML_STRING * tag ); static bool StreamTo( std::istream * in, int character, TIXML_STRING * tag );
#endif #endif
skipping to change at line 524 skipping to change at line 514
/// 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.
TiXmlNode* FirstChild() { return fir stChild; } TiXmlNode* FirstChild() { return fir stChild; }
const TiXmlNode* FirstChild( const char * value ) const; ///< The first child of this node with the matching 'value'. Wi ll be null if none found. const TiXmlNode* FirstChild( const char * value ) const; ///< The first child of this node with the matching 'value'. Wi ll be null if none found.
TiXmlNode* FirstChild( const char * value ); /// The first child of this node with the matching 'value'. Will be
///< The first child of this node with the matching 'va null if none found.
lue'. Will be null if none found. TiXmlNode* FirstChild( const char * _value ) {
// Call through to the const version - safe since nothing is
changed. Exiting syntax: cast this to a const (always safe)
// call the method, cast the return back to non-const.
return const_cast< TiXmlNode* > ((const_cast< const TiXmlNod
e* >(this))->FirstChild( _value ));
}
const TiXmlNode* LastChild() const { return lastChild; } /// The last child of this node. Will be null if there are no children. const TiXmlNode* LastChild() const { return lastChild; } /// The last child of this node. Will be null if there are no children.
TiXmlNode* LastChild() { return lastChild; } TiXmlNode* LastChild() { return lastChild; }
const TiXmlNode* LastChild( const char * value ) const; /// The last child of this node matching 'value'. Will be null if there are no children. const TiXmlNode* LastChild( const char * value ) const; /// The last child of this node matching 'value'. Will be null if there are no children.
TiXmlNode* LastChild( const char * value ); TiXmlNode* LastChild( const char * _value ) {
return const_cast< TiXmlNode* > ((const_cast< const TiXmlNod
e* >(this))->LastChild( _value ));
}
#ifdef TIXML_USE_STL #ifdef TIXML_USE_STL
const TiXmlNode* FirstChild( const std::string& _value ) const { return FirstChild (_value.c_str ()); } ///< STL std::string fo rm. const TiXmlNode* FirstChild( const std::string& _value ) const { return FirstChild (_value.c_str ()); } ///< STL std::string fo rm.
TiXmlNode* FirstChild( const std::string& _value ) { return FirstChild (_value.c_str ()); } ///< ST L std::string form. TiXmlNode* FirstChild( const std::string& _value ) { return FirstChild (_value.c_str ()); } ///< ST L std::string form.
const TiXmlNode* LastChild( const std::string& _value ) const { return LastChild (_value.c_str ()); } ///< STL std::string fo rm. const TiXmlNode* LastChild( const std::string& _value ) const { return LastChild (_value.c_str ()); } ///< STL std::string fo rm.
TiXmlNode* LastChild( const std::string& _value ) { return LastChild (_value.c_str ()); } ///< ST L std::string form. TiXmlNode* LastChild( const std::string& _value ) { return LastChild (_value.c_str ()); } ///< ST L std::string form.
#endif #endif
/** An alternate way to walk the children of a node. /** An alternate way to walk the children of a node.
One way to iterate over nodes is: One way to iterate over nodes is:
skipping to change at line 555 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( TiXmlNode* 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, TiXmlNode* previous
); ) {
return const_cast< TiXmlNode* >( const_cast< const TiXmlNode
* >(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, TiXmlNode* pr evious ) { 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 );
skipping to change at line 606 skipping to change at line 607
/// 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 * ); TiXmlNode* PreviousSibling( const char *_prev ) {
return const_cast< TiXmlNode* >( const_cast< const TiXmlNode
* >(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 * ); TiXmlNode* NextSibling( const char* _next ) {
return const_cast< TiXmlNode* >( const_cast< const TiXmlNode
* >(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() );
}
/** 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 * ); TiXmlElement* NextSiblingElement( const char *_next ) {
return const_cast< TiXmlElement* >( const_cast< const TiXmlN
ode* >(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() );
}
/// 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 ) );
}
#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() );
}
/// 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.
virtual const TiXmlDeclaration* ToDeclaration() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. virtual const TiXmlDeclaration* ToDeclaration() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type.
skipping to change at line 822 skipping to change at line 837
#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() );
}
/// 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() );
}
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 883 skipping to change at line 903
~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 TIXML_STRING& name ) const; const TiXmlAttribute* Find( const char* _name ) const;
TiXmlAttribute* Find( const TIXML_STRING& name ); TiXmlAttribute* Find( const char* _name ) {
return const_cast< TiXmlAttribute* >( const_cast< const TiXm
lAttributeSet* >(this)->Find( _name ) );
}
#ifdef TIXML_USE_STL
const TiXmlAttribute* Find( const std::string& _name ) const;
TiXmlAttribute* Find( const std::string& _name ) {
return const_cast< TiXmlAttribute* >( const_cast< const TiXm
lAttributeSet* >(this)->Find( _name ) );
}
#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)
TiXmlAttribute sentinel; TiXmlAttribute sentinel;
}; };
skipping to change at line 983 skipping to change at line 1012
return TIXML_WRONG_TYPE; return TIXML_WRONG_TYPE;
} }
#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, 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 const std::string* Attribute( const std::string& name ) const;
{ return Attribute( name.c_str() ); } const std::string* Attribute( const std::string& name, int* i ) cons
const char* Attribute( const std::string& name, int* i ) const t;
{ return Attribute( name.c_str(), i ); } const std::string* Attribute( const std::string& name, double* d ) c
const char* Attribute( const std::string& name, double* d ) const onst;
{ return Attribute( name.c_str(), d ); } int QueryIntAttribute( const std::string& name, int* _value ) const;
int QueryIntAttribute( const std::string& name, int* _value ) const int QueryDoubleAttribute( const std::string& name, double* _value )
{ return QueryIntAttribute( name.c_str(), _value ); } const;
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 e ); void SetAttribute( const std::string& name, const std::string& _valu e );
///< STL std::string form. ///< STL std::string form.
void SetAttribute( const std::string& name, int _value ); void SetAttribute( const std::string& name, int _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.
*/ */
skipping to change at line 1095 skipping to change at line 1124
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 ) {}
/// Construct a comment from text.
TiXmlComment( const char* _value ) : TiXmlNode( TiXmlNode::COMMENT )
{
SetValue( _value );
}
TiXmlComment( const TiXmlComment& ); TiXmlComment( const TiXmlComment& );
void operator=( const TiXmlComment& base ); void operator=( const TiXmlComment& base );
virtual ~TiXmlComment() {} virtual ~TiXmlComment() {}
/// 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;
skipping to change at line 1354 skipping to change at line 1387
will be interpreted as an XML file. TinyXML doesn't stream i n XML from the current 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. file location. Streaming may be added in the future.
*/ */
bool LoadFile( FILE*, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODIN G ); bool LoadFile( FILE*, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODIN G );
/// Save a file using the given FILE*. Returns true if successful. /// Save a file using the given FILE*. Returns true if successful.
bool SaveFile( FILE* ) const; 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 ));
return LoadFile( filename.c_str(), 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 );
return ( f.buffer && SaveFile( f.buffer )); // return ( f.buffer && SaveFile( f.buffer ));
return SaveFile( filename.c_str() );
} }
#endif #endif
/** Parse the given null terminated block of xml data. Passing in an encoding to this /** Parse the given null terminated block of xml data. Passing in an encoding to this
method (either TIXML_ENCODING_LEGACY or TIXML_ENCODING_UTF8 will force TinyXml method (either TIXML_ENCODING_LEGACY or TIXML_ENCODING_UTF8 will force TinyXml
to use that encoding, regardless of what TinyXml might other wise try to detect. to use that encoding, regardless of what TinyXml might other wise try to detect.
*/ */
virtual const char* Parse( const char* p, TiXmlParsingData* data = 0 , TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); virtual const char* Parse( const char* p, TiXmlParsingData* data = 0 , TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
/** Get the root element -- the only top level element -- of the doc ument. /** Get the root element -- the only top level element -- of the doc ument.
 End of changes. 24 change blocks. 
51 lines changed or deleted 100 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/