OBTtinyxml.h

Go to the documentation of this file.
00001 /*
00002 www.sourceforge.net/projects/tinyxml
00003 Original code (2.0 and earlier )copyright (c) 2000-2006 Lee Thomason (www.grinninglizard.com)
00004 
00005 This software is provided 'as-is', without any express or implied
00006 warranty. In no event will the authors be held liable for any
00007 damages arising from the use of this software.
00008 
00009 Permission is granted to anyone to use this software for any
00010 purpose, including commercial applications, and to alter it and
00011 redistribute it freely, subject to the following restrictions:
00012 
00013 1. The origin of this software must not be misrepresented; you must
00014 not claim that you wrote the original software. If you use this
00015 software in a product, an acknowledgment in the product documentation
00016 would be appreciated but is not required.
00017 
00018 2. Altered source versions must be plainly marked as such, and
00019 must not be misrepresented as being the original software.
00020 
00021 3. This notice may not be removed or altered from any source
00022 distribution.
00023 */
00024 
00025 
00026 #ifndef XMLTINY_TINYXML_INCLUDED
00027 #define XMLTINY_TINYXML_INCLUDED
00028 
00029 #ifndef TIXML_USE_STL
00030         #define TIXML_USE_STL
00031 #endif
00032 
00033 #ifdef _MSC_VER
00034 #pragma warning( push )
00035 #pragma warning( disable : 4530 )
00036 #pragma warning( disable : 4786 )
00037 #endif
00038 
00039 #include <ctype.h>
00040 #include <stdio.h>
00041 #include <stdlib.h>
00042 #include <string.h>
00043 #include <assert.h>
00044 
00045 // Help out windows:
00046 #if defined( _DEBUG ) && !defined( DEBUG )
00047 #define DEBUG
00048 #endif
00049 
00050 #ifdef TIXML_USE_STL
00051         #include <string>
00052         #include <iostream>
00053         #include <sstream>
00054         #define TIXML_STRING            std::string
00055 #else
00056         #include "xmlTiny_tinystr.h"
00057         #define TIXML_STRING            TiXmlString
00058 #endif
00059 
00060 // Deprecated library function hell. Compilers want to use the
00061 // new safe versions. This probably doesn't fully address the problem,
00062 // but it gets closer. There are too many compilers for me to fully
00063 // test. If you get compilation troubles, undefine TIXML_SAFE
00064 #define TIXML_SAFE
00065 
00066 #ifdef TIXML_SAFE
00067         #if defined(_MSC_VER) && (_MSC_VER >= 1400 )
00068                 // Microsoft visual studio, version 2005 and higher.
00069                 #define TIXML_SNPRINTF _snprintf_s
00070                 #define TIXML_SNSCANF  _snscanf_s
00071                 #define TIXML_SSCANF   sscanf_s
00072         #elif defined(_MSC_VER) && (_MSC_VER >= 1200 )
00073                 // Microsoft visual studio, version 6 and higher.
00074                 //#pragma message( "Using _sn* functions." )
00075                 #define TIXML_SNPRINTF _snprintf
00076                 #define TIXML_SNSCANF  _snscanf
00077                 #define TIXML_SSCANF   sscanf
00078         #elif defined(__GNUC__) && (__GNUC__ >= 3 )
00079                 // GCC version 3 and higher.s
00080                 //#warning( "Using sn* functions." )
00081                 #define TIXML_SNPRINTF snprintf
00082                 #define TIXML_SNSCANF  snscanf
00083                 #define TIXML_SSCANF   sscanf
00084         #else
00085                 #define TIXML_SSCANF   sscanf
00086         #endif
00087 #endif  
00088 
00089 namespace xmlTiny
00090 {
00091 class TiXmlDocument;
00092 class TiXmlElement;
00093 class TiXmlComment;
00094 class TiXmlUnknown;
00095 class TiXmlAttribute;
00096 class TiXmlText;
00097 class TiXmlDeclaration;
00098 class TiXmlParsingData;
00099 
00100 const int TIXML_MAJOR_VERSION = 2;
00101 const int TIXML_MINOR_VERSION = 5;
00102 const int TIXML_PATCH_VERSION = 3;
00103 
00104 /*      Internal structure for tracking location of items 
00105         in the XML file.
00106 */
00107 struct TiXmlCursor
00108 {
00109         TiXmlCursor()           { Clear(); }
00110         void Clear()            { row = col = -1; }
00111 
00112         int row;        // 0 based.
00113         int col;        // 0 based.
00114 };
00115 
00116 
00135 class TiXmlVisitor
00136 {
00137 public:
00138         virtual ~TiXmlVisitor() {}
00139 
00141         virtual bool VisitEnter( const TiXmlDocument& /*doc*/ )                 { return true; }
00143         virtual bool VisitExit( const TiXmlDocument& /*doc*/ )                  { return true; }
00144 
00146         virtual bool VisitEnter( const TiXmlElement& /*element*/, const TiXmlAttribute* /*firstAttribute*/ )    { return true; }
00148         virtual bool VisitExit( const TiXmlElement& /*element*/ )               { return true; }
00149 
00151         virtual bool Visit( const TiXmlDeclaration& /*declaration*/ )   { return true; }
00153         virtual bool Visit( const TiXmlText& /*text*/ )                                 { return true; }
00155         virtual bool Visit( const TiXmlComment& /*comment*/ )                   { return true; }
00157         virtual bool Visit( const TiXmlUnknown& /*unknown*/ )                   { return true; }
00158 };
00159 
00160 // Only used by Attribute::Query functions
00161 enum 
00162 { 
00163         TIXML_SUCCESS,
00164         TIXML_NO_ATTRIBUTE,
00165         TIXML_WRONG_TYPE
00166 };
00167 
00168 
00169 // Used by the parsing routines.
00170 enum TiXmlEncoding
00171 {
00172         TIXML_ENCODING_UNKNOWN,
00173         TIXML_ENCODING_UTF8,
00174         TIXML_ENCODING_LEGACY
00175 };
00176 
00177 const TiXmlEncoding TIXML_DEFAULT_ENCODING = TIXML_ENCODING_UNKNOWN;
00178 
00201 class TiXmlBase
00202 {
00203         friend class TiXmlNode;
00204         friend class TiXmlElement;
00205         friend class TiXmlDocument;
00206 
00207 public:
00208         TiXmlBase()     :       userData(0)             {}
00209         virtual ~TiXmlBase()                    {}
00210 
00220         virtual void Print( FILE* cfile, int depth ) const = 0;
00221 
00228         static void SetCondenseWhiteSpace( bool condense )              { condenseWhiteSpace = condense; }
00229 
00231         static bool IsWhiteSpaceCondensed()                                             { return condenseWhiteSpace; }
00232 
00251         int Row() const                 { return location.row + 1; }
00252         int Column() const              { return location.col + 1; }    
00253 
00254         void  SetUserData( void* user )                 { userData = user; }    
00255         void* GetUserData()                                             { return userData; }    
00256         const void* GetUserData() const                 { return userData; }    
00257 
00258         // Table that returs, for a given lead byte, the total number of bytes
00259         // in the UTF-8 sequence.
00260         static const int utf8ByteTable[256];
00261 
00262         virtual const char* Parse(      const char* p, 
00263                                                                 TiXmlParsingData* data, 
00264                                                                 TiXmlEncoding encoding /*= TIXML_ENCODING_UNKNOWN */ ) = 0;
00265 
00269         static void EncodeString( const TIXML_STRING& str, TIXML_STRING* out );
00270 
00271         enum
00272         {
00273                 TIXML_NO_ERROR = 0,
00274                 TIXML_ERROR,
00275                 TIXML_ERROR_OPENING_FILE,
00276                 TIXML_ERROR_OUT_OF_MEMORY,
00277                 TIXML_ERROR_PARSING_ELEMENT,
00278                 TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME,
00279                 TIXML_ERROR_READING_ELEMENT_VALUE,
00280                 TIXML_ERROR_READING_ATTRIBUTES,
00281                 TIXML_ERROR_PARSING_EMPTY,
00282                 TIXML_ERROR_READING_END_TAG,
00283                 TIXML_ERROR_PARSING_UNKNOWN,
00284                 TIXML_ERROR_PARSING_COMMENT,
00285                 TIXML_ERROR_PARSING_DECLARATION,
00286                 TIXML_ERROR_DOCUMENT_EMPTY,
00287                 TIXML_ERROR_EMBEDDED_NULL,
00288                 TIXML_ERROR_PARSING_CDATA,
00289                 TIXML_ERROR_DOCUMENT_TOP_ONLY,
00290 
00291                 TIXML_ERROR_STRING_COUNT
00292         };
00293 
00294 protected:
00295 
00296         static const char* SkipWhiteSpace( const char*, TiXmlEncoding encoding );
00297         inline static bool IsWhiteSpace( char c )               
00298         { 
00299                 return ( isspace( (unsigned char) c ) || c == '\n' || c == '\r' ); 
00300         }
00301         inline static bool IsWhiteSpace( int c )
00302         {
00303                 if ( c < 256 )
00304                         return IsWhiteSpace( (char) c );
00305                 return false;   // Again, only truly correct for English/Latin...but usually works.
00306         }
00307 
00308         #ifdef TIXML_USE_STL
00309         static bool     StreamWhiteSpace( std::istream * in, TIXML_STRING * tag );
00310         static bool StreamTo( std::istream * in, int character, TIXML_STRING * tag );
00311         #endif
00312 
00313         /*      Reads an XML name into the string provided. Returns
00314                 a pointer just past the last character of the name,
00315                 or 0 if the function has an error.
00316         */
00317         static const char* ReadName( const char* p, TIXML_STRING* name, TiXmlEncoding encoding );
00318 
00319         /*      Reads text. Returns a pointer past the given end tag.
00320                 Wickedly complex options, but it keeps the (sensitive) code in one place.
00321         */
00322         static const char* ReadText(    const char* in,                         // where to start
00323                                                                         TIXML_STRING* text,                     // the string read
00324                                                                         bool ignoreWhiteSpace,          // whether to keep the white space
00325                                                                         const char* endTag,                     // what ends this text
00326                                                                         bool ignoreCase,                        // whether to ignore case in the end tag
00327                                                                         TiXmlEncoding encoding );       // the current encoding
00328 
00329         // If an entity has been found, transform it into a character.
00330         static const char* GetEntity( const char* in, char* value, int* length, TiXmlEncoding encoding );
00331 
00332         // Get a character, while interpreting entities.
00333         // The length can be from 0 to 4 bytes.
00334         inline static const char* GetChar( const char* p, char* _value, int* length, TiXmlEncoding encoding )
00335         {
00336                 assert( p );
00337                 if ( encoding == TIXML_ENCODING_UTF8 )
00338                 {
00339                         *length = utf8ByteTable[ *((const unsigned char*)p) ];
00340                         assert( *length >= 0 && *length < 5 );
00341                 }
00342                 else
00343                 {
00344                         *length = 1;
00345                 }
00346 
00347                 if ( *length == 1 )
00348                 {
00349                         if ( *p == '&' )
00350                                 return GetEntity( p, _value, length, encoding );
00351                         *_value = *p;
00352                         return p+1;
00353                 }
00354                 else if ( *length )
00355                 {
00356                         //strncpy( _value, p, *length );        // lots of compilers don't like this function (unsafe),
00357                                                                                                 // and the null terminator isn't needed
00358                         for( int i=0; p[i] && i<*length; ++i ) {
00359                                 _value[i] = p[i];
00360                         }
00361                         return p + (*length);
00362                 }
00363                 else
00364                 {
00365                         // Not valid text.
00366                         return 0;
00367                 }
00368         }
00369 
00370         // Return true if the next characters in the stream are any of the endTag sequences.
00371         // Ignore case only works for english, and should only be relied on when comparing
00372         // to English words: StringEqual( p, "version", true ) is fine.
00373         static bool StringEqual(        const char* p,
00374                                                                 const char* endTag,
00375                                                                 bool ignoreCase,
00376                                                                 TiXmlEncoding encoding );
00377 
00378         static const char* errorString[ TIXML_ERROR_STRING_COUNT ];
00379 
00380         TiXmlCursor location;
00381 
00383         void*                   userData;
00384         
00385         // None of these methods are reliable for any language except English.
00386         // Good for approximation, not great for accuracy.
00387         static int IsAlpha( unsigned char anyByte, TiXmlEncoding encoding );
00388         static int IsAlphaNum( unsigned char anyByte, TiXmlEncoding encoding );
00389         inline static int ToLower( int v, TiXmlEncoding encoding )
00390         {
00391                 if ( encoding == TIXML_ENCODING_UTF8 )
00392                 {
00393                         if ( v < 128 ) return tolower( v );
00394                         return v;
00395                 }
00396                 else
00397                 {
00398                         return tolower( v );
00399                 }
00400         }
00401         static void ConvertUTF32ToUTF8( unsigned long input, char* output, int* length );
00402 
00403 private:
00404         TiXmlBase( const TiXmlBase& );                          // not implemented.
00405         void operator=( const TiXmlBase& base );        // not allowed.
00406 
00407         struct Entity
00408         {
00409                 const char*     str;
00410                 unsigned int    strLength;
00411                 char                chr;
00412         };
00413         enum
00414         {
00415                 NUM_ENTITY = 5,
00416                 MAX_ENTITY_LENGTH = 6
00417 
00418         };
00419         static Entity entity[ NUM_ENTITY ];
00420         static bool condenseWhiteSpace;
00421 };
00422 
00423 
00430 class TiXmlNode : public TiXmlBase
00431 {
00432         friend class TiXmlDocument;
00433         friend class TiXmlElement;
00434 
00435 public:
00436         #ifdef TIXML_USE_STL    
00437 
00441             friend std::istream& operator >> (std::istream& in, TiXmlNode& base);
00442 
00459             friend std::ostream& operator<< (std::ostream& out, const TiXmlNode& base);
00460 
00462                 friend std::string& operator<< (std::string& out, const TiXmlNode& base );
00463 
00464         #endif
00465 
00469         enum NodeType
00470         {
00471                 DOCUMENT,
00472                 ELEMENT,
00473                 COMMENT,
00474                 UNKNOWN,
00475                 TEXT,
00476                 DECLARATION,
00477                 TYPECOUNT
00478         };
00479 
00480         virtual ~TiXmlNode();
00481 
00494         const char *Value() const { return value.c_str (); }
00495 
00496     #ifdef TIXML_USE_STL
00497 
00501         const std::string& ValueStr() const { return value; }
00502         #endif
00503 
00504         const TIXML_STRING& ValueTStr() const { return value; }
00505 
00515         void SetValue(const char * _value) { value = _value;}
00516 
00517     #ifdef TIXML_USE_STL
00519         void SetValue( const std::string& _value )      { value = _value; }
00520         #endif
00521 
00523         void Clear();
00524 
00526         TiXmlNode* Parent()                                                     { return parent; }
00527         const TiXmlNode* Parent() const                         { return parent; }
00528 
00529         const TiXmlNode* FirstChild()   const           { return firstChild; }  
00530         TiXmlNode* FirstChild()                                         { return firstChild; }
00531         const TiXmlNode* FirstChild( const char * value ) const;                        
00532 
00533         TiXmlNode* FirstChild( const char * _value ) {
00534                 // Call through to the const version - safe since nothing is changed. Exiting syntax: cast this to a const (always safe)
00535                 // call the method, cast the return back to non-const.
00536                 return const_cast< TiXmlNode* > ((const_cast< const TiXmlNode* >(this))->FirstChild( _value ));
00537         }
00538         const TiXmlNode* LastChild() const      { return lastChild; }           
00539         TiXmlNode* LastChild()  { return lastChild; }
00540         
00541         const TiXmlNode* LastChild( const char * value ) const;                 
00542         TiXmlNode* LastChild( const char * _value ) {
00543                 return const_cast< TiXmlNode* > ((const_cast< const TiXmlNode* >(this))->LastChild( _value ));
00544         }
00545 
00546     #ifdef TIXML_USE_STL
00547         const TiXmlNode* FirstChild( const std::string& _value ) const  {       return FirstChild (_value.c_str ());    }       
00548         TiXmlNode* FirstChild( const std::string& _value )                              {       return FirstChild (_value.c_str ());    }       
00549         const TiXmlNode* LastChild( const std::string& _value ) const   {       return LastChild (_value.c_str ());     }       
00550         TiXmlNode* LastChild( const std::string& _value )                               {       return LastChild (_value.c_str ());     }       
00551         #endif
00552 
00569         const TiXmlNode* IterateChildren( const TiXmlNode* previous ) const;
00570         TiXmlNode* IterateChildren( const TiXmlNode* previous ) {
00571                 return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->IterateChildren( previous ) );
00572         }
00573 
00575         const TiXmlNode* IterateChildren( const char * value, const TiXmlNode* previous ) const;
00576         TiXmlNode* IterateChildren( const char * _value, const TiXmlNode* previous ) {
00577                 return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->IterateChildren( _value, previous ) );
00578         }
00579 
00580     #ifdef TIXML_USE_STL
00581         const TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNode* previous ) const  {       return IterateChildren (_value.c_str (), previous);     }       
00582         TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNode* previous ) {    return IterateChildren (_value.c_str (), previous);     }       
00583         #endif
00584 
00588         TiXmlNode* InsertEndChild( const TiXmlNode& addThis );
00589 
00590 
00600         TiXmlNode* LinkEndChild( TiXmlNode* addThis );
00601 
00605         TiXmlNode* InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis );
00606 
00610         TiXmlNode* InsertAfterChild(  TiXmlNode* afterThis, const TiXmlNode& addThis );
00611 
00615         TiXmlNode* ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& withThis );
00616 
00618         bool RemoveChild( TiXmlNode* removeThis );
00619 
00621         const TiXmlNode* PreviousSibling() const                        { return prev; }
00622         TiXmlNode* PreviousSibling()                                            { return prev; }
00623 
00625         const TiXmlNode* PreviousSibling( const char * ) const;
00626         TiXmlNode* PreviousSibling( const char *_prev ) {
00627                 return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->PreviousSibling( _prev ) );
00628         }
00629 
00630     #ifdef TIXML_USE_STL
00631         const TiXmlNode* PreviousSibling( const std::string& _value ) const     {       return PreviousSibling (_value.c_str ());       }       
00632         TiXmlNode* PreviousSibling( const std::string& _value )                         {       return PreviousSibling (_value.c_str ());       }       
00633         const TiXmlNode* NextSibling( const std::string& _value) const          {       return NextSibling (_value.c_str ());   }       
00634         TiXmlNode* NextSibling( const std::string& _value)                                      {       return NextSibling (_value.c_str ());   }       
00635         #endif
00636 
00638         const TiXmlNode* NextSibling() const                            { return next; }
00639         TiXmlNode* NextSibling()                                                        { return next; }
00640 
00642         const TiXmlNode* NextSibling( const char * ) const;
00643         TiXmlNode* NextSibling( const char* _next ) {
00644                 return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->NextSibling( _next ) );
00645         }
00646 
00651         const TiXmlElement* NextSiblingElement() const;
00652         TiXmlElement* NextSiblingElement() {
00653                 return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->NextSiblingElement() );
00654         }
00655 
00660         const TiXmlElement* NextSiblingElement( const char * ) const;
00661         TiXmlElement* NextSiblingElement( const char *_next ) {
00662                 return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->NextSiblingElement( _next ) );
00663         }
00664 
00665     #ifdef TIXML_USE_STL
00666         const TiXmlElement* NextSiblingElement( const std::string& _value) const        {       return NextSiblingElement (_value.c_str ());    }       
00667         TiXmlElement* NextSiblingElement( const std::string& _value)                            {       return NextSiblingElement (_value.c_str ());    }       
00668         #endif
00669 
00671         const TiXmlElement* FirstChildElement() const;
00672         TiXmlElement* FirstChildElement() {
00673                 return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->FirstChildElement() );
00674         }
00675 
00677         const TiXmlElement* FirstChildElement( const char * _value ) const;
00678         TiXmlElement* FirstChildElement( const char * _value ) {
00679                 return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->FirstChildElement( _value ) );
00680         }
00681 
00682     #ifdef TIXML_USE_STL
00683         const TiXmlElement* FirstChildElement( const std::string& _value ) const        {       return FirstChildElement (_value.c_str ());     }       
00684         TiXmlElement* FirstChildElement( const std::string& _value )                            {       return FirstChildElement (_value.c_str ());     }       
00685         #endif
00686 
00691         int Type() const        { return type; }
00692 
00696         const TiXmlDocument* GetDocument() const;
00697         TiXmlDocument* GetDocument() {
00698                 return const_cast< TiXmlDocument* >( (const_cast< const TiXmlNode* >(this))->GetDocument() );
00699         }
00700 
00702         bool NoChildren() const                                         { return !firstChild; }
00703 
00704         virtual const TiXmlDocument*    ToDocument()    const { return 0; } 
00705         virtual const TiXmlElement*     ToElement()     const { return 0; } 
00706         virtual const TiXmlComment*     ToComment()     const { return 0; } 
00707         virtual const TiXmlUnknown*     ToUnknown()     const { return 0; } 
00708         virtual const TiXmlText*        ToText()        const { return 0; } 
00709         virtual const TiXmlDeclaration* ToDeclaration() const { return 0; } 
00710 
00711         virtual TiXmlDocument*          ToDocument()    { return 0; } 
00712         virtual TiXmlElement*           ToElement()         { return 0; } 
00713         virtual TiXmlComment*           ToComment()     { return 0; } 
00714         virtual TiXmlUnknown*           ToUnknown()         { return 0; } 
00715         virtual TiXmlText*                  ToText()        { return 0; } 
00716         virtual TiXmlDeclaration*       ToDeclaration() { return 0; } 
00717 
00721         virtual TiXmlNode* Clone() const = 0;
00722 
00745         virtual bool Accept( TiXmlVisitor* visitor ) const = 0;
00746 
00747 protected:
00748         TiXmlNode( NodeType _type );
00749 
00750         // Copy to the allocated object. Shared functionality between Clone, Copy constructor,
00751         // and the assignment operator.
00752         void CopyTo( TiXmlNode* target ) const;
00753 
00754         #ifdef TIXML_USE_STL
00755             // The real work of the input operator.
00756         virtual void StreamIn( std::istream* in, TIXML_STRING* tag ) = 0;
00757         #endif
00758 
00759         // Figure out what is at *p, and parse it. Returns null if it is not an xml node.
00760         TiXmlNode* Identify( const char* start, TiXmlEncoding encoding );
00761 
00762         TiXmlNode*              parent;
00763         NodeType                type;
00764 
00765         TiXmlNode*              firstChild;
00766         TiXmlNode*              lastChild;
00767 
00768         TIXML_STRING    value;
00769 
00770         TiXmlNode*              prev;
00771         TiXmlNode*              next;
00772 
00773 private:
00774         TiXmlNode( const TiXmlNode& );                          // not implemented.
00775         void operator=( const TiXmlNode& base );        // not allowed.
00776 };
00777 
00785 class TiXmlAttribute : public TiXmlBase
00786 {
00787         friend class TiXmlAttributeSet;
00788 
00789 public:
00791         TiXmlAttribute() : TiXmlBase()
00792         {
00793                 document = 0;
00794                 prev = next = 0;
00795         }
00796 
00797         #ifdef TIXML_USE_STL
00799         TiXmlAttribute( const std::string& _name, const std::string& _value )
00800         {
00801                 name = _name;
00802                 value = _value;
00803                 document = 0;
00804                 prev = next = 0;
00805         }
00806         #endif
00807 
00809         TiXmlAttribute( const char * _name, const char * _value )
00810         {
00811                 name = _name;
00812                 value = _value;
00813                 document = 0;
00814                 prev = next = 0;
00815         }
00816 
00817         const char*             Name()  const           { return name.c_str(); }                
00818         const char*             Value() const           { return value.c_str(); }               
00819         #ifdef TIXML_USE_STL
00820         const std::string& ValueStr() const     { return value; }                               
00821         #endif
00822         int                             IntValue() const;                                                                       
00823         double                  DoubleValue() const;                                                            
00824 
00825         // Get the tinyxml string representation
00826         const TIXML_STRING& NameTStr() const { return name; }
00827 
00837         int QueryIntValue( int* _value ) const;
00839         int QueryDoubleValue( double* _value ) const;
00840 
00841         void SetName( const char* _name )       { name = _name; }                               
00842         void SetValue( const char* _value )     { value = _value; }                             
00843 
00844         void SetIntValue( int _value );                                                                         
00845         void SetDoubleValue( double _value );                                                           
00846 
00847     #ifdef TIXML_USE_STL
00849         void SetName( const std::string& _name )        { name = _name; }       
00851         void SetValue( const std::string& _value )      { value = _value; }
00852         #endif
00853 
00855         const TiXmlAttribute* Next() const;
00856         TiXmlAttribute* Next() {
00857                 return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Next() ); 
00858         }
00859 
00861         const TiXmlAttribute* Previous() const;
00862         TiXmlAttribute* Previous() {
00863                 return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Previous() ); 
00864         }
00865 
00866         bool operator==( const TiXmlAttribute& rhs ) const { return rhs.name == name; }
00867         bool operator<( const TiXmlAttribute& rhs )      const { return name < rhs.name; }
00868         bool operator>( const TiXmlAttribute& rhs )  const { return name > rhs.name; }
00869 
00870         /*      Attribute parsing starts: first letter of the name
00871                                                  returns: the next char after the value end quote
00872         */
00873         virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
00874 
00875         // Prints this Attribute to a FILE stream.
00876         virtual void Print( FILE* cfile, int depth ) const {
00877                 Print( cfile, depth, 0 );
00878         }
00879         void Print( FILE* cfile, int depth, TIXML_STRING* str ) const;
00880 
00881         // [internal use]
00882         // Set the document pointer so the attribute can report errors.
00883         void SetDocument( TiXmlDocument* doc )  { document = doc; }
00884 
00885 private:
00886         TiXmlAttribute( const TiXmlAttribute& );                                // not implemented.
00887         void operator=( const TiXmlAttribute& base );   // not allowed.
00888 
00889         TiXmlDocument*  document;       // A pointer back to a document, for error reporting.
00890         TIXML_STRING name;
00891         TIXML_STRING value;
00892         TiXmlAttribute* prev;
00893         TiXmlAttribute* next;
00894 };
00895 
00896 
00897 /*      A class used to manage a group of attributes.
00898         It is only used internally, both by the ELEMENT and the DECLARATION.
00899         
00900         The set can be changed transparent to the Element and Declaration
00901         classes that use it, but NOT transparent to the Attribute
00902         which has to implement a next() and previous() method. Which makes
00903         it a bit problematic and prevents the use of STL.
00904 
00905         This version is implemented with circular lists because:
00906                 - I like circular lists
00907                 - it demonstrates some independence from the (typical) doubly linked list.
00908 */
00909 class TiXmlAttributeSet
00910 {
00911 public:
00912         TiXmlAttributeSet();
00913         ~TiXmlAttributeSet();
00914 
00915         void Add( TiXmlAttribute* attribute );
00916         void Remove( TiXmlAttribute* attribute );
00917 
00918         const TiXmlAttribute* First()   const   { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; }
00919         TiXmlAttribute* First()                                 { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; }
00920         const TiXmlAttribute* Last() const              { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; }
00921         TiXmlAttribute* Last()                                  { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; }
00922 
00923         const TiXmlAttribute*   Find( const char* _name ) const;
00924         TiXmlAttribute* Find( const char* _name ) {
00925                 return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttributeSet* >(this))->Find( _name ) );
00926         }
00927         #ifdef TIXML_USE_STL
00928         const TiXmlAttribute*   Find( const std::string& _name ) const;
00929         TiXmlAttribute* Find( const std::string& _name ) {
00930                 return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttributeSet* >(this))->Find( _name ) );
00931         }
00932 
00933         #endif
00934 
00935 private:
00936         //*ME:  Because of hidden/disabled copy-construktor in TiXmlAttribute (sentinel-element),
00937         //*ME:  this class must be also use a hidden/disabled copy-constructor !!!
00938         TiXmlAttributeSet( const TiXmlAttributeSet& );  // not allowed
00939         void operator=( const TiXmlAttributeSet& );     // not allowed (as TiXmlAttribute)
00940 
00941         TiXmlAttribute sentinel;
00942 };
00943 
00944 
00949 class TiXmlElement : public TiXmlNode
00950 {
00951 public:
00953         TiXmlElement (const char * in_value);
00954 
00955         #ifdef TIXML_USE_STL
00957         TiXmlElement( const std::string& _value );
00958         #endif
00959 
00960         TiXmlElement( const TiXmlElement& );
00961 
00962         void operator=( const TiXmlElement& base );
00963 
00964         virtual ~TiXmlElement();
00965 
00969         const char* Attribute( const char* name ) const;
00970 
00977         const char* Attribute( const char* name, int* i ) const;
00978 
00985         const char* Attribute( const char* name, double* d ) const;
00986 
00994         int QueryIntAttribute( const char* name, int* _value ) const;
00996         int QueryDoubleAttribute( const char* name, double* _value ) const;
00998         int QueryFloatAttribute( const char* name, float* _value ) const {
00999                 double d;
01000                 int result = QueryDoubleAttribute( name, &d );
01001                 if ( result == TIXML_SUCCESS ) {
01002                         *_value = (float)d;
01003                 }
01004                 return result;
01005         }
01006 
01007     #ifdef TIXML_USE_STL
01008 
01016         template< typename T > int QueryValueAttribute( const std::string& name, T* outValue ) const
01017         {
01018                 const TiXmlAttribute* node = attributeSet.Find( name );
01019                 if ( !node )
01020                         return TIXML_NO_ATTRIBUTE;
01021 
01022                 std::stringstream sstream( node->ValueStr() );
01023                 sstream >> *outValue;
01024                 if ( !sstream.fail() )
01025                         return TIXML_SUCCESS;
01026                 return TIXML_WRONG_TYPE;
01027         }
01028         /*
01029          This is - in theory - a bug fix for "QueryValueAtribute returns truncated std::string"
01030          but template specialization is hard to get working cross-compiler. Leaving the bug for now.
01031          
01032         // The above will fail for std::string because the space character is used as a seperator.
01033         // Specialize for strings. Bug [ 1695429 ] QueryValueAtribute returns truncated std::string
01034         template<> int QueryValueAttribute( const std::string& name, std::string* outValue ) const
01035         {
01036                 const TiXmlAttribute* node = attributeSet.Find( name );
01037                 if ( !node )
01038                         return TIXML_NO_ATTRIBUTE;
01039                 *outValue = node->ValueStr();
01040                 return TIXML_SUCCESS;
01041         }
01042         */
01043         #endif
01044 
01048         void SetAttribute( const char* name, const char * _value );
01049 
01050     #ifdef TIXML_USE_STL
01051         const std::string* Attribute( const std::string& name ) const;
01052         const std::string* Attribute( const std::string& name, int* i ) const;
01053         const std::string* Attribute( const std::string& name, double* d ) const;
01054         int QueryIntAttribute( const std::string& name, int* _value ) const;
01055         int QueryDoubleAttribute( const std::string& name, double* _value ) const;
01056 
01058         void SetAttribute( const std::string& name, const std::string& _value );
01060         void SetAttribute( const std::string& name, int _value );
01061         #endif
01062 
01066         void SetAttribute( const char * name, int value );
01067 
01071         void SetDoubleAttribute( const char * name, double value );
01072 
01075         void RemoveAttribute( const char * name );
01076     #ifdef TIXML_USE_STL
01077         void RemoveAttribute( const std::string& name ) {       RemoveAttribute (name.c_str ());        }       
01078         #endif
01079 
01080         const TiXmlAttribute* FirstAttribute() const    { return attributeSet.First(); }                
01081         TiXmlAttribute* FirstAttribute()                                { return attributeSet.First(); }
01082         const TiXmlAttribute* LastAttribute()   const   { return attributeSet.Last(); }         
01083         TiXmlAttribute* LastAttribute()                                 { return attributeSet.Last(); }
01084 
01117         const char* GetText() const;
01118 
01120         virtual TiXmlNode* Clone() const;
01121         // Print the Element to a FILE stream.
01122         virtual void Print( FILE* cfile, int depth ) const;
01123 
01124         /*      Attribtue parsing starts: next char past '<'
01125                                                  returns: next char past '>'
01126         */
01127         virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
01128 
01129         virtual const TiXmlElement*     ToElement()     const { return this; } 
01130         virtual TiXmlElement*           ToElement()               { return this; } 
01131 
01134         virtual bool Accept( TiXmlVisitor* visitor ) const;
01135 
01136 protected:
01137 
01138         void CopyTo( TiXmlElement* target ) const;
01139         void ClearThis();       // like clear, but initializes 'this' object as well
01140 
01141         // Used to be public [internal use]
01142         #ifdef TIXML_USE_STL
01143         virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
01144         #endif
01145         /*      [internal use]
01146                 Reads the "value" of the element -- another element, or text.
01147                 This should terminate with the current end tag.
01148         */
01149         const char* ReadValue( const char* in, TiXmlParsingData* prevData, TiXmlEncoding encoding );
01150 
01151 private:
01152 
01153         TiXmlAttributeSet attributeSet;
01154 };
01155 
01156 
01159 class TiXmlComment : public TiXmlNode
01160 {
01161 public:
01163         TiXmlComment() : TiXmlNode( TiXmlNode::COMMENT ) {}
01165         TiXmlComment( const char* _value ) : TiXmlNode( TiXmlNode::COMMENT ) {
01166                 SetValue( _value );
01167         }
01168         TiXmlComment( const TiXmlComment& );
01169         void operator=( const TiXmlComment& base );
01170 
01171         virtual ~TiXmlComment() {}
01172 
01174         virtual TiXmlNode* Clone() const;
01175         // Write this Comment to a FILE stream.
01176         virtual void Print( FILE* cfile, int depth ) const;
01177 
01178         /*      Attribtue parsing starts: at the ! of the !--
01179                                                  returns: next char past '>'
01180         */
01181         virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
01182 
01183         virtual const TiXmlComment*  ToComment() const { return this; } 
01184         virtual TiXmlComment*  ToComment() { return this; } 
01185 
01188         virtual bool Accept( TiXmlVisitor* visitor ) const;
01189 
01190 protected:
01191         void CopyTo( TiXmlComment* target ) const;
01192 
01193         // used to be public
01194         #ifdef TIXML_USE_STL
01195         virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
01196         #endif
01197 //      virtual void StreamOut( TIXML_OSTREAM * out ) const;
01198 
01199 private:
01200 
01201 };
01202 
01203 
01209 class TiXmlText : public TiXmlNode
01210 {
01211         friend class TiXmlElement;
01212 public:
01217         TiXmlText (const char * initValue ) : TiXmlNode (TiXmlNode::TEXT)
01218         {
01219                 SetValue( initValue );
01220                 cdata = false;
01221         }
01222         virtual ~TiXmlText() {}
01223 
01224         #ifdef TIXML_USE_STL
01226         TiXmlText( const std::string& initValue ) : TiXmlNode (TiXmlNode::TEXT)
01227         {
01228                 SetValue( initValue );
01229                 cdata = false;
01230         }
01231         #endif
01232 
01233         TiXmlText( const TiXmlText& copy ) : TiXmlNode( TiXmlNode::TEXT )       { copy.CopyTo( this ); }
01234         void operator=( const TiXmlText& base )                                                         { base.CopyTo( this ); }
01235 
01236         // Write this text object to a FILE stream.
01237         virtual void Print( FILE* cfile, int depth ) const;
01238 
01240         bool CDATA() const                              { return cdata; }
01242         void SetCDATA( bool _cdata )    { cdata = _cdata; }
01243 
01244         virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
01245 
01246         virtual const TiXmlText* ToText() const { return this; } 
01247         virtual TiXmlText*       ToText()       { return this; } 
01248 
01251         virtual bool Accept( TiXmlVisitor* content ) const;
01252 
01253 protected :
01255         virtual TiXmlNode* Clone() const;
01256         void CopyTo( TiXmlText* target ) const;
01257 
01258         bool Blank() const;     // returns true if all white space and new lines
01259         // [internal use]
01260         #ifdef TIXML_USE_STL
01261         virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
01262         #endif
01263 
01264 private:
01265         bool cdata;                     // true if this should be input and output as a CDATA style text element
01266 };
01267 
01268 
01282 class TiXmlDeclaration : public TiXmlNode
01283 {
01284 public:
01286         TiXmlDeclaration()   : TiXmlNode( TiXmlNode::DECLARATION ) {}
01287 
01288 #ifdef TIXML_USE_STL
01290         TiXmlDeclaration(       const std::string& _version,
01291                                                 const std::string& _encoding,
01292                                                 const std::string& _standalone );
01293 #endif
01294 
01296         TiXmlDeclaration(       const char* _version,
01297                                                 const char* _encoding,
01298                                                 const char* _standalone );
01299 
01300         TiXmlDeclaration( const TiXmlDeclaration& copy );
01301         void operator=( const TiXmlDeclaration& copy );
01302 
01303         virtual ~TiXmlDeclaration()     {}
01304 
01306         const char *Version() const                     { return version.c_str (); }
01308         const char *Encoding() const            { return encoding.c_str (); }
01310         const char *Standalone() const          { return standalone.c_str (); }
01311 
01313         virtual TiXmlNode* Clone() const;
01314         // Print this declaration to a FILE stream.
01315         virtual void Print( FILE* cfile, int depth, TIXML_STRING* str ) const;
01316         virtual void Print( FILE* cfile, int depth ) const {
01317                 Print( cfile, depth, 0 );
01318         }
01319 
01320         virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
01321 
01322         virtual const TiXmlDeclaration* ToDeclaration() const { return this; } 
01323         virtual TiXmlDeclaration*       ToDeclaration()       { return this; } 
01324 
01327         virtual bool Accept( TiXmlVisitor* visitor ) const;
01328 
01329 protected:
01330         void CopyTo( TiXmlDeclaration* target ) const;
01331         // used to be public
01332         #ifdef TIXML_USE_STL
01333         virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
01334         #endif
01335 
01336 private:
01337 
01338         TIXML_STRING version;
01339         TIXML_STRING encoding;
01340         TIXML_STRING standalone;
01341 };
01342 
01343 
01351 class TiXmlUnknown : public TiXmlNode
01352 {
01353 public:
01354         TiXmlUnknown() : TiXmlNode( TiXmlNode::UNKNOWN )        {}
01355         virtual ~TiXmlUnknown() {}
01356 
01357         TiXmlUnknown( const TiXmlUnknown& copy ) : TiXmlNode( TiXmlNode::UNKNOWN )              { copy.CopyTo( this ); }
01358         void operator=( const TiXmlUnknown& copy )                                                                              { copy.CopyTo( this ); }
01359 
01361         virtual TiXmlNode* Clone() const;
01362         // Print this Unknown to a FILE stream.
01363         virtual void Print( FILE* cfile, int depth ) const;
01364 
01365         virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
01366 
01367         virtual const TiXmlUnknown*     ToUnknown()     const { return this; } 
01368         virtual TiXmlUnknown*           ToUnknown()         { return this; } 
01369 
01372         virtual bool Accept( TiXmlVisitor* content ) const;
01373 
01374 protected:
01375         void CopyTo( TiXmlUnknown* target ) const;
01376 
01377         #ifdef TIXML_USE_STL
01378         virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
01379         #endif
01380 
01381 private:
01382 
01383 };
01384 
01385 
01390 class TiXmlDocument : public TiXmlNode
01391 {
01392 public:
01394         TiXmlDocument();
01396         TiXmlDocument( const char * documentName );
01397 
01398         #ifdef TIXML_USE_STL
01400         TiXmlDocument( const std::string& documentName );
01401         #endif
01402 
01403         TiXmlDocument( const TiXmlDocument& copy );
01404         void operator=( const TiXmlDocument& copy );
01405 
01406         virtual ~TiXmlDocument() {}
01407 
01412         bool LoadFile( TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
01414         bool SaveFile() const;
01416         bool LoadFile( const char * filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
01418         bool SaveFile( const char * filename ) const;
01424         bool LoadFile( FILE*, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
01426         bool SaveFile( FILE* ) const;
01427 
01428         #ifdef TIXML_USE_STL
01429         bool LoadFile( const std::string& filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING )                   
01430         {
01431 //              StringToBuffer f( filename );
01432 //              return ( f.buffer && LoadFile( f.buffer, encoding ));
01433                 return LoadFile( filename.c_str(), encoding );
01434         }
01435         bool SaveFile( const std::string& filename ) const              
01436         {
01437 //              StringToBuffer f( filename );
01438 //              return ( f.buffer && SaveFile( f.buffer ));
01439                 return SaveFile( filename.c_str() );
01440         }
01441         #endif
01442 
01447         virtual const char* Parse( const char* p, TiXmlParsingData* data = 0, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
01448 
01453         const TiXmlElement* RootElement() const         { return FirstChildElement(); }
01454         TiXmlElement* RootElement()                                     { return FirstChildElement(); }
01455 
01461         bool Error() const                                              { return error; }
01462 
01464         const char * ErrorDesc() const  { return errorDesc.c_str (); }
01465 
01469         int ErrorId()   const                           { return errorId; }
01470 
01478         int ErrorRow() const    { return errorLocation.row+1; }
01479         int ErrorCol() const    { return errorLocation.col+1; } 
01480 
01505         void SetTabSize( int _tabsize )         { tabsize = _tabsize; }
01506 
01507         int TabSize() const     { return tabsize; }
01508 
01512         void ClearError()                                               {       error = false; 
01513                                                                                                 errorId = 0; 
01514                                                                                                 errorDesc = ""; 
01515                                                                                                 errorLocation.row = errorLocation.col = 0; 
01516                                                                                                 //errorLocation.last = 0; 
01517                                                                                         }
01518 
01520         void Print() const                                              { Print( stdout, 0 ); }
01521 
01522         /* Write the document to a string using formatted printing ("pretty print"). This
01523                 will allocate a character array (new char[]) and return it as a pointer. The
01524                 calling code pust call delete[] on the return char* to avoid a memory leak.
01525         */
01526         //char* PrintToMemory() const; 
01527 
01529         virtual void Print( FILE* cfile, int depth = 0 ) const;
01530         // [internal use]
01531         void SetError( int err, const char* errorLocation, TiXmlParsingData* prevData, TiXmlEncoding encoding );
01532 
01533         virtual const TiXmlDocument*    ToDocument()    const { return this; } 
01534         virtual TiXmlDocument*          ToDocument()          { return this; } 
01535 
01538         virtual bool Accept( TiXmlVisitor* content ) const;
01539 
01540 protected :
01541         // [internal use]
01542         virtual TiXmlNode* Clone() const;
01543         #ifdef TIXML_USE_STL
01544         virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
01545         #endif
01546 
01547 private:
01548         void CopyTo( TiXmlDocument* target ) const;
01549 
01550         bool error;
01551         int  errorId;
01552         TIXML_STRING errorDesc;
01553         int tabsize;
01554         TiXmlCursor errorLocation;
01555         bool useMicrosoftBOM;           // the UTF-8 BOM were found when read. Note this, and try to write.
01556 };
01557 
01558 
01639 class TiXmlHandle
01640 {
01641 public:
01643         TiXmlHandle( TiXmlNode* _node )                                 { this->node = _node; }
01645         TiXmlHandle( const TiXmlHandle& ref )                   { this->node = ref.node; }
01646         TiXmlHandle operator=( const TiXmlHandle& ref ) { this->node = ref.node; return *this; }
01647 
01649         TiXmlHandle FirstChild() const;
01651         TiXmlHandle FirstChild( const char * value ) const;
01653         TiXmlHandle FirstChildElement() const;
01655         TiXmlHandle FirstChildElement( const char * value ) const;
01656 
01660         TiXmlHandle Child( const char* value, int index ) const;
01664         TiXmlHandle Child( int index ) const;
01669         TiXmlHandle ChildElement( const char* value, int index ) const;
01674         TiXmlHandle ChildElement( int index ) const;
01675 
01676         #ifdef TIXML_USE_STL
01677         TiXmlHandle FirstChild( const std::string& _value ) const                               { return FirstChild( _value.c_str() ); }
01678         TiXmlHandle FirstChildElement( const std::string& _value ) const                { return FirstChildElement( _value.c_str() ); }
01679 
01680         TiXmlHandle Child( const std::string& _value, int index ) const                 { return Child( _value.c_str(), index ); }
01681         TiXmlHandle ChildElement( const std::string& _value, int index ) const  { return ChildElement( _value.c_str(), index ); }
01682         #endif
01683 
01686         TiXmlNode* ToNode() const                       { return node; } 
01689         TiXmlElement* ToElement() const         { return ( ( node && node->ToElement() ) ? node->ToElement() : 0 ); }
01692         TiXmlText* ToText() const                       { return ( ( node && node->ToText() ) ? node->ToText() : 0 ); }
01695         TiXmlUnknown* ToUnknown() const         { return ( ( node && node->ToUnknown() ) ? node->ToUnknown() : 0 ); }
01696 
01700         TiXmlNode* Node() const                 { return ToNode(); } 
01704         TiXmlElement* Element() const   { return ToElement(); }
01708         TiXmlText* Text() const                 { return ToText(); }
01712         TiXmlUnknown* Unknown() const   { return ToUnknown(); }
01713 
01714 private:
01715         TiXmlNode* node;
01716 };
01717 
01718 
01738 class TiXmlPrinter : public TiXmlVisitor
01739 {
01740 public:
01741         TiXmlPrinter() : depth( 0 ), simpleTextPrint( false ),
01742                                          buffer(), indent( "    " ), lineBreak( "\n" ) {}
01743 
01744         virtual bool VisitEnter( const TiXmlDocument& doc );
01745         virtual bool VisitExit( const TiXmlDocument& doc );
01746 
01747         virtual bool VisitEnter( const TiXmlElement& element, const TiXmlAttribute* firstAttribute );
01748         virtual bool VisitExit( const TiXmlElement& element );
01749 
01750         virtual bool Visit( const TiXmlDeclaration& declaration );
01751         virtual bool Visit( const TiXmlText& text );
01752         virtual bool Visit( const TiXmlComment& comment );
01753         virtual bool Visit( const TiXmlUnknown& unknown );
01754 
01758         void SetIndent( const char* _indent )                   { indent = _indent ? _indent : "" ; }
01760         const char* Indent()                                                    { return indent.c_str(); }
01765         void SetLineBreak( const char* _lineBreak )             { lineBreak = _lineBreak ? _lineBreak : ""; }
01767         const char* LineBreak()                                                 { return lineBreak.c_str(); }
01768 
01772         void SetStreamPrinting()                                                { indent = "";
01773                                                                                                           lineBreak = "";
01774                                                                                                         }       
01776         const char* CStr()                                                              { return buffer.c_str(); }
01778         size_t Size()                                                                   { return buffer.size(); }
01779 
01780         #ifdef TIXML_USE_STL
01782         const std::string& Str()                                                { return buffer; }
01783         #endif
01784 
01785 private:
01786         void DoIndent() {
01787                 for( int i=0; i<depth; ++i )
01788                         buffer += indent;
01789         }
01790         void DoLineBreak() {
01791                 buffer += lineBreak;
01792         }
01793 
01794         int depth;
01795         bool simpleTextPrint;
01796         TIXML_STRING buffer;
01797         TIXML_STRING indent;
01798         TIXML_STRING lineBreak;
01799 };
01800 
01801 
01802 #ifdef _MSC_VER
01803 #pragma warning( pop )
01804 #endif
01805 }
01806 #endif
01807 

Generated on Wed Oct 1 11:34:06 2008 for OBT by  doxygen 1.5.3