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 OBTTINYXML_H
00027 #define OBTTINYXML_H
00028 
00029 #include "OBT.h"
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 #error "TIXML_USE_STL must be defined"
00058 //      #include "OBTtinystr.h"
00059         #define TIXML_STRING            TiXmlString
00060 #endif
00061 
00062 // Deprecated library function hell. Compilers want to use the
00063 // new safe versions. This probably doesn't fully address the problem,
00064 // but it gets closer. There are too many compilers for me to fully
00065 // test. If you get compilation troubles, undefine TIXML_SAFE
00066 #define TIXML_SAFE
00067 
00068 #ifdef TIXML_SAFE
00069         #if defined(_MSC_VER) && (_MSC_VER >= 1400 )
00070                 // Microsoft visual studio, version 2005 and higher.
00071                 #define TIXML_SNPRINTF _snprintf_s
00072                 #define TIXML_SNSCANF  _snscanf_s
00073                 #define TIXML_SSCANF   sscanf_s
00074         #elif defined(_MSC_VER) && (_MSC_VER >= 1200 )
00075                 // Microsoft visual studio, version 6 and higher.
00076                 //#pragma message( "Using _sn* functions." )
00077                 #define TIXML_SNPRINTF _snprintf
00078                 #define TIXML_SNSCANF  _snscanf
00079                 #define TIXML_SSCANF   sscanf
00080         #elif defined(__GNUC__) && (__GNUC__ >= 3 )
00081                 // GCC version 3 and higher.s
00082                 //#warning( "Using sn* functions." )
00083                 #define TIXML_SNPRINTF snprintf
00084                 #define TIXML_SNSCANF  snscanf
00085                 #define TIXML_SSCANF   sscanf
00086         #else
00087                 #define TIXML_SSCANF   sscanf
00088         #endif
00089 #endif  
00090 
00091 namespace OBT
00092 {
00093 class TiXmlDocument;
00094 class TiXmlElement;
00095 class TiXmlComment;
00096 class TiXmlUnknown;
00097 class TiXmlAttribute;
00098 class TiXmlText;
00099 class TiXmlDeclaration;
00100 class TiXmlParsingData;
00101 
00102 const int TIXML_MAJOR_VERSION = 2;
00103 const int TIXML_MINOR_VERSION = 5;
00104 const int TIXML_PATCH_VERSION = 3;
00105 
00106 /*      Internal structure for tracking location of items 
00107         in the XML file.
00108 */
00109 struct TiXmlCursor
00110 {
00111         TiXmlCursor()           { Clear(); }
00112         void Clear()            { row = col = -1; }
00113 
00114         int row;        // 0 based.
00115         int col;        // 0 based.
00116 };
00117 
00118 
00137 class OBT_API TiXmlVisitor
00138 {
00139 public:
00140         virtual ~TiXmlVisitor() {}
00141 
00143         virtual bool VisitEnter( const TiXmlDocument& /*doc*/ )                 { return true; }
00145         virtual bool VisitExit( const TiXmlDocument& /*doc*/ )                  { return true; }
00146 
00148         virtual bool VisitEnter( const TiXmlElement& /*element*/, const TiXmlAttribute* /*firstAttribute*/ )    { return true; }
00150         virtual bool VisitExit( const TiXmlElement& /*element*/ )               { return true; }
00151 
00153         virtual bool Visit( const TiXmlDeclaration& /*declaration*/ )   { return true; }
00155         virtual bool Visit( const TiXmlText& /*text*/ )                                 { return true; }
00157         virtual bool Visit( const TiXmlComment& /*comment*/ )                   { return true; }
00159         virtual bool Visit( const TiXmlUnknown& /*unknown*/ )                   { return true; }
00160 };
00161 
00162 // Only used by Attribute::Query functions
00163 enum 
00164 { 
00165         TIXML_SUCCESS,
00166         TIXML_NO_ATTRIBUTE,
00167         TIXML_WRONG_TYPE
00168 };
00169 
00170 
00171 // Used by the parsing routines.
00172 enum TiXmlEncoding
00173 {
00174         TIXML_ENCODING_UNKNOWN,
00175         TIXML_ENCODING_UTF8,
00176         TIXML_ENCODING_LEGACY
00177 };
00178 
00179 const TiXmlEncoding TIXML_DEFAULT_ENCODING = TIXML_ENCODING_UNKNOWN;
00180 
00203 class OBT_API TiXmlBase
00204 {
00205         friend class TiXmlNode;
00206         friend class TiXmlElement;
00207         friend class TiXmlDocument;
00208 
00209 public:
00210         TiXmlBase()     :       userData(0)             {}
00211         virtual ~TiXmlBase()                    {}
00212 
00222         virtual void Print( FILE* cfile, int depth ) const = 0;
00223 
00230         static void SetCondenseWhiteSpace( bool condense )              { condenseWhiteSpace = condense; }
00231 
00233         static bool IsWhiteSpaceCondensed()                                             { return condenseWhiteSpace; }
00234 
00253         int Row() const                 { return location.row + 1; }
00254         int Column() const              { return location.col + 1; }    
00255 
00256         void  SetUserData( void* user )                 { userData = user; }    
00257         void* GetUserData()                                             { return userData; }    
00258         const void* GetUserData() const                 { return userData; }    
00259 
00260         // Table that returs, for a given lead byte, the total number of bytes
00261         // in the UTF-8 sequence.
00262         static const int utf8ByteTable[256];
00263 
00264         virtual const char* Parse(      const char* p, 
00265                                                                 TiXmlParsingData* data, 
00266                                                                 TiXmlEncoding encoding /*= TIXML_ENCODING_UNKNOWN */ ) = 0;
00267 
00271         static void EncodeString( const TIXML_STRING& str, TIXML_STRING* out );
00272 
00273         enum
00274         {
00275                 TIXML_NO_ERROR = 0,
00276                 TIXML_ERROR,
00277                 TIXML_ERROR_OPENING_FILE,
00278                 TIXML_ERROR_OUT_OF_MEMORY,
00279                 TIXML_ERROR_PARSING_ELEMENT,
00280                 TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME,
00281                 TIXML_ERROR_READING_ELEMENT_VALUE,
00282                 TIXML_ERROR_READING_ATTRIBUTES,
00283                 TIXML_ERROR_PARSING_EMPTY,
00284                 TIXML_ERROR_READING_END_TAG,
00285                 TIXML_ERROR_PARSING_UNKNOWN,
00286                 TIXML_ERROR_PARSING_COMMENT,
00287                 TIXML_ERROR_PARSING_DECLARATION,
00288                 TIXML_ERROR_DOCUMENT_EMPTY,
00289                 TIXML_ERROR_EMBEDDED_NULL,
00290                 TIXML_ERROR_PARSING_CDATA,
00291                 TIXML_ERROR_DOCUMENT_TOP_ONLY,
00292 
00293                 TIXML_ERROR_STRING_COUNT
00294         };
00295 
00296 protected:
00297 
00298         static const char* SkipWhiteSpace( const char*, TiXmlEncoding encoding );
00299         inline static bool IsWhiteSpace( char c )               
00300         { 
00301                 return ( isspace( (unsigned char) c ) || c == '\n' || c == '\r' ); 
00302         }
00303         inline static bool IsWhiteSpace( int c )
00304         {
00305                 if ( c < 256 )
00306                         return IsWhiteSpace( (char) c );
00307                 return false;   // Again, only truly correct for English/Latin...but usually works.
00308         }
00309 
00310         #ifdef TIXML_USE_STL
00311         static bool     StreamWhiteSpace( std::istream * in, TIXML_STRING * tag );
00312         static bool StreamTo( std::istream * in, int character, TIXML_STRING * tag );
00313         #endif
00314 
00315         /*      Reads an XML name into the string provided. Returns
00316                 a pointer just past the last character of the name,
00317                 or 0 if the function has an error.
00318         */
00319         static const char* ReadName( const char* p, TIXML_STRING* name, TiXmlEncoding encoding );
00320 
00321         /*      Reads text. Returns a pointer past the given end tag.
00322                 Wickedly complex options, but it keeps the (sensitive) code in one place.
00323         */
00324         static const char* ReadText(    const char* in,                         // where to start
00325                                                                         TIXML_STRING* text,                     // the string read
00326                                                                         bool ignoreWhiteSpace,          // whether to keep the white space
00327                                                                         const char* endTag,                     // what ends this text
00328                                                                         bool ignoreCase,                        // whether to ignore case in the end tag
00329                                                                         TiXmlEncoding encoding );       // the current encoding
00330 
00331         // If an entity has been found, transform it into a character.
00332         static const char* GetEntity( const char* in, char* value, int* length, TiXmlEncoding encoding );
00333 
00334         // Get a character, while interpreting entities.
00335         // The length can be from 0 to 4 bytes.
00336         inline static const char* GetChar( const char* p, char* _value, int* length, TiXmlEncoding encoding )
00337         {
00338                 assert( p );
00339                 if ( encoding == TIXML_ENCODING_UTF8 )
00340                 {
00341                         *length = utf8ByteTable[ *((const unsigned char*)p) ];
00342                         assert( *length >= 0 && *length < 5 );
00343                 }
00344                 else
00345                 {
00346                         *length = 1;
00347                 }
00348 
00349                 if ( *length == 1 )
00350                 {
00351                         if ( *p == '&' )
00352                                 return GetEntity( p, _value, length, encoding );
00353                         *_value = *p;
00354                         return p+1;
00355                 }
00356                 else if ( *length )
00357                 {
00358                         //strncpy( _value, p, *length );        // lots of compilers don't like this function (unsafe),
00359                                                                                                 // and the null terminator isn't needed
00360                         for( int i=0; p[i] && i<*length; ++i ) {
00361                                 _value[i] = p[i];
00362                         }
00363                         return p + (*length);
00364                 }
00365                 else
00366                 {
00367                         // Not valid text.
00368                         return 0;
00369                 }
00370         }
00371 
00372         // Return true if the next characters in the stream are any of the endTag sequences.
00373         // Ignore case only works for english, and should only be relied on when comparing
00374         // to English words: StringEqual( p, "version", true ) is fine.
00375         static bool StringEqual(        const char* p,
00376                                                                 const char* endTag,
00377                                                                 bool ignoreCase,
00378                                                                 TiXmlEncoding encoding );
00379 
00380         static const char* errorString[ TIXML_ERROR_STRING_COUNT ];
00381 
00382         TiXmlCursor location;
00383 
00385         void*                   userData;
00386         
00387         // None of these methods are reliable for any language except English.
00388         // Good for approximation, not great for accuracy.
00389         static int IsAlpha( unsigned char anyByte, TiXmlEncoding encoding );
00390         static int IsAlphaNum( unsigned char anyByte, TiXmlEncoding encoding );
00391         inline static int ToLower( int v, TiXmlEncoding encoding )
00392         {
00393                 if ( encoding == TIXML_ENCODING_UTF8 )
00394                 {
00395                         if ( v < 128 ) return tolower( v );
00396                         return v;
00397                 }
00398                 else
00399                 {
00400                         return tolower( v );
00401                 }
00402         }
00403         static void ConvertUTF32ToUTF8( unsigned long input, char* output, int* length );
00404 
00405 private:
00406         TiXmlBase( const TiXmlBase& );                          // not implemented.
00407         void operator=( const TiXmlBase& base );        // not allowed.
00408 
00409         struct Entity
00410         {
00411                 const char*     str;
00412                 unsigned int    strLength;
00413                 char                chr;
00414         };
00415         enum
00416         {
00417                 NUM_ENTITY = 5,
00418                 MAX_ENTITY_LENGTH = 6
00419 
00420         };
00421         static Entity entity[ NUM_ENTITY ];
00422         static bool condenseWhiteSpace;
00423 };
00424 
00425 
00432 class OBT_API TiXmlNode : public TiXmlBase
00433 {
00434         friend class TiXmlDocument;
00435         friend class TiXmlElement;
00436 
00437 public:
00438         #ifdef TIXML_USE_STL    
00439 
00443             OBT_API friend std::istream& operator >> (std::istream& in, TiXmlNode& base);
00444 
00461             OBT_API friend std::ostream& operator<< (std::ostream& out, const TiXmlNode& base);
00462 
00464                 OBT_API friend std::string& operator<< (std::string& out, const TiXmlNode& base );
00465 
00466         #endif
00467 
00471         enum NodeType
00472         {
00473                 DOCUMENT,
00474                 ELEMENT,
00475                 COMMENT,
00476                 UNKNOWN,
00477                 TEXT,
00478                 DECLARATION,
00479                 TYPECOUNT
00480         };
00481 
00482         virtual ~TiXmlNode();
00483 
00496         const char *Value() const { return value.c_str (); }
00497 
00498     #ifdef TIXML_USE_STL
00499 
00503         const std::string& ValueStr() const { return value; }
00504         #endif
00505 
00506         const TIXML_STRING& ValueTStr() const { return value; }
00507 
00517         void setValue(const char * _value) { value = _value;}
00518 
00519     #ifdef TIXML_USE_STL
00521         void setValue( const std::string& _value )      { value = _value; }
00522         #endif
00523 
00525         void Clear();
00526 
00528         TiXmlNode* Parent()                                                     { return parent; }
00529         const TiXmlNode* Parent() const                         { return parent; }
00530 
00531         const TiXmlNode* FirstChild()   const           { return firstChild; }  
00532         TiXmlNode* FirstChild()                                         { return firstChild; }
00533         const TiXmlNode* FirstChild( const char * value ) const;                        
00534 
00535         TiXmlNode* FirstChild( const char * _value ) {
00536                 // Call through to the const version - safe since nothing is changed. Exiting syntax: cast this to a const (always safe)
00537                 // call the method, cast the return back to non-const.
00538                 return const_cast< TiXmlNode* > ((const_cast< const TiXmlNode* >(this))->FirstChild( _value ));
00539         }
00540         const TiXmlNode* LastChild() const      { return lastChild; }           
00541         TiXmlNode* LastChild()  { return lastChild; }
00542         
00543         const TiXmlNode* LastChild( const char * value ) const;                 
00544         TiXmlNode* LastChild( const char * _value ) {
00545                 return const_cast< TiXmlNode* > ((const_cast< const TiXmlNode* >(this))->LastChild( _value ));
00546         }
00547 
00548     #ifdef TIXML_USE_STL
00549         const TiXmlNode* FirstChild( const std::string& _value ) const  {       return FirstChild (_value.c_str ());    }       
00550         TiXmlNode* FirstChild( const std::string& _value )                              {       return FirstChild (_value.c_str ());    }       
00551         const TiXmlNode* LastChild( const std::string& _value ) const   {       return LastChild (_value.c_str ());     }       
00552         TiXmlNode* LastChild( const std::string& _value )                               {       return LastChild (_value.c_str ());     }       
00553         #endif
00554 
00571         const TiXmlNode* IterateChildren( const TiXmlNode* previous ) const;
00572         TiXmlNode* IterateChildren( const TiXmlNode* previous ) {
00573                 return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->IterateChildren( previous ) );
00574         }
00575 
00577         const TiXmlNode* IterateChildren( const char * value, const TiXmlNode* previous ) const;
00578         TiXmlNode* IterateChildren( const char * _value, const TiXmlNode* previous ) {
00579                 return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->IterateChildren( _value, previous ) );
00580         }
00581 
00582     #ifdef TIXML_USE_STL
00583         const TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNode* previous ) const  {       return IterateChildren (_value.c_str (), previous);     }       
00584         TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNode* previous ) {    return IterateChildren (_value.c_str (), previous);     }       
00585         #endif
00586 
00590         TiXmlNode* InsertEndChild( const TiXmlNode& addThis );
00591 
00592 
00602         TiXmlNode* LinkEndChild( TiXmlNode* addThis );
00603 
00607         TiXmlNode* InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis );
00608 
00612         TiXmlNode* InsertAfterChild(  TiXmlNode* afterThis, const TiXmlNode& addThis );
00613 
00617         TiXmlNode* ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& withThis );
00618 
00620         bool RemoveChild( TiXmlNode* removeThis );
00621 
00623         const TiXmlNode* PreviousSibling() const                        { return prev; }
00624         TiXmlNode* PreviousSibling()                                            { return prev; }
00625 
00627         const TiXmlNode* PreviousSibling( const char * ) const;
00628         TiXmlNode* PreviousSibling( const char *_prev ) {
00629                 return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->PreviousSibling( _prev ) );
00630         }
00631 
00632     #ifdef TIXML_USE_STL
00633         const TiXmlNode* PreviousSibling( const std::string& _value ) const     {       return PreviousSibling (_value.c_str ());       }       
00634         TiXmlNode* PreviousSibling( const std::string& _value )                         {       return PreviousSibling (_value.c_str ());       }       
00635         const TiXmlNode* NextSibling( const std::string& _value) const          {       return NextSibling (_value.c_str ());   }       
00636         TiXmlNode* NextSibling( const std::string& _value)                                      {       return NextSibling (_value.c_str ());   }       
00637         #endif
00638 
00640         const TiXmlNode* NextSibling() const                            { return next; }
00641         TiXmlNode* NextSibling()                                                        { return next; }
00642 
00644         const TiXmlNode* NextSibling( const char * ) const;
00645         TiXmlNode* NextSibling( const char* _next ) {
00646                 return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->NextSibling( _next ) );
00647         }
00648 
00653         const TiXmlElement* NextSiblingElement() const;
00654         TiXmlElement* NextSiblingElement() {
00655                 return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->NextSiblingElement() );
00656         }
00657 
00662         const TiXmlElement* NextSiblingElement( const char * ) const;
00663         TiXmlElement* NextSiblingElement( const char *_next ) {
00664                 return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->NextSiblingElement( _next ) );
00665         }
00666 
00667     #ifdef TIXML_USE_STL
00668         const TiXmlElement* NextSiblingElement( const std::string& _value) const        {       return NextSiblingElement (_value.c_str ());    }       
00669         TiXmlElement* NextSiblingElement( const std::string& _value)                            {       return NextSiblingElement (_value.c_str ());    }       
00670         #endif
00671 
00673         const TiXmlElement* FirstChildElement() const;
00674         TiXmlElement* FirstChildElement() {
00675                 return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->FirstChildElement() );
00676         }
00677 
00679         const TiXmlElement* FirstChildElement( const char * _value ) const;
00680         TiXmlElement* FirstChildElement( const char * _value ) {
00681                 return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->FirstChildElement( _value ) );
00682         }
00683 
00684     #ifdef TIXML_USE_STL
00685         const TiXmlElement* FirstChildElement( const std::string& _value ) const        {       return FirstChildElement (_value.c_str ());     }       
00686         TiXmlElement* FirstChildElement( const std::string& _value )                            {       return FirstChildElement (_value.c_str ());     }       
00687         #endif
00688 
00693         int Type() const        { return type; }
00694 
00698         const TiXmlDocument* GetDocument() const;
00699         TiXmlDocument* GetDocument() {
00700                 return const_cast< TiXmlDocument* >( (const_cast< const TiXmlNode* >(this))->GetDocument() );
00701         }
00702 
00704         bool NoChildren() const                                         { return !firstChild; }
00705 
00706         virtual const TiXmlDocument*    ToDocument()    const { return 0; } 
00707         virtual const TiXmlElement*     ToElement()     const { return 0; } 
00708         virtual const TiXmlComment*     ToComment()     const { return 0; } 
00709         virtual const TiXmlUnknown*     ToUnknown()     const { return 0; } 
00710         virtual const TiXmlText*        ToText()        const { return 0; } 
00711         virtual const TiXmlDeclaration* ToDeclaration() const { return 0; } 
00712 
00713         virtual TiXmlDocument*          ToDocument()    { return 0; } 
00714         virtual TiXmlElement*           ToElement()         { return 0; } 
00715         virtual TiXmlComment*           ToComment()     { return 0; } 
00716         virtual TiXmlUnknown*           ToUnknown()         { return 0; } 
00717         virtual TiXmlText*                  ToText()        { return 0; } 
00718         virtual TiXmlDeclaration*       ToDeclaration() { return 0; } 
00719 
00723         virtual TiXmlNode* Clone() const = 0;
00724 
00747         virtual bool Accept( TiXmlVisitor* visitor ) const = 0;
00748 
00749 protected:
00750         TiXmlNode( NodeType _type );
00751 
00752         // Copy to the allocated object. Shared functionality between Clone, Copy constructor,
00753         // and the assignment operator.
00754         void CopyTo( TiXmlNode* target ) const;
00755 
00756         #ifdef TIXML_USE_STL
00757             // The real work of the input operator.
00758         virtual void StreamIn( std::istream* in, TIXML_STRING* tag ) = 0;
00759         #endif
00760 
00761         // Figure out what is at *p, and parse it. Returns null if it is not an xml node.
00762         TiXmlNode* Identify( const char* start, TiXmlEncoding encoding );
00763 
00764         TiXmlNode*              parent;
00765         NodeType                type;
00766 
00767         TiXmlNode*              firstChild;
00768         TiXmlNode*              lastChild;
00769 
00770         TIXML_STRING    value;
00771 
00772         TiXmlNode*              prev;
00773         TiXmlNode*              next;
00774 
00775 private:
00776         TiXmlNode( const TiXmlNode& );                          // not implemented.
00777         void operator=( const TiXmlNode& base );        // not allowed.
00778 };
00779 
00787 class OBT_API TiXmlAttribute : public TiXmlBase
00788 {
00789         friend class TiXmlAttributeSet;
00790 
00791 public:
00793         TiXmlAttribute() : TiXmlBase()
00794         {
00795                 document = 0;
00796                 prev = next = 0;
00797         }
00798 
00799         #ifdef TIXML_USE_STL
00801         TiXmlAttribute( const std::string& _name, const std::string& _value )
00802         {
00803                 name = _name;
00804                 value = _value;
00805                 document = 0;
00806                 prev = next = 0;
00807         }
00808         #endif
00809 
00811         TiXmlAttribute( const char * _name, const char * _value )
00812         {
00813                 name = _name;
00814                 value = _value;
00815                 document = 0;
00816                 prev = next = 0;
00817         }
00818 
00819         const char*             Name()  const           { return name.c_str(); }                
00820         const char*             Value() const           { return value.c_str(); }               
00821         #ifdef TIXML_USE_STL
00822         const std::string& ValueStr() const     { return value; }                               
00823         #endif
00824         int                             IntValue() const;                                                                       
00825         double                  DoubleValue() const;                                                            
00826 
00827         // Get the tinyxml string representation
00828         const TIXML_STRING& NameTStr() const { return name; }
00829 
00839         int QueryIntValue( int* _value ) const;
00841         int QueryDoubleValue( double* _value ) const;
00842 
00843         void SetName( const char* _name )       { name = _name; }                               
00844         void setValue( const char* _value )     { value = _value; }                             
00845 
00846         void SetIntValue( int _value );                                                                         
00847         void SetDoubleValue( double _value );                                                           
00848 
00849     #ifdef TIXML_USE_STL
00851         void SetName( const std::string& _name )        { name = _name; }       
00853         void setValue( const std::string& _value )      { value = _value; }
00854         #endif
00855 
00857         const TiXmlAttribute* Next() const;
00858         TiXmlAttribute* Next() {
00859                 return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Next() ); 
00860         }
00861 
00863         const TiXmlAttribute* Previous() const;
00864         TiXmlAttribute* Previous() {
00865                 return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Previous() ); 
00866         }
00867 
00868         bool operator==( const TiXmlAttribute& rhs ) const { return rhs.name == name; }
00869         bool operator<( const TiXmlAttribute& rhs )      const { return name < rhs.name; }
00870         bool operator>( const TiXmlAttribute& rhs )  const { return name > rhs.name; }
00871 
00872         /*      Attribute parsing starts: first letter of the name
00873                                                  returns: the next char after the value end quote
00874         */
00875         virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
00876 
00877         // Prints this Attribute to a FILE stream.
00878         virtual void Print( FILE* cfile, int depth ) const {
00879                 Print( cfile, depth, 0 );
00880         }
00881         void Print( FILE* cfile, int depth, TIXML_STRING* str ) const;
00882 
00883         // [internal use]
00884         // Set the document pointer so the attribute can report errors.
00885         void SetDocument( TiXmlDocument* doc )  { document = doc; }
00886 
00887 private:
00888         TiXmlAttribute( const TiXmlAttribute& );                                // not implemented.
00889         void operator=( const TiXmlAttribute& base );   // not allowed.
00890 
00891         TiXmlDocument*  document;       // A pointer back to a document, for error reporting.
00892         TIXML_STRING name;
00893         TIXML_STRING value;
00894         TiXmlAttribute* prev;
00895         TiXmlAttribute* next;
00896 };
00897 
00898 
00899 /*      A class used to manage a group of attributes.
00900         It is only used internally, both by the ELEMENT and the DECLARATION.
00901         
00902         The set can be changed transparent to the Element and Declaration
00903         classes that use it, but NOT transparent to the Attribute
00904         which has to implement a next() and previous() method. Which makes
00905         it a bit problematic and prevents the use of STL.
00906 
00907         This version is implemented with circular lists because:
00908                 - I like circular lists
00909                 - it demonstrates some independence from the (typical) doubly linked list.
00910 */
00911 class OBT_API TiXmlAttributeSet
00912 {
00913 public:
00914         TiXmlAttributeSet();
00915         ~TiXmlAttributeSet();
00916 
00917         void Add( TiXmlAttribute* attribute );
00918         void Remove( TiXmlAttribute* attribute );
00919 
00920         const TiXmlAttribute* First()   const   { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; }
00921         TiXmlAttribute* First()                                 { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; }
00922         const TiXmlAttribute* Last() const              { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; }
00923         TiXmlAttribute* Last()                                  { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; }
00924 
00925         const TiXmlAttribute*   Find( const char* _name ) const;
00926         TiXmlAttribute* Find( const char* _name ) {
00927                 return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttributeSet* >(this))->Find( _name ) );
00928         }
00929         #ifdef TIXML_USE_STL
00930         const TiXmlAttribute*   Find( const std::string& _name ) const;
00931         TiXmlAttribute* Find( const std::string& _name ) {
00932                 return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttributeSet* >(this))->Find( _name ) );
00933         }
00934 
00935         #endif
00936 
00937 private:
00938         //*ME:  Because of hidden/disabled copy-construktor in TiXmlAttribute (sentinel-element),
00939         //*ME:  this class must be also use a hidden/disabled copy-constructor !!!
00940         TiXmlAttributeSet( const TiXmlAttributeSet& );  // not allowed
00941         void operator=( const TiXmlAttributeSet& );     // not allowed (as TiXmlAttribute)
00942 
00943         TiXmlAttribute sentinel;
00944 };
00945 
00946 
00951 class OBT_API TiXmlElement : public TiXmlNode
00952 {
00953 public:
00955         TiXmlElement (const char * in_value);
00956 
00957         #ifdef TIXML_USE_STL
00959         TiXmlElement( const std::string& _value );
00960         #endif
00961 
00962         TiXmlElement( const TiXmlElement& );
00963 
00964         void operator=( const TiXmlElement& base );
00965 
00966         virtual ~TiXmlElement();
00967 
00971         const char* Attribute( const char* name ) const;
00972 
00979         const char* Attribute( const char* name, int* i ) const;
00980 
00987         const char* Attribute( const char* name, double* d ) const;
00988 
00996         int QueryIntAttribute( const char* name, int* _value ) const;
00998         int QueryDoubleAttribute( const char* name, double* _value ) const;
01000         int QueryFloatAttribute( const char* name, float* _value ) const {
01001                 double d;
01002                 int result = QueryDoubleAttribute( name, &d );
01003                 if ( result == TIXML_SUCCESS ) {
01004                         *_value = (float)d;
01005                 }
01006                 return result;
01007         }
01008 
01009     #ifdef TIXML_USE_STL
01010 
01018         template< typename T > int QueryValueAttribute( const std::string& name, T* outValue ) const
01019         {
01020                 const TiXmlAttribute* node = attributeSet.Find( name );
01021                 if ( !node )
01022                         return TIXML_NO_ATTRIBUTE;
01023 
01024                 std::stringstream sstream( node->ValueStr() );
01025                 sstream >> *outValue;
01026                 if ( !sstream.fail() )
01027                         return TIXML_SUCCESS;
01028                 return TIXML_WRONG_TYPE;
01029         }
01030         /*
01031          This is - in theory - a bug fix for "QueryValueAtribute returns truncated std::string"
01032          but template specialization is hard to get working cross-compiler. Leaving the bug for now.
01033          
01034         // The above will fail for std::string because the space character is used as a seperator.
01035         // Specialize for strings. Bug [ 1695429 ] QueryValueAtribute returns truncated std::string
01036         template<> int QueryValueAttribute( const std::string& name, std::string* outValue ) const
01037         {
01038                 const TiXmlAttribute* node = attributeSet.Find( name );
01039                 if ( !node )
01040                         return TIXML_NO_ATTRIBUTE;
01041                 *outValue = node->ValueStr();
01042                 return TIXML_SUCCESS;
01043         }
01044         */
01045         #endif
01046 
01050         void SetAttribute( const char* name, const char * _value );
01051 
01052     #ifdef TIXML_USE_STL
01053         const std::string* Attribute( const std::string& name ) const;
01054         const std::string* Attribute( const std::string& name, int* i ) const;
01055         const std::string* Attribute( const std::string& name, double* d ) const;
01056         int QueryIntAttribute( const std::string& name, int* _value ) const;
01057         int QueryDoubleAttribute( const std::string& name, double* _value ) const;
01058 
01060         void SetAttribute( const std::string& name, const std::string& _value );
01062         void SetAttribute( const std::string& name, int _value );
01063         #endif
01064 
01068         void SetAttribute( const char * name, int value );
01069 
01073         void SetDoubleAttribute( const char * name, double value );
01074 
01077         void RemoveAttribute( const char * name );
01078     #ifdef TIXML_USE_STL
01079         void RemoveAttribute( const std::string& name ) {       RemoveAttribute (name.c_str ());        }       
01080         #endif
01081 
01082         const TiXmlAttribute* FirstAttribute() const    { return attributeSet.First(); }                
01083         TiXmlAttribute* FirstAttribute()                                { return attributeSet.First(); }
01084         const TiXmlAttribute* LastAttribute()   const   { return attributeSet.Last(); }         
01085         TiXmlAttribute* LastAttribute()                                 { return attributeSet.Last(); }
01086 
01119         const char* GetText() const;
01120 
01122         virtual TiXmlNode* Clone() const;
01123         // Print the Element to a FILE stream.
01124         virtual void Print( FILE* cfile, int depth ) const;
01125 
01126         /*      Attribtue parsing starts: next char past '<'
01127                                                  returns: next char past '>'
01128         */
01129         virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
01130 
01131         virtual const TiXmlElement*     ToElement()     const { return this; } 
01132         virtual TiXmlElement*           ToElement()               { return this; } 
01133 
01136         virtual bool Accept( TiXmlVisitor* visitor ) const;
01137 
01138 protected:
01139 
01140         void CopyTo( TiXmlElement* target ) const;
01141         void ClearThis();       // like clear, but initializes 'this' object as well
01142 
01143         // Used to be public [internal use]
01144         #ifdef TIXML_USE_STL
01145         virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
01146         #endif
01147         /*      [internal use]
01148                 Reads the "value" of the element -- another element, or text.
01149                 This should terminate with the current end tag.
01150         */
01151         const char* ReadValue( const char* in, TiXmlParsingData* prevData, TiXmlEncoding encoding );
01152 
01153 private:
01154 
01155         TiXmlAttributeSet attributeSet;
01156 };
01157 
01158 
01161 class OBT_API TiXmlComment : public TiXmlNode
01162 {
01163 public:
01165         TiXmlComment() : TiXmlNode( TiXmlNode::COMMENT ) {}
01167         TiXmlComment( const char* _value ) : TiXmlNode( TiXmlNode::COMMENT ) {
01168                 setValue( _value );
01169         }
01170         TiXmlComment( const TiXmlComment& );
01171         void operator=( const TiXmlComment& base );
01172 
01173         virtual ~TiXmlComment() {}
01174 
01176         virtual TiXmlNode* Clone() const;
01177         // Write this Comment to a FILE stream.
01178         virtual void Print( FILE* cfile, int depth ) const;
01179 
01180         /*      Attribtue parsing starts: at the ! of the !--
01181                                                  returns: next char past '>'
01182         */
01183         virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
01184 
01185         virtual const TiXmlComment*  ToComment() const { return this; } 
01186         virtual TiXmlComment*  ToComment() { return this; } 
01187 
01190         virtual bool Accept( TiXmlVisitor* visitor ) const;
01191 
01192 protected:
01193         void CopyTo( TiXmlComment* target ) const;
01194 
01195         // used to be public
01196         #ifdef TIXML_USE_STL
01197         virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
01198         #endif
01199 //      virtual void StreamOut( TIXML_OSTREAM * out ) const;
01200 
01201 private:
01202 
01203 };
01204 
01205 
01211 class OBT_API TiXmlText : public TiXmlNode
01212 {
01213         friend class TiXmlElement;
01214 public:
01219         TiXmlText (const char * initValue ) : TiXmlNode (TiXmlNode::TEXT)
01220         {
01221                 setValue( initValue );
01222                 cdata = false;
01223         }
01224         virtual ~TiXmlText() {}
01225 
01226         #ifdef TIXML_USE_STL
01228         TiXmlText( const std::string& initValue ) : TiXmlNode (TiXmlNode::TEXT)
01229         {
01230                 setValue( initValue );
01231                 cdata = false;
01232         }
01233         #endif
01234 
01235         TiXmlText( const TiXmlText& copy ) : TiXmlNode( TiXmlNode::TEXT )       { copy.CopyTo( this ); }
01236         void operator=( const TiXmlText& base )                                                         { base.CopyTo( this ); }
01237 
01238         // Write this text object to a FILE stream.
01239         virtual void Print( FILE* cfile, int depth ) const;
01240 
01242         bool CDATA() const                              { return cdata; }
01244         void SetCDATA( bool _cdata )    { cdata = _cdata; }
01245 
01246         virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
01247 
01248         virtual const TiXmlText* ToText() const { return this; } 
01249         virtual TiXmlText*       ToText()       { return this; } 
01250 
01253         virtual bool Accept( TiXmlVisitor* content ) const;
01254 
01255 protected :
01257         virtual TiXmlNode* Clone() const;
01258         void CopyTo( TiXmlText* target ) const;
01259 
01260         bool Blank() const;     // returns true if all white space and new lines
01261         // [internal use]
01262         #ifdef TIXML_USE_STL
01263         virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
01264         #endif
01265 
01266 private:
01267         bool cdata;                     // true if this should be input and output as a CDATA style text element
01268 };
01269 
01270 
01284 class OBT_API TiXmlDeclaration : public TiXmlNode
01285 {
01286 public:
01288         TiXmlDeclaration()   : TiXmlNode( TiXmlNode::DECLARATION ) {}
01289 
01290 #ifdef TIXML_USE_STL
01292         TiXmlDeclaration(       const std::string& _version,
01293                                                 const std::string& _encoding,
01294                                                 const std::string& _standalone );
01295 #endif
01296 
01298         TiXmlDeclaration(       const char* _version,
01299                                                 const char* _encoding,
01300                                                 const char* _standalone );
01301 
01302         TiXmlDeclaration( const TiXmlDeclaration& copy );
01303         void operator=( const TiXmlDeclaration& copy );
01304 
01305         virtual ~TiXmlDeclaration()     {}
01306 
01308         const char *Version() const                     { return version.c_str (); }
01310         const char *Encoding() const            { return encoding.c_str (); }
01312         const char *Standalone() const          { return standalone.c_str (); }
01313 
01315         virtual TiXmlNode* Clone() const;
01316         // Print this declaration to a FILE stream.
01317         virtual void Print( FILE* cfile, int depth, TIXML_STRING* str ) const;
01318         virtual void Print( FILE* cfile, int depth ) const {
01319                 Print( cfile, depth, 0 );
01320         }
01321 
01322         virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
01323 
01324         virtual const TiXmlDeclaration* ToDeclaration() const { return this; } 
01325         virtual TiXmlDeclaration*       ToDeclaration()       { return this; } 
01326 
01329         virtual bool Accept( TiXmlVisitor* visitor ) const;
01330 
01331 protected:
01332         void CopyTo( TiXmlDeclaration* target ) const;
01333         // used to be public
01334         #ifdef TIXML_USE_STL
01335         virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
01336         #endif
01337 
01338 private:
01339 
01340         TIXML_STRING version;
01341         TIXML_STRING encoding;
01342         TIXML_STRING standalone;
01343 };
01344 
01345 
01353 class OBT_API TiXmlUnknown : public TiXmlNode
01354 {
01355 public:
01356         TiXmlUnknown() : TiXmlNode( TiXmlNode::UNKNOWN )        {}
01357         virtual ~TiXmlUnknown() {}
01358 
01359         TiXmlUnknown( const TiXmlUnknown& copy ) : TiXmlNode( TiXmlNode::UNKNOWN )              { copy.CopyTo( this ); }
01360         void operator=( const TiXmlUnknown& copy )                                                                              { copy.CopyTo( this ); }
01361 
01363         virtual TiXmlNode* Clone() const;
01364         // Print this Unknown to a FILE stream.
01365         virtual void Print( FILE* cfile, int depth ) const;
01366 
01367         virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
01368 
01369         virtual const TiXmlUnknown*     ToUnknown()     const { return this; } 
01370         virtual TiXmlUnknown*           ToUnknown()         { return this; } 
01371 
01374         virtual bool Accept( TiXmlVisitor* content ) const;
01375 
01376 protected:
01377         void CopyTo( TiXmlUnknown* target ) const;
01378 
01379         #ifdef TIXML_USE_STL
01380         virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
01381         #endif
01382 
01383 private:
01384 
01385 };
01386 
01387 
01392 class OBT_API TiXmlDocument : public TiXmlNode
01393 {
01394 public:
01396         TiXmlDocument();
01398         TiXmlDocument( const char * documentName );
01399 
01400         #ifdef TIXML_USE_STL
01402         TiXmlDocument( const std::string& documentName );
01403         #endif
01404 
01405         TiXmlDocument( const TiXmlDocument& copy );
01406         void operator=( const TiXmlDocument& copy );
01407 
01408         virtual ~TiXmlDocument() {}
01409 
01414         bool LoadFile( TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
01416         bool SaveFile() const;
01418         bool LoadFile( const char * filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
01420         bool SaveFile( const char * filename ) const;
01426         bool LoadFile( FILE*, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
01428         bool SaveFile( FILE* ) const;
01429 
01430         #ifdef TIXML_USE_STL
01431         bool LoadFile( const std::string& filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING )                   
01432         {
01433 //              StringToBuffer f( filename );
01434 //              return ( f.buffer && LoadFile( f.buffer, encoding ));
01435                 return LoadFile( filename.c_str(), encoding );
01436         }
01437         bool SaveFile( const std::string& filename ) const              
01438         {
01439 //              StringToBuffer f( filename );
01440 //              return ( f.buffer && SaveFile( f.buffer ));
01441                 return SaveFile( filename.c_str() );
01442         }
01443         #endif
01444 
01449         virtual const char* Parse( const char* p, TiXmlParsingData* data = 0, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
01450 
01455         const TiXmlElement* RootElement() const         { return FirstChildElement(); }
01456         TiXmlElement* RootElement()                                     { return FirstChildElement(); }
01457 
01463         bool Error() const                                              { return error; }
01464 
01466         const char * ErrorDesc() const  { return errorDesc.c_str (); }
01467 
01471         int ErrorId()   const                           { return errorId; }
01472 
01480         int ErrorRow() const    { return errorLocation.row+1; }
01481         int ErrorCol() const    { return errorLocation.col+1; } 
01482 
01507         void SetTabSize( int _tabsize )         { tabsize = _tabsize; }
01508 
01509         int TabSize() const     { return tabsize; }
01510 
01514         void ClearError()                                               {       error = false; 
01515                                                                                                 errorId = 0; 
01516                                                                                                 errorDesc = ""; 
01517                                                                                                 errorLocation.row = errorLocation.col = 0; 
01518                                                                                                 //errorLocation.last = 0; 
01519                                                                                         }
01520 
01522         void Print() const                                              { Print( stdout, 0 ); }
01523 
01524         /* Write the document to a string using formatted printing ("pretty print"). This
01525                 will allocate a character array (new char[]) and return it as a pointer. The
01526                 calling code pust call delete[] on the return char* to avoid a memory leak.
01527         */
01528         //char* PrintToMemory() const; 
01529 
01531         virtual void Print( FILE* cfile, int depth = 0 ) const;
01532         // [internal use]
01533         void SetError( int err, const char* errorLocation, TiXmlParsingData* prevData, TiXmlEncoding encoding );
01534 
01535         virtual const TiXmlDocument*    ToDocument()    const { return this; } 
01536         virtual TiXmlDocument*          ToDocument()          { return this; } 
01537 
01540         virtual bool Accept( TiXmlVisitor* content ) const;
01541 
01542 protected :
01543         // [internal use]
01544         virtual TiXmlNode* Clone() const;
01545         #ifdef TIXML_USE_STL
01546         virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
01547         #endif
01548 
01549 private:
01550         void CopyTo( TiXmlDocument* target ) const;
01551 
01552         bool error;
01553         int  errorId;
01554         TIXML_STRING errorDesc;
01555         int tabsize;
01556         TiXmlCursor errorLocation;
01557         bool useMicrosoftBOM;           // the UTF-8 BOM were found when read. Note this, and try to write.
01558 };
01559 
01560 
01641 class OBT_API TiXmlHandle
01642 {
01643 public:
01645         TiXmlHandle( TiXmlNode* _node )                                 { this->node = _node; }
01647         TiXmlHandle( const TiXmlHandle& ref )                   { this->node = ref.node; }
01648         TiXmlHandle operator=( const TiXmlHandle& ref ) { this->node = ref.node; return *this; }
01649 
01651         TiXmlHandle FirstChild() const;
01653         TiXmlHandle FirstChild( const char * value ) const;
01655         TiXmlHandle FirstChildElement() const;
01657         TiXmlHandle FirstChildElement( const char * value ) const;
01658 
01662         TiXmlHandle Child( const char* value, int index ) const;
01666         TiXmlHandle Child( int index ) const;
01671         TiXmlHandle ChildElement( const char* value, int index ) const;
01676         TiXmlHandle ChildElement( int index ) const;
01677 
01678         #ifdef TIXML_USE_STL
01679         TiXmlHandle FirstChild( const std::string& _value ) const                               { return FirstChild( _value.c_str() ); }
01680         TiXmlHandle FirstChildElement( const std::string& _value ) const                { return FirstChildElement( _value.c_str() ); }
01681 
01682         TiXmlHandle Child( const std::string& _value, int index ) const                 { return Child( _value.c_str(), index ); }
01683         TiXmlHandle ChildElement( const std::string& _value, int index ) const  { return ChildElement( _value.c_str(), index ); }
01684         #endif
01685 
01688         TiXmlNode* ToNode() const                       { return node; } 
01691         TiXmlElement* ToElement() const         { return ( ( node && node->ToElement() ) ? node->ToElement() : 0 ); }
01694         TiXmlText* ToText() const                       { return ( ( node && node->ToText() ) ? node->ToText() : 0 ); }
01697         TiXmlUnknown* ToUnknown() const         { return ( ( node && node->ToUnknown() ) ? node->ToUnknown() : 0 ); }
01698 
01702         TiXmlNode* Node() const                 { return ToNode(); } 
01706         TiXmlElement* Element() const   { return ToElement(); }
01710         TiXmlText* Text() const                 { return ToText(); }
01714         TiXmlUnknown* Unknown() const   { return ToUnknown(); }
01715 
01716 private:
01717         TiXmlNode* node;
01718 };
01719 
01720 
01740 class OBT_API TiXmlPrinter : public TiXmlVisitor
01741 {
01742 public:
01743         TiXmlPrinter() : depth( 0 ), simpleTextPrint( false ),
01744                                          buffer(), indent( "    " ), lineBreak( "\n" ) {}
01745 
01746         virtual bool VisitEnter( const TiXmlDocument& doc );
01747         virtual bool VisitExit( const TiXmlDocument& doc );
01748 
01749         virtual bool VisitEnter( const TiXmlElement& element, const TiXmlAttribute* firstAttribute );
01750         virtual bool VisitExit( const TiXmlElement& element );
01751 
01752         virtual bool Visit( const TiXmlDeclaration& declaration );
01753         virtual bool Visit( const TiXmlText& text );
01754         virtual bool Visit( const TiXmlComment& comment );
01755         virtual bool Visit( const TiXmlUnknown& unknown );
01756 
01760         void SetIndent( const char* _indent )                   { indent = _indent ? _indent : "" ; }
01762         const char* Indent()                                                    { return indent.c_str(); }
01767         void SetLineBreak( const char* _lineBreak )             { lineBreak = _lineBreak ? _lineBreak : ""; }
01769         const char* LineBreak()                                                 { return lineBreak.c_str(); }
01770 
01774         void SetStreamPrinting()                                                { indent = "";
01775                                                                                                           lineBreak = "";
01776                                                                                                         }       
01778         const char* CStr()                                                              { return buffer.c_str(); }
01780         size_t Size()                                                                   { return buffer.size(); }
01781 
01782         #ifdef TIXML_USE_STL
01784         const std::string& Str()                                                { return buffer; }
01785         #endif
01786 
01787 private:
01788         void DoIndent() {
01789                 for( int i=0; i<depth; ++i )
01790                         buffer += indent;
01791         }
01792         void DoLineBreak() {
01793                 buffer += lineBreak;
01794         }
01795 
01796         int depth;
01797         bool simpleTextPrint;
01798         TIXML_STRING buffer;
01799         TIXML_STRING indent;
01800         TIXML_STRING lineBreak;
01801 };
01802 
01803 
01804 #ifdef _MSC_VER
01805 #pragma warning( pop )
01806 #endif
01807 }
01808 #endif
01809 

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