tinyxml.h
Go to the documentation of this file.
00001 /*
00002 www.sourceforge.net/projects/tinyxml
00003 Original code by 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 TINYXML_INCLUDED
00027 #define TINYXML_INCLUDED
00028 
00029 // Force use of c++ strings instead of char*
00030 #ifndef TIXML_USE_STL
00031         #define TIXML_USE_STL
00032 #endif
00033 
00034 #ifdef _MSC_VER
00035 #pragma warning( push )
00036 #pragma warning( disable : 4530 )
00037 #pragma warning( disable : 4786 )
00038 #endif
00039 
00040 #include <ctype.h>
00041 #include <stdio.h>
00042 #include <stdlib.h>
00043 #include <string.h>
00044 #include <assert.h>
00045 
00046 // Help out windows:
00047 #if defined( _DEBUG ) && !defined( DEBUG )
00048 #define DEBUG
00049 #endif
00050 
00051 #ifdef TIXML_USE_STL
00052         #include <string>
00053         #include <iostream>
00054         #include <sstream>
00055         #define TIXML_STRING            std::string
00056 #else
00057         #include "tinystr.h"
00058         #define TIXML_STRING            TiXmlString
00059 #endif
00060 
00061 // Deprecated library function hell. Compilers want to use the
00062 // new safe versions. This probably doesn't fully address the problem,
00063 // but it gets closer. There are too many compilers for me to fully
00064 // test. If you get compilation troubles, undefine TIXML_SAFE
00065 #define TIXML_SAFE
00066 
00067 #ifdef TIXML_SAFE
00068         #if defined(_MSC_VER) && (_MSC_VER >= 1400 )
00069                 // Microsoft visual studio, version 2005 and higher.
00070                 #define TIXML_SNPRINTF _snprintf_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_SSCANF   sscanf
00077         #elif defined(__GNUC__) && (__GNUC__ >= 3 )
00078                 // GCC version 3 and higher.s
00079                 //#warning( "Using sn* functions." )
00080                 #define TIXML_SNPRINTF snprintf
00081                 #define TIXML_SSCANF   sscanf
00082         #else
00083                 #define TIXML_SNPRINTF snprintf
00084                 #define TIXML_SSCANF   sscanf
00085         #endif
00086 #endif  
00087 
00088 class TiXmlDocument;
00089 class TiXmlElement;
00090 class TiXmlComment;
00091 class TiXmlUnknown;
00092 class TiXmlAttribute;
00093 class TiXmlText;
00094 class TiXmlDeclaration;
00095 class TiXmlParsingData;
00096 
00097 const int TIXML_MAJOR_VERSION = 2;
00098 const int TIXML_MINOR_VERSION = 6;
00099 const int TIXML_PATCH_VERSION = 2;
00100 
00101 /*      Internal structure for tracking location of items 
00102         in the XML file.
00103 */
00104 struct TiXmlCursor
00105 {
00106         TiXmlCursor()           { Clear(); }
00107         void Clear()            { row = col = -1; }
00108 
00109         int row;        // 0 based.
00110         int col;        // 0 based.
00111 };
00112 
00113 
00133 class TiXmlVisitor
00134 {
00135 public:
00136         virtual ~TiXmlVisitor() {}
00137 
00139         virtual bool VisitEnter( const TiXmlDocument& /*doc*/ )                 { return true; }
00141         virtual bool VisitExit( const TiXmlDocument& /*doc*/ )                  { return true; }
00142 
00144         virtual bool VisitEnter( const TiXmlElement& /*element*/, const TiXmlAttribute* /*firstAttribute*/ )    { return true; }
00146         virtual bool VisitExit( const TiXmlElement& /*element*/ )               { return true; }
00147 
00149         virtual bool Visit( const TiXmlDeclaration& /*declaration*/ )   { return true; }
00151         virtual bool Visit( const TiXmlText& /*text*/ )                                 { return true; }
00153         virtual bool Visit( const TiXmlComment& /*comment*/ )                   { return true; }
00155         virtual bool Visit( const TiXmlUnknown& /*unknown*/ )                   { return true; }
00156 };
00157 
00158 // Only used by Attribute::Query functions
00159 enum 
00160 { 
00161         TIXML_SUCCESS,
00162         TIXML_NO_ATTRIBUTE,
00163         TIXML_WRONG_TYPE
00164 };
00165 
00166 
00167 // Used by the parsing routines.
00168 enum TiXmlEncoding
00169 {
00170         TIXML_ENCODING_UNKNOWN,
00171         TIXML_ENCODING_UTF8,
00172         TIXML_ENCODING_LEGACY
00173 };
00174 
00175 const TiXmlEncoding TIXML_DEFAULT_ENCODING = TIXML_ENCODING_UNKNOWN;
00176 
00199 class TiXmlBase
00200 {
00201         friend class TiXmlNode;
00202         friend class TiXmlElement;
00203         friend class TiXmlDocument;
00204 
00205 public:
00206         TiXmlBase()     :       userData(0)             {}
00207         virtual ~TiXmlBase()                    {}
00208 
00218         virtual void Print( FILE* cfile, int depth ) const = 0;
00219 
00226         static void SetCondenseWhiteSpace( bool condense )              { condenseWhiteSpace = condense; }
00227 
00229         static bool IsWhiteSpaceCondensed()                                             { return condenseWhiteSpace; }
00230 
00249         int Row() const                 { return location.row + 1; }
00250         int Column() const              { return location.col + 1; }    
00251 
00252         void  SetUserData( void* user )                 { userData = user; }    
00253         void* GetUserData()                                             { return userData; }    
00254         const void* GetUserData() const                 { return userData; }    
00255 
00256         // Table that returs, for a given lead byte, the total number of bytes
00257         // in the UTF-8 sequence.
00258         static const int utf8ByteTable[256];
00259 
00260         virtual const char* Parse(      const char* p, 
00261                                                                 TiXmlParsingData* data, 
00262                                                                 TiXmlEncoding encoding /*= TIXML_ENCODING_UNKNOWN */ ) = 0;
00263 
00267         static void EncodeString( const TIXML_STRING& str, TIXML_STRING* out );
00268 
00269         enum
00270         {
00271                 TIXML_NO_ERROR = 0,
00272                 TIXML_ERROR,
00273                 TIXML_ERROR_OPENING_FILE,
00274                 TIXML_ERROR_PARSING_ELEMENT,
00275                 TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME,
00276                 TIXML_ERROR_READING_ELEMENT_VALUE,
00277                 TIXML_ERROR_READING_ATTRIBUTES,
00278                 TIXML_ERROR_PARSING_EMPTY,
00279                 TIXML_ERROR_READING_END_TAG,
00280                 TIXML_ERROR_PARSING_UNKNOWN,
00281                 TIXML_ERROR_PARSING_COMMENT,
00282                 TIXML_ERROR_PARSING_DECLARATION,
00283                 TIXML_ERROR_DOCUMENT_EMPTY,
00284                 TIXML_ERROR_EMBEDDED_NULL,
00285                 TIXML_ERROR_PARSING_CDATA,
00286                 TIXML_ERROR_DOCUMENT_TOP_ONLY,
00287 
00288                 TIXML_ERROR_STRING_COUNT
00289         };
00290 
00291 protected:
00292 
00293         static const char* SkipWhiteSpace( const char*, TiXmlEncoding encoding );
00294 
00295         inline static bool IsWhiteSpace( char c )               
00296         { 
00297                 return ( isspace( (unsigned char) c ) || c == '\n' || c == '\r' ); 
00298         }
00299         inline static bool IsWhiteSpace( int c )
00300         {
00301                 if ( c < 256 )
00302                         return IsWhiteSpace( (char) c );
00303                 return false;   // Again, only truly correct for English/Latin...but usually works.
00304         }
00305 
00306         #ifdef TIXML_USE_STL
00307         static bool     StreamWhiteSpace( std::istream * in, TIXML_STRING * tag );
00308         static bool StreamTo( std::istream * in, int character, TIXML_STRING * tag );
00309         #endif
00310 
00311         /*      Reads an XML name into the string provided. Returns
00312                 a pointer just past the last character of the name,
00313                 or 0 if the function has an error.
00314         */
00315         static const char* ReadName( const char* p, TIXML_STRING* name, TiXmlEncoding encoding );
00316 
00317         /*      Reads text. Returns a pointer past the given end tag.
00318                 Wickedly complex options, but it keeps the (sensitive) code in one place.
00319         */
00320         static const char* ReadText(    const char* in,                         // where to start
00321                                                                         TIXML_STRING* text,                     // the string read
00322                                                                         bool ignoreWhiteSpace,          // whether to keep the white space
00323                                                                         const char* endTag,                     // what ends this text
00324                                                                         bool ignoreCase,                        // whether to ignore case in the end tag
00325                                                                         TiXmlEncoding encoding );       // the current encoding
00326 
00327         // If an entity has been found, transform it into a character.
00328         static const char* GetEntity( const char* in, char* value, int* length, TiXmlEncoding encoding );
00329 
00330         // Get a character, while interpreting entities.
00331         // The length can be from 0 to 4 bytes.
00332         inline static const char* GetChar( const char* p, char* _value, int* length, TiXmlEncoding encoding )
00333         {
00334                 assert( p );
00335                 if ( encoding == TIXML_ENCODING_UTF8 )
00336                 {
00337                         *length = utf8ByteTable[ *((const unsigned char*)p) ];
00338                         assert( *length >= 0 && *length < 5 );
00339                 }
00340                 else
00341                 {
00342                         *length = 1;
00343                 }
00344 
00345                 if ( *length == 1 )
00346                 {
00347                         if ( *p == '&' )
00348                                 return GetEntity( p, _value, length, encoding );
00349                         *_value = *p;
00350                         return p+1;
00351                 }
00352                 else if ( *length )
00353                 {
00354                         //strncpy( _value, p, *length );        // lots of compilers don't like this function (unsafe),
00355                                                                                                 // and the null terminator isn't needed
00356                         for( int i=0; p[i] && i<*length; ++i ) {
00357                                 _value[i] = p[i];
00358                         }
00359                         return p + (*length);
00360                 }
00361                 else
00362                 {
00363                         // Not valid text.
00364                         return 0;
00365                 }
00366         }
00367 
00368         // Return true if the next characters in the stream are any of the endTag sequences.
00369         // Ignore case only works for english, and should only be relied on when comparing
00370         // to English words: StringEqual( p, "version", true ) is fine.
00371         static bool StringEqual(        const char* p,
00372                                                                 const char* endTag,
00373                                                                 bool ignoreCase,
00374                                                                 TiXmlEncoding encoding );
00375 
00376         static const char* errorString[ TIXML_ERROR_STRING_COUNT ];
00377 
00378         TiXmlCursor location;
00379 
00381         void*                   userData;
00382         
00383         // None of these methods are reliable for any language except English.
00384         // Good for approximation, not great for accuracy.
00385         static int IsAlpha( unsigned char anyByte, TiXmlEncoding encoding );
00386         static int IsAlphaNum( unsigned char anyByte, TiXmlEncoding encoding );
00387         inline static int ToLower( int v, TiXmlEncoding encoding )
00388         {
00389                 if ( encoding == TIXML_ENCODING_UTF8 )
00390                 {
00391                         if ( v < 128 ) return tolower( v );
00392                         return v;
00393                 }
00394                 else
00395                 {
00396                         return tolower( v );
00397                 }
00398         }
00399         static void ConvertUTF32ToUTF8( unsigned long input, char* output, int* length );
00400 
00401 private:
00402         TiXmlBase( const TiXmlBase& );                          // not implemented.
00403         void operator=( const TiXmlBase& base );        // not allowed.
00404 
00405         struct Entity
00406         {
00407                 const char*     str;
00408                 unsigned int    strLength;
00409                 char                chr;
00410         };
00411         enum
00412         {
00413                 NUM_ENTITY = 5,
00414                 MAX_ENTITY_LENGTH = 6
00415 
00416         };
00417         static Entity entity[ NUM_ENTITY ];
00418         static bool condenseWhiteSpace;
00419 };
00420 
00421 
00428 class TiXmlNode : public TiXmlBase
00429 {
00430         friend class TiXmlDocument;
00431         friend class TiXmlElement;
00432 
00433 public:
00434         #ifdef TIXML_USE_STL    
00435 
00439             friend std::istream& operator >> (std::istream& in, TiXmlNode& base);
00440 
00457             friend std::ostream& operator<< (std::ostream& out, const TiXmlNode& base);
00458 
00460                 friend std::string& operator<< (std::string& out, const TiXmlNode& base );
00461 
00462         #endif
00463 
00467         enum NodeType
00468         {
00469                 TINYXML_DOCUMENT,
00470                 TINYXML_ELEMENT,
00471                 TINYXML_COMMENT,
00472                 TINYXML_UNKNOWN,
00473                 TINYXML_TEXT,
00474                 TINYXML_DECLARATION,
00475                 TINYXML_TYPECOUNT
00476         };
00477 
00478         virtual ~TiXmlNode();
00479 
00492         const char *Value() const { return value.c_str (); }
00493 
00494     #ifdef TIXML_USE_STL
00495 
00499         const std::string& ValueStr() const { return value; }
00500         #endif
00501 
00502         const TIXML_STRING& ValueTStr() const { return value; }
00503 
00513         void SetValue(const char * _value) { value = _value;}
00514 
00515     #ifdef TIXML_USE_STL
00516 
00517         void SetValue( const std::string& _value )      { value = _value; }
00518         #endif
00519 
00521         void Clear();
00522 
00524         TiXmlNode* Parent()                                                     { return parent; }
00525         const TiXmlNode* Parent() const                         { return parent; }
00526 
00527         const TiXmlNode* FirstChild()   const           { return firstChild; }  
00528         TiXmlNode* FirstChild()                                         { return firstChild; }
00529         const TiXmlNode* FirstChild( const char * value ) const;                        
00530 
00531         TiXmlNode* FirstChild( const char * _value ) {
00532                 // Call through to the const version - safe since nothing is changed. Exiting syntax: cast this to a const (always safe)
00533                 // call the method, cast the return back to non-const.
00534                 return const_cast< TiXmlNode* > ((const_cast< const TiXmlNode* >(this))->FirstChild( _value ));
00535         }
00536         const TiXmlNode* LastChild() const      { return lastChild; }           
00537         TiXmlNode* LastChild()  { return lastChild; }
00538         
00539         const TiXmlNode* LastChild( const char * value ) const;                 
00540         TiXmlNode* LastChild( const char * _value ) {
00541                 return const_cast< TiXmlNode* > ((const_cast< const TiXmlNode* >(this))->LastChild( _value ));
00542         }
00543 
00544     #ifdef TIXML_USE_STL
00545         const TiXmlNode* FirstChild( const std::string& _value ) const  {       return FirstChild (_value.c_str ());    }       
00546         TiXmlNode* FirstChild( const std::string& _value )                              {       return FirstChild (_value.c_str ());    }       
00547         const TiXmlNode* LastChild( const std::string& _value ) const   {       return LastChild (_value.c_str ());     }       
00548         TiXmlNode* LastChild( const std::string& _value )                               {       return LastChild (_value.c_str ());     }       
00549         #endif
00550 
00567         const TiXmlNode* IterateChildren( const TiXmlNode* previous ) const;
00568         TiXmlNode* IterateChildren( const TiXmlNode* previous ) {
00569                 return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->IterateChildren( previous ) );
00570         }
00571 
00573         const TiXmlNode* IterateChildren( const char * value, const TiXmlNode* previous ) const;
00574         TiXmlNode* IterateChildren( const char * _value, const TiXmlNode* previous ) {
00575                 return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->IterateChildren( _value, previous ) );
00576         }
00577 
00578     #ifdef TIXML_USE_STL
00579         const TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNode* previous ) const  {       return IterateChildren (_value.c_str (), previous);     }       
00580         TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNode* previous ) {    return IterateChildren (_value.c_str (), previous);     }       
00581         #endif
00582 
00586         TiXmlNode* InsertEndChild( const TiXmlNode& addThis );
00587 
00588 
00598         TiXmlNode* LinkEndChild( TiXmlNode* addThis );
00599 
00603         TiXmlNode* InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis );
00604 
00608         TiXmlNode* InsertAfterChild(  TiXmlNode* afterThis, const TiXmlNode& addThis );
00609 
00613         TiXmlNode* ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& withThis );
00614 
00616         bool RemoveChild( TiXmlNode* removeThis );
00617 
00619         const TiXmlNode* PreviousSibling() const                        { return prev; }
00620         TiXmlNode* PreviousSibling()                                            { return prev; }
00621 
00623         const TiXmlNode* PreviousSibling( const char * ) const;
00624         TiXmlNode* PreviousSibling( const char *_prev ) {
00625                 return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->PreviousSibling( _prev ) );
00626         }
00627 
00628     #ifdef TIXML_USE_STL
00629         const TiXmlNode* PreviousSibling( const std::string& _value ) const     {       return PreviousSibling (_value.c_str ());       }       
00630         TiXmlNode* PreviousSibling( const std::string& _value )                         {       return PreviousSibling (_value.c_str ());       }       
00631         const TiXmlNode* NextSibling( const std::string& _value) const          {       return NextSibling (_value.c_str ());   }       
00632         TiXmlNode* NextSibling( const std::string& _value)                                      {       return NextSibling (_value.c_str ());   }       
00633         #endif
00634 
00636         const TiXmlNode* NextSibling() const                            { return next; }
00637         TiXmlNode* NextSibling()                                                        { return next; }
00638 
00640         const TiXmlNode* NextSibling( const char * ) const;
00641         TiXmlNode* NextSibling( const char* _next ) {
00642                 return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->NextSibling( _next ) );
00643         }
00644 
00649         const TiXmlElement* NextSiblingElement() const;
00650         TiXmlElement* NextSiblingElement() {
00651                 return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->NextSiblingElement() );
00652         }
00653 
00658         const TiXmlElement* NextSiblingElement( const char * ) const;
00659         TiXmlElement* NextSiblingElement( const char *_next ) {
00660                 return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->NextSiblingElement( _next ) );
00661         }
00662 
00663     #ifdef TIXML_USE_STL
00664         const TiXmlElement* NextSiblingElement( const std::string& _value) const        {       return NextSiblingElement (_value.c_str ());    }       
00665         TiXmlElement* NextSiblingElement( const std::string& _value)                            {       return NextSiblingElement (_value.c_str ());    }       
00666         #endif
00667 
00669         const TiXmlElement* FirstChildElement() const;
00670         TiXmlElement* FirstChildElement() {
00671                 return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->FirstChildElement() );
00672         }
00673 
00675         const TiXmlElement* FirstChildElement( const char * _value ) const;
00676         TiXmlElement* FirstChildElement( const char * _value ) {
00677                 return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->FirstChildElement( _value ) );
00678         }
00679 
00680     #ifdef TIXML_USE_STL
00681         const TiXmlElement* FirstChildElement( const std::string& _value ) const        {       return FirstChildElement (_value.c_str ());     }       
00682         TiXmlElement* FirstChildElement( const std::string& _value )                            {       return FirstChildElement (_value.c_str ());     }       
00683         #endif
00684 
00689         int Type() const        { return type; }
00690 
00694         const TiXmlDocument* GetDocument() const;
00695         TiXmlDocument* GetDocument() {
00696                 return const_cast< TiXmlDocument* >( (const_cast< const TiXmlNode* >(this))->GetDocument() );
00697         }
00698 
00700         bool NoChildren() const                                         { return !firstChild; }
00701 
00702         virtual const TiXmlDocument*    ToDocument()    const { return 0; } 
00703         virtual const TiXmlElement*     ToElement()     const { return 0; } 
00704         virtual const TiXmlComment*     ToComment()     const { return 0; } 
00705         virtual const TiXmlUnknown*     ToUnknown()     const { return 0; } 
00706         virtual const TiXmlText*        ToText()        const { return 0; } 
00707         virtual const TiXmlDeclaration* ToDeclaration() const { return 0; } 
00708 
00709         virtual TiXmlDocument*          ToDocument()    { return 0; } 
00710         virtual TiXmlElement*           ToElement()         { return 0; } 
00711         virtual TiXmlComment*           ToComment()     { return 0; } 
00712         virtual TiXmlUnknown*           ToUnknown()         { return 0; } 
00713         virtual TiXmlText*                  ToText()        { return 0; } 
00714         virtual TiXmlDeclaration*       ToDeclaration() { return 0; } 
00715 
00719         virtual TiXmlNode* Clone() const = 0;
00720 
00743         virtual bool Accept( TiXmlVisitor* visitor ) const = 0;
00744 
00745 protected:
00746         TiXmlNode( NodeType _type );
00747 
00748         // Copy to the allocated object. Shared functionality between Clone, Copy constructor,
00749         // and the assignment operator.
00750         void CopyTo( TiXmlNode* target ) const;
00751 
00752         #ifdef TIXML_USE_STL
00753             // The real work of the input operator.
00754         virtual void StreamIn( std::istream* in, TIXML_STRING* tag ) = 0;
00755         #endif
00756 
00757         // Figure out what is at *p, and parse it. Returns null if it is not an xml node.
00758         TiXmlNode* Identify( const char* start, TiXmlEncoding encoding );
00759 
00760         TiXmlNode*              parent;
00761         NodeType                type;
00762 
00763         TiXmlNode*              firstChild;
00764         TiXmlNode*              lastChild;
00765 
00766         TIXML_STRING    value;
00767 
00768         TiXmlNode*              prev;
00769         TiXmlNode*              next;
00770 
00771 private:
00772         TiXmlNode( const TiXmlNode& );                          // not implemented.
00773         void operator=( const TiXmlNode& base );        // not allowed.
00774 };
00775 
00776 
00784 class TiXmlAttribute : public TiXmlBase
00785 {
00786         friend class TiXmlAttributeSet;
00787 
00788 public:
00790         TiXmlAttribute() : TiXmlBase()
00791         {
00792                 document = 0;
00793                 prev = next = 0;
00794         }
00795 
00796         #ifdef TIXML_USE_STL
00797 
00798         TiXmlAttribute( const std::string& _name, const std::string& _value )
00799         {
00800                 name = _name;
00801                 value = _value;
00802                 document = 0;
00803                 prev = next = 0;
00804         }
00805         #endif
00806 
00808         TiXmlAttribute( const char * _name, const char * _value )
00809         {
00810                 name = _name;
00811                 value = _value;
00812                 document = 0;
00813                 prev = next = 0;
00814         }
00815 
00816         const char*             Name()  const           { return name.c_str(); }                
00817         const char*             Value() const           { return value.c_str(); }               
00818         #ifdef TIXML_USE_STL
00819         const std::string& ValueStr() const     { return value; }                               
00820         #endif
00821         int                             IntValue() const;                                                                       
00822         double                  DoubleValue() const;                                                            
00823 
00824         // Get the tinyxml string representation
00825         const TIXML_STRING& NameTStr() const { return name; }
00826 
00836         int QueryIntValue( int* _value ) const;
00838         int QueryDoubleValue( double* _value ) const;
00839 
00840         void SetName( const char* _name )       { name = _name; }                               
00841         void SetValue( const char* _value )     { value = _value; }                             
00842 
00843         void SetIntValue( int _value );                                                                         
00844         void SetDoubleValue( double _value );                                                           
00845 
00846     #ifdef TIXML_USE_STL
00847 
00848         void SetName( const std::string& _name )        { name = _name; }       
00850         void SetValue( const std::string& _value )      { value = _value; }
00851         #endif
00852 
00854         const TiXmlAttribute* Next() const;
00855         TiXmlAttribute* Next() {
00856                 return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Next() ); 
00857         }
00858 
00860         const TiXmlAttribute* Previous() const;
00861         TiXmlAttribute* Previous() {
00862                 return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Previous() ); 
00863         }
00864 
00865         bool operator==( const TiXmlAttribute& rhs ) const { return rhs.name == name; }
00866         bool operator<( const TiXmlAttribute& rhs )      const { return name < rhs.name; }
00867         bool operator>( const TiXmlAttribute& rhs )  const { return name > rhs.name; }
00868 
00869         /*      Attribute parsing starts: first letter of the name
00870                                                  returns: the next char after the value end quote
00871         */
00872         virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
00873 
00874         // Prints this Attribute to a FILE stream.
00875         virtual void Print( FILE* cfile, int depth ) const {
00876                 Print( cfile, depth, 0 );
00877         }
00878         void Print( FILE* cfile, int depth, TIXML_STRING* str ) const;
00879 
00880         // [internal use]
00881         // Set the document pointer so the attribute can report errors.
00882         void SetDocument( TiXmlDocument* doc )  { document = doc; }
00883 
00884 private:
00885         TiXmlAttribute( const TiXmlAttribute& );                                // not implemented.
00886         void operator=( const TiXmlAttribute& base );   // not allowed.
00887 
00888         TiXmlDocument*  document;       // A pointer back to a document, for error reporting.
00889         TIXML_STRING name;
00890         TIXML_STRING value;
00891         TiXmlAttribute* prev;
00892         TiXmlAttribute* next;
00893 };
00894 
00895 
00896 /*      A class used to manage a group of attributes.
00897         It is only used internally, both by the ELEMENT and the DECLARATION.
00898         
00899         The set can be changed transparent to the Element and Declaration
00900         classes that use it, but NOT transparent to the Attribute
00901         which has to implement a next() and previous() method. Which makes
00902         it a bit problematic and prevents the use of STL.
00903 
00904         This version is implemented with circular lists because:
00905                 - I like circular lists
00906                 - it demonstrates some independence from the (typical) doubly linked list.
00907 */
00908 class TiXmlAttributeSet
00909 {
00910 public:
00911         TiXmlAttributeSet();
00912         ~TiXmlAttributeSet();
00913 
00914         void Add( TiXmlAttribute* attribute );
00915         void Remove( TiXmlAttribute* attribute );
00916 
00917         const TiXmlAttribute* First()   const   { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; }
00918         TiXmlAttribute* First()                                 { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; }
00919         const TiXmlAttribute* Last() const              { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; }
00920         TiXmlAttribute* Last()                                  { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; }
00921 
00922         TiXmlAttribute* Find( const char* _name ) const;
00923         TiXmlAttribute* FindOrCreate( const char* _name );
00924 
00925 #       ifdef TIXML_USE_STL
00926         TiXmlAttribute* Find( const std::string& _name ) const;
00927         TiXmlAttribute* FindOrCreate( const std::string& _name );
00928 #       endif
00929 
00930 
00931 private:
00932         //*ME:  Because of hidden/disabled copy-construktor in TiXmlAttribute (sentinel-element),
00933         //*ME:  this class must be also use a hidden/disabled copy-constructor !!!
00934         TiXmlAttributeSet( const TiXmlAttributeSet& );  // not allowed
00935         void operator=( const TiXmlAttributeSet& );     // not allowed (as TiXmlAttribute)
00936 
00937         TiXmlAttribute sentinel;
00938 };
00939 
00940 
00945 class TiXmlElement : public TiXmlNode
00946 {
00947 public:
00949         TiXmlElement (const char * in_value);
00950 
00951         #ifdef TIXML_USE_STL
00952 
00953         TiXmlElement( const std::string& _value );
00954         #endif
00955 
00956         TiXmlElement( const TiXmlElement& );
00957 
00958         TiXmlElement& operator=( const TiXmlElement& base );
00959 
00960         virtual ~TiXmlElement();
00961 
00965         const char* Attribute( const char* name ) const;
00966 
00973         const char* Attribute( const char* name, int* i ) const;
00974 
00981         const char* Attribute( const char* name, double* d ) const;
00982 
00990         int QueryIntAttribute( const char* name, int* _value ) const;
00992         int QueryUnsignedAttribute( const char* name, unsigned* _value ) const;
00997         int QueryBoolAttribute( const char* name, bool* _value ) const;
00999         int QueryDoubleAttribute( const char* name, double* _value ) const;
01001         int QueryFloatAttribute( const char* name, float* _value ) const {
01002                 double d;
01003                 int result = QueryDoubleAttribute( name, &d );
01004                 if ( result == TIXML_SUCCESS ) {
01005                         *_value = (float)d;
01006                 }
01007                 return result;
01008         }
01009 
01010     #ifdef TIXML_USE_STL
01011 
01012         int QueryStringAttribute( const char* name, std::string* _value ) const {
01013                 const char* cstr = Attribute( name );
01014                 if ( cstr ) {
01015                         *_value = std::string( cstr );
01016                         return TIXML_SUCCESS;
01017                 }
01018                 return TIXML_NO_ATTRIBUTE;
01019         }
01020 
01029         template< typename T > int QueryValueAttribute( const std::string& name, T* outValue ) const
01030         {
01031                 const TiXmlAttribute* node = attributeSet.Find( name );
01032                 if ( !node )
01033                         return TIXML_NO_ATTRIBUTE;
01034 
01035                 std::stringstream sstream( node->ValueStr() );
01036                 sstream >> *outValue;
01037                 if ( !sstream.fail() )
01038                         return TIXML_SUCCESS;
01039                 return TIXML_WRONG_TYPE;
01040         }
01041 
01042         int QueryValueAttribute( const std::string& name, std::string* outValue ) const
01043         {
01044                 const TiXmlAttribute* node = attributeSet.Find( name );
01045                 if ( !node )
01046                         return TIXML_NO_ATTRIBUTE;
01047                 *outValue = node->ValueStr();
01048                 return TIXML_SUCCESS;
01049         }
01050         #endif
01051 
01055         void SetAttribute( const char* name, const char * _value );
01056 
01057     #ifdef TIXML_USE_STL
01058         const std::string* Attribute( const std::string& name ) const;
01059         const std::string* Attribute( const std::string& name, int* i ) const;
01060         const std::string* Attribute( const std::string& name, double* d ) const;
01061         int QueryIntAttribute( const std::string& name, int* _value ) const;
01062         int QueryDoubleAttribute( const std::string& name, double* _value ) const;
01063 
01065         void SetAttribute( const std::string& name, const std::string& _value );
01067         void SetAttribute( const std::string& name, int _value );
01069         void SetDoubleAttribute( const std::string& name, double value );
01070         #endif
01071 
01075         void SetAttribute( const char * name, int value );
01076 
01080         void SetDoubleAttribute( const char * name, double value );
01081 
01084         void RemoveAttribute( const char * name );
01085     #ifdef TIXML_USE_STL
01086         void RemoveAttribute( const std::string& name ) {       RemoveAttribute (name.c_str ());        }       
01087         #endif
01088 
01089         const TiXmlAttribute* FirstAttribute() const    { return attributeSet.First(); }                
01090         TiXmlAttribute* FirstAttribute()                                { return attributeSet.First(); }
01091         const TiXmlAttribute* LastAttribute()   const   { return attributeSet.Last(); }         
01092         TiXmlAttribute* LastAttribute()                                 { return attributeSet.Last(); }
01093 
01126         const char* GetText() const;
01127 
01129         virtual TiXmlNode* Clone() const;
01130         // Print the Element to a FILE stream.
01131         virtual void Print( FILE* cfile, int depth ) const;
01132 
01133         /*      Attribtue parsing starts: next char past '<'
01134                                                  returns: next char past '>'
01135         */
01136         virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
01137 
01138         virtual const TiXmlElement*     ToElement()     const { return this; } 
01139         virtual TiXmlElement*           ToElement()               { return this; } 
01140 
01143         virtual bool Accept( TiXmlVisitor* visitor ) const;
01144 
01145 protected:
01146 
01147         void CopyTo( TiXmlElement* target ) const;
01148         void ClearThis();       // like clear, but initializes 'this' object as well
01149 
01150         // Used to be public [internal use]
01151         #ifdef TIXML_USE_STL
01152         virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
01153         #endif
01154         /*      [internal use]
01155                 Reads the "value" of the element -- another element, or text.
01156                 This should terminate with the current end tag.
01157         */
01158         const char* ReadValue( const char* in, TiXmlParsingData* prevData, TiXmlEncoding encoding );
01159 
01160 private:
01161         TiXmlAttributeSet attributeSet;
01162 };
01163 
01164 
01167 class TiXmlComment : public TiXmlNode
01168 {
01169 public:
01171         TiXmlComment() : TiXmlNode( TiXmlNode::TINYXML_COMMENT ) {}
01173         TiXmlComment( const char* _value ) : TiXmlNode( TiXmlNode::TINYXML_COMMENT ) {
01174                 SetValue( _value );
01175         }
01176         TiXmlComment( const TiXmlComment& );
01177         TiXmlComment& operator=( const TiXmlComment& base );
01178 
01179         virtual ~TiXmlComment() {}
01180 
01182         virtual TiXmlNode* Clone() const;
01183         // Write this Comment to a FILE stream.
01184         virtual void Print( FILE* cfile, int depth ) const;
01185 
01186         /*      Attribtue parsing starts: at the ! of the !--
01187                                                  returns: next char past '>'
01188         */
01189         virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
01190 
01191         virtual const TiXmlComment*  ToComment() const  { return this; } 
01192         virtual           TiXmlComment*  ToComment()            { return this; } 
01193 
01196         virtual bool Accept( TiXmlVisitor* visitor ) const;
01197 
01198 protected:
01199         void CopyTo( TiXmlComment* target ) const;
01200 
01201         // used to be public
01202         #ifdef TIXML_USE_STL
01203         virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
01204         #endif
01205 //      virtual void StreamOut( TIXML_OSTREAM * out ) const;
01206 
01207 private:
01208 
01209 };
01210 
01211 
01217 class TiXmlText : public TiXmlNode
01218 {
01219         friend class TiXmlElement;
01220 public:
01225         TiXmlText (const char * initValue ) : TiXmlNode (TiXmlNode::TINYXML_TEXT)
01226         {
01227                 SetValue( initValue );
01228                 cdata = false;
01229         }
01230         virtual ~TiXmlText() {}
01231 
01232         #ifdef TIXML_USE_STL
01233 
01234         TiXmlText( const std::string& initValue ) : TiXmlNode (TiXmlNode::TINYXML_TEXT)
01235         {
01236                 SetValue( initValue );
01237                 cdata = false;
01238         }
01239         #endif
01240 
01241         TiXmlText( const TiXmlText& copy ) : TiXmlNode( TiXmlNode::TINYXML_TEXT )       { copy.CopyTo( this ); }
01242         TiXmlText& operator=( const TiXmlText& base )                                                           { base.CopyTo( this ); return *this; }
01243 
01244         // Write this text object to a FILE stream.
01245         virtual void Print( FILE* cfile, int depth ) const;
01246 
01248         bool CDATA() const                              { return cdata; }
01250         void SetCDATA( bool _cdata )    { cdata = _cdata; }
01251 
01252         virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
01253 
01254         virtual const TiXmlText* ToText() const { return this; } 
01255         virtual TiXmlText*       ToText()       { return this; } 
01256 
01259         virtual bool Accept( TiXmlVisitor* content ) const;
01260 
01261 protected :
01263         virtual TiXmlNode* Clone() const;
01264         void CopyTo( TiXmlText* target ) const;
01265 
01266         bool Blank() const;     // returns true if all white space and new lines
01267         // [internal use]
01268         #ifdef TIXML_USE_STL
01269         virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
01270         #endif
01271 
01272 private:
01273         bool cdata;                     // true if this should be input and output as a CDATA style text element
01274 };
01275 
01276 
01290 class TiXmlDeclaration : public TiXmlNode
01291 {
01292 public:
01294         TiXmlDeclaration()   : TiXmlNode( TiXmlNode::TINYXML_DECLARATION ) {}
01295 
01296 #ifdef TIXML_USE_STL
01297 
01298         TiXmlDeclaration(       const std::string& _version,
01299                                                 const std::string& _encoding,
01300                                                 const std::string& _standalone );
01301 #endif
01302 
01304         TiXmlDeclaration(       const char* _version,
01305                                                 const char* _encoding,
01306                                                 const char* _standalone );
01307 
01308         TiXmlDeclaration( const TiXmlDeclaration& copy );
01309         TiXmlDeclaration& operator=( const TiXmlDeclaration& copy );
01310 
01311         virtual ~TiXmlDeclaration()     {}
01312 
01314         const char *Version() const                     { return version.c_str (); }
01316         const char *Encoding() const            { return encoding.c_str (); }
01318         const char *Standalone() const          { return standalone.c_str (); }
01319 
01321         virtual TiXmlNode* Clone() const;
01322         // Print this declaration to a FILE stream.
01323         virtual void Print( FILE* cfile, int depth, TIXML_STRING* str ) const;
01324         virtual void Print( FILE* cfile, int depth ) const {
01325                 Print( cfile, depth, 0 );
01326         }
01327 
01328         virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
01329 
01330         virtual const TiXmlDeclaration* ToDeclaration() const { return this; } 
01331         virtual TiXmlDeclaration*       ToDeclaration()       { return this; } 
01332 
01335         virtual bool Accept( TiXmlVisitor* visitor ) const;
01336 
01337 protected:
01338         void CopyTo( TiXmlDeclaration* target ) const;
01339         // used to be public
01340         #ifdef TIXML_USE_STL
01341         virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
01342         #endif
01343 
01344 private:
01345 
01346         TIXML_STRING version;
01347         TIXML_STRING encoding;
01348         TIXML_STRING standalone;
01349 };
01350 
01351 
01359 class TiXmlUnknown : public TiXmlNode
01360 {
01361 public:
01362         TiXmlUnknown() : TiXmlNode( TiXmlNode::TINYXML_UNKNOWN )        {}
01363         virtual ~TiXmlUnknown() {}
01364 
01365         TiXmlUnknown( const TiXmlUnknown& copy ) : TiXmlNode( TiXmlNode::TINYXML_UNKNOWN )              { copy.CopyTo( this ); }
01366         TiXmlUnknown& operator=( const TiXmlUnknown& copy )                                                                             { copy.CopyTo( this ); return *this; }
01367 
01369         virtual TiXmlNode* Clone() const;
01370         // Print this Unknown to a FILE stream.
01371         virtual void Print( FILE* cfile, int depth ) const;
01372 
01373         virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
01374 
01375         virtual const TiXmlUnknown*     ToUnknown()     const   { return this; } 
01376         virtual TiXmlUnknown*           ToUnknown()                             { return this; } 
01377 
01380         virtual bool Accept( TiXmlVisitor* content ) const;
01381 
01382 protected:
01383         void CopyTo( TiXmlUnknown* target ) const;
01384 
01385         #ifdef TIXML_USE_STL
01386         virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
01387         #endif
01388 
01389 private:
01390 
01391 };
01392 
01393 
01398 class TiXmlDocument : public TiXmlNode
01399 {
01400 public:
01402         TiXmlDocument();
01404         TiXmlDocument( const char * documentName );
01405 
01406         #ifdef TIXML_USE_STL
01407 
01408         TiXmlDocument( const std::string& documentName );
01409         #endif
01410 
01411         TiXmlDocument( const TiXmlDocument& copy );
01412         TiXmlDocument& operator=( const TiXmlDocument& copy );
01413 
01414         virtual ~TiXmlDocument() {}
01415 
01420         bool LoadFile( TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
01422         bool SaveFile() const;
01424         bool LoadFile( const char * filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
01426         bool SaveFile( const char * filename ) const;
01432         bool LoadFile( FILE*, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
01434         bool SaveFile( FILE* ) const;
01435 
01436         #ifdef TIXML_USE_STL
01437         bool LoadFile( const std::string& filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING )                   
01438         {
01439                 return LoadFile( filename.c_str(), encoding );
01440         }
01441         bool SaveFile( const std::string& filename ) const              
01442         {
01443                 return SaveFile( filename.c_str() );
01444         }
01445         #endif
01446 
01451         virtual const char* Parse( const char* p, TiXmlParsingData* data = 0, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
01452 
01457         const TiXmlElement* RootElement() const         { return FirstChildElement(); }
01458         TiXmlElement* RootElement()                                     { return FirstChildElement(); }
01459 
01465         bool Error() const                                              { return error; }
01466 
01468         const char * ErrorDesc() const  { return errorDesc.c_str (); }
01469 
01473         int ErrorId()   const                           { return errorId; }
01474 
01482         int ErrorRow() const    { return errorLocation.row+1; }
01483         int ErrorCol() const    { return errorLocation.col+1; } 
01484 
01509         void SetTabSize( int _tabsize )         { tabsize = _tabsize; }
01510 
01511         int TabSize() const     { return tabsize; }
01512 
01516         void ClearError()                                               {       error = false; 
01517                                                                                                 errorId = 0; 
01518                                                                                                 errorDesc = ""; 
01519                                                                                                 errorLocation.row = errorLocation.col = 0; 
01520                                                                                                 //errorLocation.last = 0; 
01521                                                                                         }
01522 
01524         void Print() const                                              { Print( stdout, 0 ); }
01525 
01526         /* Write the document to a string using formatted printing ("pretty print"). This
01527                 will allocate a character array (new char[]) and return it as a pointer. The
01528                 calling code pust call delete[] on the return char* to avoid a memory leak.
01529         */
01530         //char* PrintToMemory() const; 
01531 
01533         virtual void Print( FILE* cfile, int depth = 0 ) const;
01534         // [internal use]
01535         void SetError( int err, const char* errorLocation, TiXmlParsingData* prevData, TiXmlEncoding encoding );
01536 
01537         virtual const TiXmlDocument*    ToDocument()    const { return this; } 
01538         virtual TiXmlDocument*          ToDocument()          { return this; } 
01539 
01542         virtual bool Accept( TiXmlVisitor* content ) const;
01543 
01544 protected :
01545         // [internal use]
01546         virtual TiXmlNode* Clone() const;
01547         #ifdef TIXML_USE_STL
01548         virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
01549         #endif
01550 
01551 private:
01552         void CopyTo( TiXmlDocument* target ) const;
01553 
01554         bool error;
01555         int  errorId;
01556         TIXML_STRING errorDesc;
01557         int tabsize;
01558         TiXmlCursor errorLocation;
01559         bool useMicrosoftBOM;           // the UTF-8 BOM were found when read. Note this, and try to write.
01560 };
01561 
01562 
01643 class TiXmlHandle
01644 {
01645 public:
01647         TiXmlHandle( TiXmlNode* _node )                                 { this->node = _node; }
01649         TiXmlHandle( const TiXmlHandle& ref )                   { this->node = ref.node; }
01650         TiXmlHandle operator=( const TiXmlHandle& ref ) { if ( &ref != this ) this->node = ref.node; return *this; }
01651 
01653         TiXmlHandle FirstChild() const;
01655         TiXmlHandle FirstChild( const char * value ) const;
01657         TiXmlHandle FirstChildElement() const;
01659         TiXmlHandle FirstChildElement( const char * value ) const;
01660 
01664         TiXmlHandle Child( const char* value, int index ) const;
01668         TiXmlHandle Child( int index ) const;
01673         TiXmlHandle ChildElement( const char* value, int index ) const;
01678         TiXmlHandle ChildElement( int index ) const;
01679 
01680         #ifdef TIXML_USE_STL
01681         TiXmlHandle FirstChild( const std::string& _value ) const                               { return FirstChild( _value.c_str() ); }
01682         TiXmlHandle FirstChildElement( const std::string& _value ) const                { return FirstChildElement( _value.c_str() ); }
01683 
01684         TiXmlHandle Child( const std::string& _value, int index ) const                 { return Child( _value.c_str(), index ); }
01685         TiXmlHandle ChildElement( const std::string& _value, int index ) const  { return ChildElement( _value.c_str(), index ); }
01686         #endif
01687 
01690         TiXmlNode* ToNode() const                       { return node; } 
01693         TiXmlElement* ToElement() const         { return ( ( node && node->ToElement() ) ? node->ToElement() : 0 ); }
01696         TiXmlText* ToText() const                       { return ( ( node && node->ToText() ) ? node->ToText() : 0 ); }
01699         TiXmlUnknown* ToUnknown() const         { return ( ( node && node->ToUnknown() ) ? node->ToUnknown() : 0 ); }
01700 
01704         TiXmlNode* Node() const                 { return ToNode(); } 
01708         TiXmlElement* Element() const   { return ToElement(); }
01712         TiXmlText* Text() const                 { return ToText(); }
01716         TiXmlUnknown* Unknown() const   { return ToUnknown(); }
01717 
01718 private:
01719         TiXmlNode* node;
01720 };
01721 
01722 
01742 class TiXmlPrinter : public TiXmlVisitor
01743 {
01744 public:
01745         TiXmlPrinter() : depth( 0 ), simpleTextPrint( false ),
01746                                          buffer(), indent( "    " ), lineBreak( "\n" ) {}
01747 
01748         virtual bool VisitEnter( const TiXmlDocument& doc );
01749         virtual bool VisitExit( const TiXmlDocument& doc );
01750 
01751         virtual bool VisitEnter( const TiXmlElement& element, const TiXmlAttribute* firstAttribute );
01752         virtual bool VisitExit( const TiXmlElement& element );
01753 
01754         virtual bool Visit( const TiXmlDeclaration& declaration );
01755         virtual bool Visit( const TiXmlText& text );
01756         virtual bool Visit( const TiXmlComment& comment );
01757         virtual bool Visit( const TiXmlUnknown& unknown );
01758 
01762         void SetIndent( const char* _indent )                   { indent = _indent ? _indent : "" ; }
01764         const char* Indent()                                                    { return indent.c_str(); }
01769         void SetLineBreak( const char* _lineBreak )             { lineBreak = _lineBreak ? _lineBreak : ""; }
01771         const char* LineBreak()                                                 { return lineBreak.c_str(); }
01772 
01776         void SetStreamPrinting()                                                { indent = "";
01777                                                                                                           lineBreak = "";
01778                                                                                                         }       
01780         const char* CStr()                                                              { return buffer.c_str(); }
01782         size_t Size()                                                                   { return buffer.size(); }
01783 
01784         #ifdef TIXML_USE_STL
01785 
01786         const std::string& Str()                                                { return buffer; }
01787         #endif
01788 
01789 private:
01790         void DoIndent() {
01791                 for( int i=0; i<depth; ++i )
01792                         buffer += indent;
01793         }
01794         void DoLineBreak() {
01795                 buffer += lineBreak;
01796         }
01797 
01798         int depth;
01799         bool simpleTextPrint;
01800         TIXML_STRING buffer;
01801         TIXML_STRING indent;
01802         TIXML_STRING lineBreak;
01803 };
01804 
01805 
01806 #ifdef _MSC_VER
01807 #pragma warning( pop )
01808 #endif
01809 
01810 #endif


win_tinyxml
Author(s): Daniel Stonier
autogenerated on Mon Oct 6 2014 12:28:38