| tinyxml.h | | tinyxml.h | |
| | | | |
| skipping to change at line 121 | | skipping to change at line 121 | |
| are provided to set whether or not TinyXml will condense all
white space | | are provided to set whether or not TinyXml will condense all
white space | |
| into a single space or not. The default is to condense. Note
changing these | | into a single space or not. The default is to condense. Note
changing these | |
| values is not thread safe. | | values is not thread safe. | |
| */ | | */ | |
| static void SetCondenseWhiteSpace( bool condense ) { co
ndenseWhiteSpace = condense; } | | static void SetCondenseWhiteSpace( bool condense ) { co
ndenseWhiteSpace = condense; } | |
| | | | |
| /// Return the current white space setting. | | /// Return the current white space setting. | |
| static bool IsWhiteSpaceCondensed()
{ return condenseWhiteSpace; } | | static bool IsWhiteSpaceCondensed()
{ return condenseWhiteSpace; } | |
| | | | |
| protected: | | protected: | |
|
| | | // See STL_STRING_BUG | |
| | | // Utility class to overcome a bug. | |
| | | class StringToBuffer | |
| | | { | |
| | | public: | |
| | | StringToBuffer( const TIXML_STRING& str ); | |
| | | ~StringToBuffer(); | |
| | | char* buffer; | |
| | | }; | |
| | | | |
| static const char* SkipWhiteSpace( const char* ); | | static const char* SkipWhiteSpace( const char* ); | |
| inline static bool IsWhiteSpace( int c ) { return ( i
sspace( c ) || c == '\n' || c == '\r' ); } | | inline static bool IsWhiteSpace( int c ) { return ( i
sspace( 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 | |
| | | | |
| skipping to change at line 298 | | skipping to change at line 307 | |
| Document: filename of the xml file | | Document: filename of the xml file | |
| Element: name of the element | | Element: name of the element | |
| Comment: the comment text | | Comment: the comment text | |
| Unknown: the tag contents | | Unknown: the tag contents | |
| Text: the text string | | Text: the text string | |
| @endverbatim | | @endverbatim | |
| */ | | */ | |
| void SetValue (const char * _value) { value = _value;} | | void SetValue (const char * _value) { value = _value;} | |
| | | | |
| #ifdef TIXML_USE_STL | | #ifdef TIXML_USE_STL | |
|
| void SetValue( const std::string& value ) { SetValue (value . | | /// STL std::string form. | |
| c_str ()); } ///< STL std::string form. | | void SetValue( const std::string& value ) | |
| | | { | |
| | | StringToBuffer buf( value ); | |
| | | SetValue( buf.buffer ? buf.buffer : "" ); | |
| | | } | |
| #endif | | #endif | |
| | | | |
| /// Delete all the children of this node. Does not affect 'this'. | | /// Delete all the children of this node. Does not affect 'this'. | |
| void Clear(); | | void Clear(); | |
| | | | |
| /// One step up the DOM. | | /// One step up the DOM. | |
| TiXmlNode* Parent() const { re
turn parent; } | | TiXmlNode* Parent() const { re
turn parent; } | |
| | | | |
| TiXmlNode* FirstChild() const { return firstChild; } ///<
The first child of this node. Will be null if there are no children. | | TiXmlNode* FirstChild() const { return firstChild; } ///<
The first child of this node. Will be null if there are no children. | |
| TiXmlNode* FirstChild( const char * value ) const;
///< The first child of this node with the matching 'value'. Will be nu
ll if none found. | | TiXmlNode* FirstChild( const char * value ) const;
///< The first child of this node with the matching 'value'. Will be nu
ll if none found. | |
| | | | |
| TiXmlNode* LastChild() const { return lastChild; } ///
The last child of this node. Will be null if there are no children. | | TiXmlNode* LastChild() const { return lastChild; } ///
The last child of this node. Will be null if there are no children. | |
| 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 ) const;
/// The last child of this node matching 'value'. Will be null if there
are no children. | |
| | | | |
| #ifdef TIXML_USE_STL | | #ifdef TIXML_USE_STL | |
|
| TiXmlNode* FirstChild( const std::string& value ) const { retu | | TiXmlNode* FirstChild( const std::string& value ) const { retu | |
| rn FirstChild (value . c_str ()); } ///< STL std::string form. | | rn FirstChild (value.c_str ()); } ///< STL std::string form. | |
| TiXmlNode* LastChild( const std::string& value ) const { retu | | TiXmlNode* LastChild( const std::string& value ) const { retu | |
| rn LastChild (value . c_str ()); } ///< STL std::string form. | | rn LastChild (value.c_str ()); } ///< STL 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 | |
| | | | |
| skipping to change at line 340 | | skipping to change at line 354 | |
| 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; | | TiXmlNode* IterateChildren( TiXmlNode* previous ) const; | |
| | | | |
| /// 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* previous
) const; | |
| | | | |
| #ifdef TIXML_USE_STL | | #ifdef TIXML_USE_STL | |
|
| TiXmlNode* IterateChildren( const std::string& value, TiXmlNode* pre
vious ) const { return IterateChildren (value . c_str (), previ
ous); } ///< STL std::string form. | | TiXmlNode* IterateChildren( const std::string& value, TiXmlNode* pre
vious ) const { return IterateChildren (value.c_str (), previou
s); } ///< 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 before the specifie
d child. | | /** Add a new node related to this. Adds a child before the specifie
d child. | |
| 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. | |
| */ | | */ | |
| | | | |
| skipping to change at line 373 | | skipping to change at line 387 | |
| /// 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
v; } | | TiXmlNode* PreviousSibling() const { return pre
v; } | |
| | | | |
| /// Navigate to a sibling node. | | /// Navigate to a sibling node. | |
| TiXmlNode* PreviousSibling( const char * ) const; | | TiXmlNode* PreviousSibling( const char * ) const; | |
| | | | |
| #ifdef TIXML_USE_STL | | #ifdef TIXML_USE_STL | |
|
| TiXmlNode* PreviousSibling( const std::string& value ) const { | | TiXmlNode* PreviousSibling( const std::string& value ) const { | |
| return PreviousSibling (value . c_str ()); } ///< STL std::s | | return PreviousSibling (value.c_str ()); } ///< STL std::s | |
| tring form. | | tring form. | |
| TiXmlNode* NextSibling( const std::string& value) const { retu | | TiXmlNode* NextSibling( const std::string& value) const { retu | |
| rn NextSibling (value . c_str ()); } ///< STL std::string form. | | rn 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
t; } | | TiXmlNode* NextSibling() const { return nex
t; } | |
| | | | |
| /// Navigate to a sibling node with the given 'value'. | | /// Navigate to a sibling node with the given 'value'. | |
| TiXmlNode* NextSibling( const char * ) const; | | TiXmlNode* NextSibling( const char * ) const; | |
| | | | |
| /** 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 | |
| | | | |
| skipping to change at line 396 | | skipping to change at line 410 | |
| */ | | */ | |
| TiXmlElement* NextSiblingElement() const; | | TiXmlElement* NextSiblingElement() const; | |
| | | | |
| /** 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; | | TiXmlElement* NextSiblingElement( const char * ) const; | |
| | | | |
| #ifdef TIXML_USE_STL | | #ifdef TIXML_USE_STL | |
|
| TiXmlElement* NextSiblingElement( const std::string& value) const
{ return NextSiblingElement (value . c_str ()); } ///< ST
L std::string form. | | TiXmlElement* NextSiblingElement( const std::string& value) const
{ return NextSiblingElement (value.c_str ()); } ///< ST
L std::string form. | |
| #endif | | #endif | |
| | | | |
| /// Convenience function to get through elements. | | /// Convenience function to get through elements. | |
| TiXmlElement* FirstChildElement() const; | | TiXmlElement* FirstChildElement() const; | |
| | | | |
| /// Convenience function to get through elements. | | /// Convenience function to get through elements. | |
| TiXmlElement* FirstChildElement( const char * value ) const; | | TiXmlElement* FirstChildElement( const char * value ) const; | |
| | | | |
| #ifdef TIXML_USE_STL | | #ifdef TIXML_USE_STL | |
|
| TiXmlElement* FirstChildElement( const std::string& value ) const
{ return FirstChildElement (value . c_str ()); } ///< ST
L std::string form. | | TiXmlElement* FirstChildElement( const std::string& value ) const
{ return FirstChildElement (value.c_str ()); } ///< ST
L 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. | |
| 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; | | TiXmlDocument* GetDocument() const; | |
| | | | |
| | | | |
| skipping to change at line 485 | | skipping to change at line 499 | |
| friend class TiXmlAttributeSet; | | friend class TiXmlAttributeSet; | |
| | | | |
| public: | | public: | |
| /// Construct an empty attribute. | | /// Construct an empty attribute. | |
| TiXmlAttribute() : prev( 0 ), next( 0 ) {} | | TiXmlAttribute() : prev( 0 ), 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 . c_str (); | | name = _name; | |
| value = _value . c_str (); | | value = _value; | |
| } | | } | |
| #endif | | #endif | |
| | | | |
| /// Construct an attribute with a name and value. | | /// Construct an attribute with a name and value. | |
| TiXmlAttribute( const char * _name, const char * _value ): name( _na
me ), value( _value ), prev( 0 ), next( 0 ) {} | | TiXmlAttribute( const char * _name, const char * _value ): name( _na
me ), value( _value ), prev( 0 ), next( 0 ) {} | |
| const char* Name() const { return name.c_str
(); } ///< Return the name of this attribute. | | const char* Name() const { return name.c_str
(); } ///< Return the name of this attribute. | |
| const char* Value() const { return value.c_str
(); } ///< Return the value of this attribute. | | const char* Value() const { return value.c_str
(); } ///< Return the value of this attribute. | |
| const int IntValue() const;
///< Return the value of this attribute
, converted to an integer. | | const int IntValue() const;
///< Return the value of this attribute
, converted to an integer. | |
| const double DoubleValue() const;
///< Return the value of this attribute, conver
ted to a double. | | const double DoubleValue() const;
///< Return the value of this attribute, conver
ted to a double. | |
| | | | |
| void SetName( const char* _name ) { name = _name; }
///< Set the name of this attribute. | | void SetName( const char* _name ) { name = _name; }
///< Set the name of this attribute. | |
| void SetValue( const char* _value ) { value = _value; }
///< Set the value. | | void SetValue( const char* _value ) { value = _value; }
///< Set the value. | |
| | | | |
| void SetIntValue( int value );
///< Set the value from an integer. | | void SetIntValue( int value );
///< Set the value from an integer. | |
| void SetDoubleValue( double value );
///< Set the value from a double. | | void SetDoubleValue( double value );
///< Set the value from a double. | |
| | | | |
| #ifdef TIXML_USE_STL | | #ifdef TIXML_USE_STL | |
|
| void SetName( const std::string& _name ) { SetName (_na | | /// STL std::string form. | |
| me . c_str ()); } ///< STL std::string form. | | void SetName( const std::string& _name ) | |
| void SetValue( const std::string& _value ) { SetValue (_v | | { | |
| alue . c_str ()); } ///< STL std::string form. | | StringToBuffer buf( _name ); | |
| | | SetName ( buf.buffer ? buf.buffer : "error" ); | |
| | | } | |
| | | /// STL std::string form. | |
| | | void SetValue( const std::string& _value ) | |
| | | { | |
| | | StringToBuffer buf( _value ); | |
| | | SetValue( buf.buffer ? buf.buffer : "error" ); | |
| | | } | |
| #endif | | #endif | |
| | | | |
| /// Get the next sibling attribute in the DOM. Returns null at end. | | /// Get the next sibling attribute in the DOM. Returns null at end. | |
| TiXmlAttribute* Next() const; | | TiXmlAttribute* Next() const; | |
| /// 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; | | TiXmlAttribute* Previous() const; | |
| | | | |
| 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; } | |
| | | | |
| skipping to change at line 583 | | skipping to change at line 607 | |
| { | | { | |
| public: | | public: | |
| /// Construct an element. | | /// Construct an element. | |
| TiXmlElement (const char * in_value); | | TiXmlElement (const char * in_value); | |
| | | | |
| #ifdef TIXML_USE_STL | | #ifdef TIXML_USE_STL | |
| /// std::string constructor. | | /// std::string constructor. | |
| TiXmlElement( const std::string& _value ) : TiXmlNode( TiXmlNode
::ELEMENT ) | | TiXmlElement( const std::string& _value ) : TiXmlNode( TiXmlNode
::ELEMENT ) | |
| { | | { | |
| firstChild = lastChild = 0; | | firstChild = lastChild = 0; | |
|
| value = _value . c_str (); | | value = _value; | |
| } | | } | |
| #endif | | #endif | |
| | | | |
| virtual ~TiXmlElement(); | | virtual ~TiXmlElement(); | |
| | | | |
| /** Given an attribute name, attribute returns the value | | /** Given an attribute name, attribute returns the value | |
| for the attribute of that name, or null if none exists. | | for the attribute of that name, or null if none exists. | |
| */ | | */ | |
|
| const char * Attribute( const char * name ) const; | | const char* Attribute( const char* name ) const; | |
| | | | |
| /** Given an attribute name, attribute returns the value | | /** Given an attribute name, attribute returns the value | |
| for the attribute of that name, or null if none exists. | | for the attribute of that name, or null if none exists. | |
|
| | | If the attribute exists and can be converted to an integer, | |
| | | the integer value will be put in the return 'i', if 'i' | |
| | | is non-null. | |
| */ | | */ | |
|
| const char * Attribute( const char * name, int & i ) const; | | const char* Attribute( const char* name, int* i ) const; | |
| | | | |
| /** 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 | |
|
| void SetAttribute( const std::string& name, const std::string& value | | const char* Attribute( const std::string& name ) const | |
| ) { SetAttribute (name . c_str (), value . c_str ()); } | | { return Attribute( name.c_str() ); } | |
| ///< STL std::string form. | | const char* Attribute( const std::string& name, int* i ) const | |
| void SetAttribute( const std::string& name, int value ) { SetA | | { return Attribute( name.c_str(), i ); } | |
| ttribute (name . c_str (), value); } ///< STL std::string form. | | | |
| | | /// STL std::string form. | |
| | | void SetAttribute( const std::string& name, const std::string& value | |
| | | ) | |
| | | { | |
| | | StringToBuffer n( name ); | |
| | | StringToBuffer v( value ); | |
| | | if ( n.buffer && v.buffer ) | |
| | | SetAttribute (n.buffer, v.buffer ); | |
| | | } | |
| | | ///< STL std::string form. | |
| | | void SetAttribute( const std::string& name, int value ) | |
| | | { | |
| | | StringToBuffer n( name ); | |
| | | if ( n.buffer ) | |
| | | SetAttribute (n.buffer, value); | |
| | | } | |
| #endif | | #endif | |
| | | | |
| /** Sets an attribute of name to a given value. The attribute | | /** Sets an attribute of name to a given value. The attribute | |
| will be created if it does not exist, or changed if it does. | | will be created if it does not exist, or changed if it does. | |
| */ | | */ | |
| void SetAttribute( const char * name, int value ); | | void SetAttribute( const char * name, int value ); | |
| | | | |
| /** 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. | |
| | | | |
| // [internal use] Creates a new Element and returs it. | | // [internal use] Creates a new Element and returs it. | |
| virtual TiXmlNode* Clone() const; | | virtual TiXmlNode* Clone() const; | |
| // [internal use] | | // [internal use] | |
| | | | |
| virtual void Print( FILE* cfile, int depth ) const; | | virtual void Print( FILE* cfile, int depth ) const; | |
| | | | |
| skipping to change at line 747 | | skipping to change at line 790 | |
| TiXmlDeclaration() : TiXmlNode( TiXmlNode::DECLARATION ) {} | | TiXmlDeclaration() : TiXmlNode( TiXmlNode::DECLARATION ) {} | |
| | | | |
| #ifdef TIXML_USE_STL | | #ifdef TIXML_USE_STL | |
| /// Constructor. | | /// Constructor. | |
| TiXmlDeclaration( | | TiXmlDeclaration( | |
| const std::string& _version, | | const std::string& _version, | |
| const std::string& _encoding
, | | const std::string& _encoding
, | |
| const std::string& _standalo
ne ) | | const std::string& _standalo
ne ) | |
| : TiXmlNode( TiXmlNode::DECLARATION
) | | : TiXmlNode( TiXmlNode::DECLARATION
) | |
| { | | { | |
|
| version = _version . c_str (); | | version = _version; | |
| encoding = _encoding . c_str (); | | encoding = _encoding; | |
| standalone = _standalone . c_str (); | | standalone = _standalone; | |
| } | | } | |
| #endif | | #endif | |
| | | | |
| /// Construct. | | /// Construct. | |
| TiXmlDeclaration::TiXmlDeclaration( const char * _version, | | TiXmlDeclaration::TiXmlDeclaration( const char * _version, | |
|
const char * _encoding, | |
const char * _encoding, | |
|
const char * _standalone ); | |
const char * _standalone ); | |
| | | | |
| virtual ~TiXmlDeclaration() {} | | virtual ~TiXmlDeclaration() {} | |
| | | | |
| /// Version. Will return empty if none was found. | | /// Version. Will return empty if none was found. | |
|
| const char * Version() const { return version . c_str ();
} | | const char * Version() const { return version.c_str (); } | |
| /// Encoding. Will return empty if none was found. | | /// Encoding. Will return empty if none was found. | |
|
| const char * Encoding() const { return encoding . c_str ()
; } | | const char * Encoding() const { return encoding.c_str ();
} | |
| /// Is this a standalone document? | | /// Is this a standalone document? | |
|
| const char * Standalone() const { return standalone . c_str
(); } | | const char * Standalone() const { return standalone.c_str ()
; } | |
| | | | |
| // [internal use] Creates a new Element and returs it. | | // [internal use] Creates a new Element and returs it. | |
| virtual TiXmlNode* Clone() const; | | virtual TiXmlNode* Clone() const; | |
| // [internal use] | | // [internal use] | |
| virtual void Print( FILE* cfile, int depth ) const; | | virtual void Print( FILE* cfile, int depth ) const; | |
| | | | |
| protected: | | protected: | |
| // 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 ); | |
| | | | |
| skipping to change at line 857 | | skipping to change at line 900 | |
| /// Save a file using the current document value. Returns true if su
ccessful. | | /// Save a file using the current document value. Returns true if su
ccessful. | |
| bool SaveFile() const; | | bool SaveFile() const; | |
| /// Load a file using the given filename. Returns true if successful
. | | /// Load a file using the given filename. Returns true if successful
. | |
| bool LoadFile( const char * filename ); | | bool LoadFile( const char * filename ); | |
| /// Save a file using the given filename. Returns true if successful
. | | /// Save a file using the given filename. Returns true if successful
. | |
| bool SaveFile( const char * filename ) const; | | bool SaveFile( const char * filename ) const; | |
| | | | |
| #ifdef TIXML_USE_STL | | #ifdef TIXML_USE_STL | |
| bool LoadFile( const std::string& filename ) ///<
STL std::string version. | | bool LoadFile( const std::string& filename ) ///<
STL std::string version. | |
| { | | { | |
|
| return LoadFile (filename.c_str ()); | | StringToBuffer f( filename ); | |
| | | return ( f.buffer && LoadFile( f.buffer )); | |
| } | | } | |
| bool SaveFile( const std::string& filename ) const ///<
STL std::string version. | | bool SaveFile( const std::string& filename ) const ///<
STL std::string version. | |
| { | | { | |
|
| return SaveFile (filename.c_str ()); | | StringToBuffer f( filename ); | |
| | | return ( f.buffer && SaveFile( f.buffer )); | |
| } | | } | |
| #endif | | #endif | |
| | | | |
| /// Parse the given null terminated block of xml data. | | /// Parse the given null terminated block of xml data. | |
| virtual const char* Parse( const char* p ); | | virtual const char* Parse( const char* p ); | |
| | | | |
| /** 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
lement(); } | | TiXmlElement* RootElement() const { return FirstChildE
lement(); } | |
| | | | |
| /// If, during parsing, a error occurs, Error will be set to true. | | /// If, during parsing, a error occurs, Error will be set to true. | |
| 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 (); } | |
| | | | |
| /** Generally, you probably want the error string ( ErrorDesc() ). B
ut if you | | /** Generally, you probably want the error string ( ErrorDesc() ). B
ut if you | |
| prefer the ErrorId, this function will fetch it. | | prefer the ErrorId, this function will fetch it. | |
| */ | | */ | |
| const int ErrorId() const { return err
orId; } | | const int ErrorId() const { return err
orId; } | |
| | | | |
| /// If you have handled the error, it can be reset with this call. | | /// If you have handled the error, it can be reset with this call. | |
| void ClearError() { er
ror = false; errorId = 0; errorDesc = ""; } | | void ClearError() { er
ror = false; errorId = 0; errorDesc = ""; } | |
| | | | |
| /** Dump the document to standard out. */ | | /** Dump the document to standard out. */ | |
|
| void Print() const
{ Print( stdout, 0 ); } | | void Print() const { Pr
int( stdout, 0 ); } | |
| | | | |
| // [internal use] | | // [internal use] | |
| virtual void Print( FILE* cfile, int depth = 0 ) const; | | virtual void Print( FILE* cfile, int depth = 0 ) const; | |
| // [internal use] | | // [internal use] | |
| void SetError( int err ) { assert( err > 0 && err < TIX
ML_ERROR_STRING_COUNT ); | | void SetError( int err ) { assert( err > 0 && err < TIX
ML_ERROR_STRING_COUNT ); | |
| error = true; | | error = true; | |
| errorId = err; | | errorId = err; | |
| errorDesc = errorString[ errorId ]; } | | errorDesc = errorString[ errorId ]; } | |
| | | | |
| protected : | | protected : | |
| | | | |
End of changes. 24 change blocks. |
| 40 lines changed or deleted | | 82 lines changed or added | |
|