tinyxml.h | tinyxml.h | |||
---|---|---|---|---|
skipping to change at line 201 | skipping to change at line 201 | |||
/* Reads text. Returns a pointer past the given end tag. | /* Reads text. Returns a pointer past the given end tag. | |||
Wickedly complex options, but it keeps the (sensitive) code in one place. | Wickedly complex options, but it keeps the (sensitive) code in one place. | |||
*/ | */ | |||
static const char* ReadText( const char* in, // where to start | static const char* ReadText( const char* in, // where to start | |||
TIXM L_STRING* text, // the string read | TIXM L_STRING* text, // the string read | |||
bool ignoreWhiteSpace, // whether to keep the white space | bool ignoreWhiteSpace, // whether to keep the white space | |||
cons t char* endTag, // what ends this text | cons t char* endTag, // what ends this text | |||
bool ignoreCase ); // whether to ignore case in the end ta g | bool ignoreCase ); // whether to ignore case in the end ta g | |||
virtual const char* Parse( const char* p, const TiXmlParsingData* da ta ) = 0; | virtual const char* Parse( const char* p, TiXmlParsingData* data ) = 0; | |||
// If an entity has been found, transform it into a character. | // If an entity has been found, transform it into a character. | |||
static const char* GetEntity( const char* in, char* value ); | static const char* GetEntity( const char* in, char* value ); | |||
// Get a character, while interpreting entities. | // Get a character, while interpreting entities. | |||
inline static const char* GetChar( const char* p, char* _value ) | inline static const char* GetChar( const char* p, char* _value ) | |||
{ | { | |||
assert( p ); | assert( p ); | |||
if ( *p == '&' ) | if ( *p == '&' ) | |||
{ | { | |||
skipping to change at line 632 | skipping to change at line 632 | |||
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; } | |||
/* [internal use] | /* [internal use] | |||
Attribtue parsing starts: first letter of the name | Attribtue 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, const TiXmlParsingData* da ta ); | virtual const char* Parse( const char* p, TiXmlParsingData* data ); | |||
// [internal use] | // [internal use] | |||
virtual void Print( FILE* cfile, int depth ) const; | virtual void Print( FILE* cfile, int depth ) const; | |||
virtual void StreamOut( TIXML_OSTREAM * out ) const; | virtual void StreamOut( TIXML_OSTREAM * out ) const; | |||
// [internal use] | // [internal use] | |||
// Set the document pointer so the attribute can report errors. | // Set the document pointer so the attribute can report errors. | |||
void SetDocument( TiXmlDocument* doc ) { document = doc; } | void SetDocument( TiXmlDocument* doc ) { document = doc; } | |||
private: | private: | |||
skipping to change at line 791 | skipping to change at line 791 | |||
// Used to be public [internal use] | // Used to be public [internal use] | |||
#ifdef TIXML_USE_STL | #ifdef TIXML_USE_STL | |||
virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag ); | virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag ); | |||
#endif | #endif | |||
virtual void StreamOut( TIXML_OSTREAM * out ) const; | virtual void StreamOut( TIXML_OSTREAM * out ) const; | |||
/* [internal use] | /* [internal use] | |||
Attribtue parsing starts: next char past '<' | Attribtue parsing starts: next char past '<' | |||
returns: next char past '>' | returns: next char past '>' | |||
*/ | */ | |||
virtual const char* Parse( const char* p, const TiXmlParsingData* da ta ); | virtual const char* Parse( const char* p, TiXmlParsingData* data ); | |||
/* [internal use] | /* [internal use] | |||
Reads the "value" of the element -- another element, or text . | Reads the "value" of the element -- another element, or text . | |||
This should terminate with the current end tag. | This should terminate with the current end tag. | |||
*/ | */ | |||
const char* ReadValue( const char* in, const TiXmlParsingData* prevD ata ); | const char* ReadValue( const char* in, TiXmlParsingData* prevData ); | |||
private: | private: | |||
TiXmlAttributeSet attributeSet; | TiXmlAttributeSet attributeSet; | |||
}; | }; | |||
/** An XML comment. | /** An XML comment. | |||
*/ | */ | |||
class TiXmlComment : public TiXmlNode | class TiXmlComment : public TiXmlNode | |||
{ | { | |||
public: | public: | |||
skipping to change at line 826 | skipping to change at line 826 | |||
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 ); | |||
#endif | #endif | |||
virtual void StreamOut( TIXML_OSTREAM * out ) const; | virtual void StreamOut( TIXML_OSTREAM * out ) const; | |||
/* [internal use] | /* [internal use] | |||
Attribtue parsing starts: at the ! of the !-- | Attribtue parsing starts: at the ! of the !-- | |||
returns: next char past '>' | returns: next char past '>' | |||
*/ | */ | |||
virtual const char* Parse( const char* p, const TiXmlParsingData* da ta ); | virtual const char* Parse( const char* p, TiXmlParsingData* data ); | |||
}; | }; | |||
/** XML text. Contained in an element. | /** XML text. Contained in an element. | |||
*/ | */ | |||
class TiXmlText : public TiXmlNode | class TiXmlText : public TiXmlNode | |||
{ | { | |||
friend class TiXmlElement; | friend class TiXmlElement; | |||
public: | public: | |||
/// Constructor. | /// Constructor. | |||
TiXmlText (const char * initValue) : TiXmlNode (TiXmlNode::TEXT) | TiXmlText (const char * initValue) : TiXmlNode (TiXmlNode::TEXT) | |||
skipping to change at line 863 | skipping to change at line 863 | |||
protected : | protected : | |||
// [internal use] Creates a new Element and returns it. | // [internal use] Creates a new Element and returns it. | |||
virtual TiXmlNode* Clone() const; | virtual TiXmlNode* Clone() const; | |||
virtual void StreamOut ( TIXML_OSTREAM * out ) const; | virtual void StreamOut ( TIXML_OSTREAM * out ) const; | |||
// [internal use] | // [internal use] | |||
bool Blank() const; // returns true if all white space and new l ines | bool Blank() const; // returns true if all white space and new l ines | |||
/* [internal use] | /* [internal use] | |||
Attribtue parsing starts: First char of the text | Attribtue parsing starts: First char of the text | |||
returns: next char past '>' | returns: next char past '>' | |||
*/ | */ | |||
virtual const char* Parse( const char* p, const TiXmlParsingData* da ta ); | virtual const char* Parse( const char* p, TiXmlParsingData* data ); | |||
// [internal use] | // [internal use] | |||
#ifdef TIXML_USE_STL | #ifdef TIXML_USE_STL | |||
virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag ); | virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag ); | |||
#endif | #endif | |||
}; | }; | |||
/** In correct XML the declaration is the first entry in the file. | /** In correct XML the declaration is the first entry in the file. | |||
@verbatim | @verbatim | |||
<?xml version="1.0" standalone="yes"?> | <?xml version="1.0" standalone="yes"?> | |||
@endverbatim | @endverbatim | |||
skipping to change at line 931 | skipping to change at line 931 | |||
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 ); | |||
#endif | #endif | |||
virtual void StreamOut ( TIXML_OSTREAM * out) const; | virtual void StreamOut ( TIXML_OSTREAM * out) const; | |||
// [internal use] | // [internal use] | |||
// Attribtue parsing starts: next char past '<' | // Attribtue parsing starts: next char past '<' | |||
// returns: next char past '>' | // returns: next char past '>' | |||
virtual const char* Parse( const char* p, const TiXmlParsingData* da ta ); | virtual const char* Parse( const char* p, TiXmlParsingData* data ); | |||
private: | private: | |||
TIXML_STRING version; | TIXML_STRING version; | |||
TIXML_STRING encoding; | TIXML_STRING encoding; | |||
TIXML_STRING standalone; | TIXML_STRING standalone; | |||
}; | }; | |||
/** Any tag that tinyXml doesn't recognize is saved as an | /** Any tag that tinyXml doesn't recognize is saved as an | |||
unknown. It is a tag of text, but should not be modified. | unknown. It is a tag of text, but should not be modified. | |||
It will be written back to the XML, unchanged, when the file | It will be written back to the XML, unchanged, when the file | |||
skipping to change at line 963 | skipping to change at line 963 | |||
virtual void Print( FILE* cfile, int depth ) const; | virtual void Print( FILE* cfile, int depth ) const; | |||
protected: | protected: | |||
#ifdef TIXML_USE_STL | #ifdef TIXML_USE_STL | |||
virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag ); | virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag ); | |||
#endif | #endif | |||
virtual void StreamOut ( TIXML_OSTREAM * out ) const; | virtual void StreamOut ( TIXML_OSTREAM * out ) const; | |||
/* [internal use] | /* [internal use] | |||
Attribute parsing starts: First char of the text | Attribute parsing starts: First char of the text | |||
returns: next char past '>' | returns: next char past '>' | |||
*/ | */ | |||
virtual const char* Parse( const char* p, const TiXmlParsingData* da ta ); | virtual const char* Parse( const char* p, TiXmlParsingData* data ); | |||
}; | }; | |||
/** Always the top level node. A document binds together all the | /** Always the top level node. A document binds together all the | |||
XML pieces. It can be saved, loaded, and printed to the screen. | XML pieces. It can be saved, loaded, and printed to the screen. | |||
The 'value' of a document node is the xml file name. | The 'value' of a document node is the xml file name. | |||
*/ | */ | |||
class TiXmlDocument : public TiXmlNode | class TiXmlDocument : public TiXmlNode | |||
{ | { | |||
public: | public: | |||
/// Create an empty document, that has no name. | /// Create an empty document, that has no name. | |||
skipping to change at line 1017 | skipping to change at line 1017 | |||
} | } | |||
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 )); | |||
} | } | |||
#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, const TiXmlParsingData* da ta = 0 ); | virtual const char* Parse( const char* p, TiXmlParsingData* data = 0 ); | |||
/** 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 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) | |||
skipping to change at line 1057 | skipping to change at line 1057 | |||
int ErrorRow() { return errorLocation.row+1; } | int ErrorRow() { return errorLocation.row+1; } | |||
int ErrorCol() { return errorLocation.col+1; } ///< The column wher e the error occured. See ErrorRow() | int ErrorCol() { return errorLocation.col+1; } ///< The column wher e the error occured. See ErrorRow() | |||
/** 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. | |||
The tab size is required for calculating the location of nod es. If not | The tab size is required for calculating the location of nod es. If not | |||
set, the default of 4 is used. The tabsize is set per docume nt. Setting | set, the default of 4 is used. The tabsize is set per docume nt. Setting | |||
the tabsize to 0 disables row/column tracking (which has a m | the tabsize to 0 disables row/column tracking. | |||
inor performance | ||||
cost.) | ||||
Note that row and column tracking is not supported when usin g operator>>. | Note that row and column tracking is not supported when usin g operator>>. | |||
The tab size needs to be enabled before the parse or load. C orrect usage: | The tab size needs to be enabled before the parse or load. C orrect usage: | |||
@verbatim | @verbatim | |||
TiXmlDocument doc; | TiXmlDocument doc; | |||
doc.SetTabSize( 8 ); | doc.SetTabSize( 8 ); | |||
doc.Load( "myfile.xml" ); | doc.Load( "myfile.xml" ); | |||
@endverbatim | @endverbatim | |||
skipping to change at line 1091 | skipping to change at line 1090 | |||
errorLocation.row = errorLocation.col = 0; | errorLocation.row = errorLocation.col = 0; | |||
//errorLocation.last = 0; | //errorLocation.last = 0; | |||
} | } | |||
/** Dump the document to standard out. */ | /** Dump the document to standard out. */ | |||
void Print() const { Pr int( 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, const char* errorLocation, const TiXmlParsin gData* prevData ); | void SetError( int err, const char* errorLocation, TiXmlParsingData* prevData ); | |||
protected : | protected : | |||
virtual void StreamOut ( TIXML_OSTREAM * out) const; | virtual void StreamOut ( TIXML_OSTREAM * out) const; | |||
// [internal use] | // [internal use] | |||
virtual TiXmlNode* Clone() const; | virtual TiXmlNode* Clone() const; | |||
#ifdef TIXML_USE_STL | #ifdef TIXML_USE_STL | |||
virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag ); | virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag ); | |||
#endif | #endif | |||
private: | private: | |||
End of changes. 11 change blocks. | ||||
13 lines changed or deleted | 11 lines changed or added | |||