tinyxml.h   tinyxml.h 
skipping to change at line 74 skipping to change at line 74
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 = 3; const int TIXML_MINOR_VERSION = 3;
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 188 skipping to change at line 188
void* GetUserData() { re turn userData; } void* GetUserData() { re turn userData; }
// Table that returs, for a given lead byte, the total number of byt es // Table that returs, for a given lead byte, the total number of byt es
// in the UTF-8 sequence. // in the UTF-8 sequence.
static const int utf8ByteTable[256]; static const int utf8ByteTable[256];
virtual const char* Parse( const char* p, virtual const char* Parse( const char* p,
TiXmlParsing Data* data, TiXmlParsing Data* data,
TiXmlEncodin g encoding /*= TIXML_ENCODING_UNKNOWN */ ) = 0; TiXmlEncodin g encoding /*= TIXML_ENCODING_UNKNOWN */ ) = 0;
enum
{
TIXML_NO_ERROR = 0,
TIXML_ERROR,
TIXML_ERROR_OPENING_FILE,
TIXML_ERROR_OUT_OF_MEMORY,
TIXML_ERROR_PARSING_ELEMENT,
TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME,
TIXML_ERROR_READING_ELEMENT_VALUE,
TIXML_ERROR_READING_ATTRIBUTES,
TIXML_ERROR_PARSING_EMPTY,
TIXML_ERROR_READING_END_TAG,
TIXML_ERROR_PARSING_UNKNOWN,
TIXML_ERROR_PARSING_COMMENT,
TIXML_ERROR_PARSING_DECLARATION,
TIXML_ERROR_DOCUMENT_EMPTY,
TIXML_ERROR_EMBEDDED_NULL,
TIXML_ERROR_STRING_COUNT
};
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 280 skipping to change at line 301
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 // Ignore case only works for english, and should only be relied on when comparing
// to Engilish words: StringEqual( p, "version", true ) is fine. // 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,
TiXmlEncodin g encoding ); TiXmlEncodin g encoding );
enum
{
TIXML_NO_ERROR = 0,
TIXML_ERROR,
TIXML_ERROR_OPENING_FILE,
TIXML_ERROR_OUT_OF_MEMORY,
TIXML_ERROR_PARSING_ELEMENT,
TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME,
TIXML_ERROR_READING_ELEMENT_VALUE,
TIXML_ERROR_READING_ATTRIBUTES,
TIXML_ERROR_PARSING_EMPTY,
TIXML_ERROR_READING_END_TAG,
TIXML_ERROR_PARSING_UNKNOWN,
TIXML_ERROR_PARSING_COMMENT,
TIXML_ERROR_PARSING_DECLARATION,
TIXML_ERROR_DOCUMENT_EMPTY,
TIXML_ERROR_EMBEDDED_NULL,
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 /// Field containing a generic user pointer
void* userData; void* userData;
// None of these methods are reliable for any language except Englis h. // None of these methods are reliable for any language except Englis h.
// Good for approximation, not great for accuracy. // Good for approximation, not great for accuracy.
static int IsAlpha( unsigned char anyByte, TiXmlEncoding encoding ); static int IsAlpha( unsigned char anyByte, TiXmlEncoding encoding );
skipping to change at line 444 skipping to change at line 445
{ {
StringToBuffer buf( _value ); StringToBuffer buf( _value );
SetValue( buf.buffer ? buf.buffer : "" ); 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() const { re TiXmlNode* Parent()
turn parent; } { return parent; }
const TiXmlNode* Parent() const { return par
ent; }
TiXmlNode* FirstChild() const { return firstChild; } ///< const TiXmlNode* FirstChild() const { return firstChild; }
The first child of this node. Will be null if there are no children. ///< The first child of this node. Will be null if there are no childre
TiXmlNode* FirstChild( const char * value ) const; n.
///< The first child of this node with the matching 'value'. Will be nu TiXmlNode* FirstChild() { return fir
ll if none found. 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.
TiXmlNode* FirstChild( const char * value );
///< The first child of this node with the matching 'va
lue'. Will be null if none found.
TiXmlNode* LastChild() const { return lastChild; } /// const TiXmlNode* LastChild() const { return lastChild; }
The last child of this node. Will be null if there are no children. /// The last child of this node. Will be null if there are no children.
TiXmlNode* LastChild( const char * value ) const; TiXmlNode* LastChild() { return lastChild; }
/// The last child of this node matching 'value'. Will be null if there const TiXmlNode* LastChild( const char * value ) const;
are no children. /// The last child of this node matching 'value'. Will be null if there
are no children.
TiXmlNode* LastChild( const char * value );
#ifdef TIXML_USE_STL #ifdef TIXML_USE_STL
TiXmlNode* FirstChild( const std::string& _value ) const { const TiXmlNode* FirstChild( const std::string& _value ) const {
return FirstChild (_value.c_str ()); } ///< STL std::string fo return FirstChild (_value.c_str ()); } ///< STL std::string fo
rm. rm.
TiXmlNode* LastChild( const std::string& _value ) const { TiXmlNode* FirstChild( const std::string& _value )
return LastChild (_value.c_str ()); } ///< STL std::string fo { return FirstChild (_value.c_str ()); } ///< ST
rm. L std::string form.
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.
#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:
@verbatim @verbatim
for( child = parent->FirstChild(); child; child = ch ild->NextSibling() ) for( child = parent->FirstChild(); child; child = ch ild->NextSibling() )
@endverbatim @endverbatim
IterateChildren does the same thing with the syntax: IterateChildren does the same thing with the syntax:
@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.
*/ */
TiXmlNode* IterateChildren( TiXmlNode* previous ) const; const TiXmlNode* IterateChildren( TiXmlNode* previous ) const;
TiXmlNode* IterateChildren( TiXmlNode* 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'
TiXmlNode* IterateChildren( const char * value, TiXmlNode* previous const TiXmlNode* IterateChildren( const char * value, TiXmlNode* pre
) const; vious ) const;
TiXmlNode* IterateChildren( const char * value, TiXmlNode* previous
);
#ifdef TIXML_USE_STL #ifdef TIXML_USE_STL
TiXmlNode* IterateChildren( const std::string& _value, TiXmlNode* pr const TiXmlNode* IterateChildren( const std::string& _value, TiXmlNo
evious ) const { return IterateChildren (_value.c_str (), previo de* previous ) const { return IterateChildren (_value.c_str ()
us); } ///< STL std::string form. , 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 );
/** 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 517 skipping to change at line 528
/** Replace a child of this node. /** Replace a child of this node.
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* ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& wi thThis ); TiXmlNode* ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& wi thThis );
/// 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.
TiXmlNode* PreviousSibling() const { return pre const TiXmlNode* PreviousSibling() const { re
v; } turn prev; }
TiXmlNode* PreviousSibling()
{ return prev; }
/// Navigate to a sibling node. /// Navigate to a sibling node.
TiXmlNode* PreviousSibling( const char * ) const; const TiXmlNode* PreviousSibling( const char * ) const;
TiXmlNode* PreviousSibling( const char * );
#ifdef TIXML_USE_STL #ifdef TIXML_USE_STL
TiXmlNode* PreviousSibling( const std::string& _value ) const { const TiXmlNode* PreviousSibling( const std::string& _value ) const
return PreviousSibling (_value.c_str ()); } ///< STL std::s { return PreviousSibling (_value.c_str ()); } ///< ST
tring form. L std::string form.
TiXmlNode* NextSibling( const std::string& _value) const TiXmlNode* PreviousSibling( const std::string& _value )
{ return NextSibling (_value.c_str ()); } ///< STL std::s { return PreviousSibling (_value.c_str ()); }
tring form. ///< STL std::string 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.
#endif #endif
/// Navigate to a sibling node. /// Navigate to a sibling node.
TiXmlNode* NextSibling() const { return nex const TiXmlNode* NextSibling() const { re
t; } turn next; }
TiXmlNode* NextSibling()
{ return next; }
/// Navigate to a sibling node with the given 'value'. /// Navigate to a sibling node with the given 'value'.
TiXmlNode* NextSibling( const char * ) const; const TiXmlNode* NextSibling( const char * ) const;
TiXmlNode* NextSibling( const char * );
/** 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.
*/ */
TiXmlElement* NextSiblingElement() const; const TiXmlElement* NextSiblingElement() const;
TiXmlElement* 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.
*/ */
TiXmlElement* NextSiblingElement( const char * ) const; const TiXmlElement* NextSiblingElement( const char * ) const;
TiXmlElement* NextSiblingElement( const char * );
#ifdef TIXML_USE_STL #ifdef TIXML_USE_STL
TiXmlElement* NextSiblingElement( const std::string& _value) const const TiXmlElement* NextSiblingElement( const std::string& _value) c
{ return NextSiblingElement (_value.c_str ()); } ///< ST onst { return NextSiblingElement (_value.c_str ()); }
L std::string form. ///< 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.
TiXmlElement* FirstChildElement() const; const TiXmlElement* FirstChildElement() const;
TiXmlElement* FirstChildElement();
/// Convenience function to get through elements. /// Convenience function to get through elements.
TiXmlElement* FirstChildElement( const char * value ) const; const TiXmlElement* FirstChildElement( const char * value ) const;
TiXmlElement* FirstChildElement( const char * value );
#ifdef TIXML_USE_STL #ifdef TIXML_USE_STL
TiXmlElement* FirstChildElement( const std::string& _value ) const const TiXmlElement* FirstChildElement( const std::string& _value ) c
{ return FirstChildElement (_value.c_str ()); } ///< ST onst { return FirstChildElement (_value.c_str ()); }
L std::string form. ///< 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.
*/ */
virtual int Type() const { return type; } virtual 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.
*/ */
TiXmlDocument* GetDocument() const; const TiXmlDocument* GetDocument() const;
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; }
TiXmlDocument* ToDocument() const { return ( this && t const TiXmlDocument* ToDocument() const { return ( t
ype == DOCUMENT ) ? (TiXmlDocument*) this : 0; } ///< Cast to a more define his && type == DOCUMENT ) ? (const TiXmlDocument*) this : 0; } ///< Cast to
d type. Will return null not of the requested type. a more defined type. Will return null not of the requested type.
TiXmlElement* ToElement() const { return ( this && t const TiXmlElement* ToElement() const { return ( t
ype == ELEMENT ) ? (TiXmlElement*) this : 0; } ///< Cast to a more define his && type == ELEMENT ) ? (const TiXmlElement*) this : 0; } ///< Cast to
d type. Will return null not of the requested type. a more defined type. Will return null not of the requested type.
TiXmlComment* ToComment() const { return ( this && t const TiXmlComment* ToComment() const { return ( t
ype == COMMENT ) ? (TiXmlComment*) this : 0; } ///< Cast to a more define his && type == COMMENT ) ? (const TiXmlComment*) this : 0; } ///< Cast to
d type. Will return null not of the requested type. a more defined type. Will return null not of the requested type.
TiXmlUnknown* ToUnknown() const { return ( this && t const TiXmlUnknown* ToUnknown() const { return ( t
ype == UNKNOWN ) ? (TiXmlUnknown*) this : 0; } ///< Cast to a more define his && type == UNKNOWN ) ? (const TiXmlUnknown*) this : 0; } ///< Cast to
d type. Will return null not of the requested type. a more defined type. Will return null not of the requested type.
TiXmlText* ToText() const { return ( this && t const TiXmlText* ToText() const { return ( t
ype == TEXT ) ? (TiXmlText*) this : 0; } ///< Cast to a more define his && type == TEXT ) ? (const TiXmlText*) this : 0; } ///< Cast to
d type. Will return null not of the requested type. a more defined type. Will return null not of the requested type.
TiXmlDeclaration* ToDeclaration() const { return ( this && type == D const TiXmlDeclaration* ToDeclaration() const { return ( this && t
ECLARATION ) ? (TiXmlDeclaration*) this : 0; } ///< Cast to a more defined ype == DECLARATION ) ? (const TiXmlDeclaration*) this : 0; } ///< Cast to a
type. Will return null not of the requested type. more defined type. Will return null not of the requested type.
TiXmlDocument* ToDocument() { 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() { 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() { 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() { 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() { 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() { 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 698 skipping to change at line 729
} }
/// STL std::string form. /// STL std::string form.
void SetValue( const std::string& _value ) void SetValue( const std::string& _value )
{ {
StringToBuffer buf( _value ); StringToBuffer buf( _value );
SetValue( buf.buffer ? buf.buffer : "error" ); 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.
TiXmlAttribute* Next() const; const TiXmlAttribute* Next() const;
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.
TiXmlAttribute* Previous() const; const TiXmlAttribute* Previous() const;
TiXmlAttribute* 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 751 skipping to change at line 784
*/ */
class TiXmlAttributeSet class TiXmlAttributeSet
{ {
public: public:
TiXmlAttributeSet(); TiXmlAttributeSet();
~TiXmlAttributeSet(); ~TiXmlAttributeSet();
void Add( TiXmlAttribute* attribute ); void Add( TiXmlAttribute* attribute );
void Remove( TiXmlAttribute* attribute ); void Remove( TiXmlAttribute* attribute );
TiXmlAttribute* First() const { return ( sentinel.next == &sentine const TiXmlAttribute* First() const { return ( sentinel.next ==
l ) ? 0 : sentinel.next; } &sentinel ) ? 0 : sentinel.next; }
TiXmlAttribute* Last() const { return ( sentinel.prev == &sentine TiXmlAttribute* First() { return ( s
l ) ? 0 : sentinel.prev; } entinel.next == &sentinel ) ? 0 : sentinel.next; }
TiXmlAttribute* Find( const char * name ) const; const TiXmlAttribute* Last() const { return ( sentinel.
prev == &sentinel ) ? 0 : sentinel.prev; }
TiXmlAttribute* Last() { return ( s
entinel.prev == &sentinel ) ? 0 : sentinel.prev; }
const TiXmlAttribute* Find( const char * name ) const;
TiXmlAttribute* Find( const char * name );
private: private:
//*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 !!!
TiXmlAttributeSet( const TiXmlAttributeSet& ); // not allowed
void operator=( const TiXmlAttributeSet& ); // not allowed (as T
iXmlAttribute)
TiXmlAttribute sentinel; TiXmlAttribute sentinel;
}; };
/** The element is a container class. It has a value, the element name, /** The element is a container class. It has a value, the element name,
and can contain other elements, text, comments, and unknowns. and can contain other elements, text, comments, and unknowns.
Elements also contain an arbitrary number of attributes. Elements also contain an arbitrary number of attributes.
*/ */
class TiXmlElement : public TiXmlNode class TiXmlElement : public TiXmlNode
{ {
public: public:
skipping to change at line 811 skipping to change at line 853
/** QueryIntAttribute examines the attribute - it is an alternative to the /** QueryIntAttribute examines the attribute - it is an alternative to the
Attribute() method with richer error checking. Attribute() method with richer error checking.
If the attribute is an integer, it is stored in 'value' and If the attribute 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. If the attribute an integer, it returns TIXML_WRONG_TYPE. If the attribute
does not exist, then TIXML_NO_ATTRIBUTE is returned. does not exist, then TIXML_NO_ATTRIBUTE is returned.
*/ */
int QueryIntAttribute( const char* name, int* value ) const; int QueryIntAttribute( const char* name, int* value ) const;
/// QueryDoubleAttribute examines the attribute - see QueryIntAttrib ute(). /// QueryDoubleAttribute examines the attribute - see QueryIntAttrib ute().
int QueryDoubleAttribute( const char* name, double* value ) const; int QueryDoubleAttribute( const char* name, double* value ) const;
/// QueryFloatAttribute examines the attribute - see QueryIntAttribu
te().
int QueryDoubleAttribute( const char* name, float* value ) const {
double d;
int result = QueryDoubleAttribute( name, &d );
*value = (float)d;
return result;
}
/** 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 { 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 ); }
skipping to change at line 858 skipping to change at line 907
*/ */
void SetDoubleAttribute( const char * name, double value ); 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( const TiXmlAttribute* FirstAttribute() const { return attributeSe
); } ///< Access the first attribute in this element. t.First(); } ///< Access the first attribute in this element
TiXmlAttribute* LastAttribute() const { return attributeSet.Last() .
; } ///< Access the last attribute in this element. TiXmlAttribute* FirstAttribute() { re
turn attributeSet.First(); }
const TiXmlAttribute* LastAttribute() const { return attributeSe
t.Last(); } ///< Access the last attribute in this element.
TiXmlAttribute* LastAttribute() { re
turn attributeSet.Last(); }
/// 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 );
skipping to change at line 1129 skipping to change at line 1180
/** 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.
In well formed XML, there should only be one. TinyXml is tol erant of In well formed XML, there should only be one. TinyXml is tol erant of
multiple elements at the document level. multiple elements at the document level.
*/ */
TiXmlElement* RootElement() const { return FirstChildE const TiXmlElement* RootElement() const { return FirstChildE
lement(); } lement(); }
TiXmlElement* RootElement() { re
turn FirstChildElement(); }
/** If an error occurs, Error will be set to true. Also, /** If an error occurs, Error will be set to true. Also,
- The ErrorId() will contain the integer identifier of the e rror (not generally useful) - The ErrorId() will contain the integer identifier of the e rror (not generally useful)
- The ErrorDesc() method will return the name of the error. (very useful) - The ErrorDesc() method will return the name of the error. (very useful)
- The ErrorRow() and ErrorCol() will return the location of the error (if known) - The ErrorRow() and ErrorCol() will return the location of the error (if known)
*/ */
bool Error() const { re turn error; } bool Error() const { re turn error; }
/// Contains a textual (english) description of the error if one occ urs. /// Contains a textual (english) description of the error if one occ urs.
const char * ErrorDesc() const { return errorDesc.c_str (); } const char * ErrorDesc() const { return errorDesc.c_str (); }
 End of changes. 30 change blocks. 
99 lines changed or deleted 195 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/