Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 9, 2006, 5:28:10 PM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: compiles again, BUT well…. i do not expect it to run anymore

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/std/src/lib/parser/tinyxml/tinyxml.h

    r5819 r7203  
    2626#ifndef TINYXML_INCLUDED
    2727#define TINYXML_INCLUDED
     28
     29#define TIXML_USE_STL
    2830
    2931#ifdef _MSC_VER
     
    8183                #define TIXML_SNSCANF  snscanf
    8284        #endif
    83 #endif 
     85#endif
    8486
    8587class TiXmlDocument;
     
    9698const int TIXML_PATCH_VERSION = 2;
    9799
    98 /*      Internal structure for tracking location of items 
     100/*      Internal structure for tracking location of items
    99101        in the XML file.
    100102*/
     
    110112
    111113// Only used by Attribute::Query functions
    112 enum 
    113 { 
     114enum
     115{
    114116        TIXML_SUCCESS,
    115117        TIXML_NO_ATTRIBUTE,
     
    162164        /**     All TinyXml classes can print themselves to a filestream.
    163165                This is a formatted print, and will insert tabs and newlines.
    164                
     166
    165167                (For an unformatted stream, use the << operator.)
    166168        */
     
    206208        static const int utf8ByteTable[256];
    207209
    208         virtual const char* Parse(      const char* p, 
    209                                                                 TiXmlParsingData* data, 
     210        virtual const char* Parse(      const char* p,
     211                                                                TiXmlParsingData* data,
    210212                                                                TiXmlEncoding encoding /*= TIXML_ENCODING_UNKNOWN */ ) = 0;
    211213
     
    245247
    246248        static const char*      SkipWhiteSpace( const char*, TiXmlEncoding encoding );
    247         inline static bool      IsWhiteSpace( char c )         
    248         { 
    249                 return ( isspace( (unsigned char) c ) || c == '\n' || c == '\r' ); 
     249        inline static bool      IsWhiteSpace( char c )
     250        {
     251                return ( isspace( (unsigned char) c ) || c == '\n' || c == '\r' );
    250252        }
    251253
     
    334336    /// Field containing a generic user pointer
    335337        void*                   userData;
    336        
     338
    337339        // None of these methods are reliable for any language except English.
    338340        // Good for approximation, not great for accuracy.
     
    386388
    387389public:
    388         #ifdef TIXML_USE_STL   
     390        #ifdef TIXML_USE_STL
    389391
    390392            /** An input stream operator, for every class. Tolerant of newlines and
     
    400402                    a node to a stream is very well defined. You'll get a nice stream
    401403                    of output, without any extra whitespace or newlines.
    402                    
     404
    403405                    But reading is not as well defined. (As it always is.) If you create
    404406                    a TiXmlElement (for example) and read that from an input stream,
     
    408410                    A TiXmlDocument will read nodes until it reads a root element, and
    409411                        all the children of that root element.
    410             */ 
     412            */
    411413            friend std::ostream& operator<< (std::ostream& out, const TiXmlNode& base);
    412414
     
    470472    #ifdef TIXML_USE_STL
    471473        /// STL std::string form.
    472         void SetValue( const std::string& _value )   
    473         {         
     474        void SetValue( const std::string& _value )
     475        {
    474476                StringToBuffer buf( _value );
    475                 SetValue( buf.buffer ? buf.buffer : "" );       
    476         }       
     477                SetValue( buf.buffer ? buf.buffer : "" );
     478        }
    477479        #endif
    478480
     
    492494        TiXmlNode* LastChild()  { return lastChild; }
    493495        const TiXmlNode* LastChild( const char * value ) const;                 /// The last child of this node matching 'value'. Will be null if there are no children.
    494         TiXmlNode* LastChild( const char * value );     
     496        TiXmlNode* LastChild( const char * value );
    495497
    496498    #ifdef TIXML_USE_STL
     
    649651
    650652        /** Create an exact duplicate of this node and return it. The memory must be deleted
    651                 by the caller. 
     653                by the caller.
    652654        */
    653655        virtual TiXmlNode* Clone() const = 0;
     
    731733        /** QueryIntValue examines the value string. It is an alternative to the
    732734                IntValue() method with richer error checking.
    733                 If the value is an integer, it is stored in 'value' and 
     735                If the value is an integer, it is stored in 'value' and
    734736                the call returns TIXML_SUCCESS. If it is not
    735737                an integer, it returns TIXML_WRONG_TYPE.
     
    750752    #ifdef TIXML_USE_STL
    751753        /// STL std::string form.
    752         void SetName( const std::string& _name )       
    753         {       
     754        void SetName( const std::string& _name )
     755        {
    754756                StringToBuffer buf( _name );
    755                 SetName ( buf.buffer ? buf.buffer : "error" ); 
    756         }
    757         /// STL std::string form.       
    758         void SetValue( const std::string& _value )     
    759         {       
     757                SetName ( buf.buffer ? buf.buffer : "error" );
     758        }
     759        /// STL std::string form.
     760        void SetValue( const std::string& _value )
     761        {
    760762                StringToBuffer buf( _value );
    761                 SetValue( buf.buffer ? buf.buffer : "error" ); 
     763                SetValue( buf.buffer ? buf.buffer : "error" );
    762764        }
    763765        #endif
     
    801803/*      A class used to manage a group of attributes.
    802804        It is only used internally, both by the ELEMENT and the DECLARATION.
    803        
     805
    804806        The set can be changed transparent to the Element and Declaration
    805807        classes that use it, but NOT transparent to the Attribute
     
    882884        /** QueryIntAttribute examines the attribute - it is an alternative to the
    883885                Attribute() method with richer error checking.
    884                 If the attribute is an integer, it is stored in 'value' and 
     886                If the attribute is an integer, it is stored in 'value' and
    885887                the call returns TIXML_SUCCESS. If it is not
    886888                an integer, it returns TIXML_WRONG_TYPE. If the attribute
    887889                does not exist, then TIXML_NO_ATTRIBUTE is returned.
    888         */     
     890        */
    889891        int QueryIntAttribute( const char* name, int* _value ) const;
    890892        /// QueryDoubleAttribute examines the attribute - see QueryIntAttribute().
     
    913915
    914916        /// STL std::string form.
    915         void SetAttribute( const std::string& name, const std::string& _value ) 
    916         {       
     917        void SetAttribute( const std::string& name, const std::string& _value )
     918        {
    917919                StringToBuffer n( name );
    918920                StringToBuffer v( _value );
    919921                if ( n.buffer && v.buffer )
    920                         SetAttribute (n.buffer, v.buffer );     
    921         }       
     922                        SetAttribute (n.buffer, v.buffer );
     923        }
    922924        ///< STL std::string form.
    923         void SetAttribute( const std::string& name, int _value )       
    924         {       
     925        void SetAttribute( const std::string& name, int _value )
     926        {
    925927                StringToBuffer n( name );
    926928                if ( n.buffer )
    927                         SetAttribute (n.buffer, _value);       
    928         }       
     929                        SetAttribute (n.buffer, _value);
     930        }
    929931        #endif
    930932
     
    954956                and concise, GetText() is limited compared to getting the TiXmlText child
    955957                and accessing it directly.
    956        
     958
    957959                If the first child of 'this' is a TiXmlText, the GetText()
    958960                returns the character string of the Text node, else null is returned.
     
    964966                @endverbatim
    965967
    966                 'str' will be a pointer to "This is text". 
    967                
     968                'str' will be a pointer to "This is text".
     969
    968970                Note that this function can be misleading. If the element foo was created from
    969971                this XML:
    970972                @verbatim
    971                 <foo><b>This is text</b></foo> 
     973                <foo><b>This is text</b></foo>
    972974                @endverbatim
    973975
     
    975977                another element. From this XML:
    976978                @verbatim
    977                 <foo>This is <b>text</b></foo> 
     979                <foo>This is <b>text</b></foo>
    978980                @endverbatim
    979981                GetText() will return "This is ".
    980982
    981                 WARNING: GetText() accesses a child node - don't become confused with the 
    982                                  similarly named TiXmlHandle::Text() and TiXmlNode::ToText() which are 
     983                WARNING: GetText() accesses a child node - don't become confused with the
     984                                 similarly named TiXmlHandle::Text() and TiXmlNode::ToText() which are
    983985                                 safe type casts on the referenced node.
    984986        */
     
    10541056
    10551057
    1056 /** XML text. A text node can have 2 ways to output the next. "normal" output 
     1058/** XML text. A text node can have 2 ways to output the next. "normal" output
    10571059        and CDATA. It will default to the mode it was parsed from the XML file and
    1058         you generally want to leave it alone, but you can change the output mode with 
     1060        you generally want to leave it alone, but you can change the output mode with
    10591061        SetCDATA() and query it with CDATA().
    10601062*/
     
    10631065        friend class TiXmlElement;
    10641066public:
    1065         /** Constructor for text element. By default, it is treated as 
     1067        /** Constructor for text element. By default, it is treated as
    10661068                normal, encoded text. If you want it be output as a CDATA text
    10671069                element, set the parameter _cdata to 'true'
     
    12791281                - The ErrorDesc() method will return the name of the error. (very useful)
    12801282                - The ErrorRow() and ErrorCol() will return the location of the error (if known)
    1281         */     
     1283        */
    12821284        bool Error() const                                              { return error; }
    12831285
     
    12901292        int ErrorId()   const                           { return errorId; }
    12911293
    1292         /** Returns the location (if known) of the error. The first column is column 1, 
     1294        /** Returns the location (if known) of the error. The first column is column 1,
    12931295                and the first row is row 1. A value of 0 means the row and column wasn't applicable
    12941296                (memory errors, for example, have no row/column) or the parser lost the error. (An
     
    13031305                to report the correct values for row and column. It does not change the output
    13041306                or input in any way.
    1305                
     1307
    13061308                By calling this method, with a tab size
    13071309                greater than 0, the row and column of each node and attribute is stored
     
    13311333                state is automatically cleared if you Parse a new XML block.
    13321334        */
    1333         void ClearError()                                               {       error = false; 
    1334                                                                                                 errorId = 0; 
    1335                                                                                                 errorDesc = ""; 
    1336                                                                                                 errorLocation.row = errorLocation.col = 0; 
    1337                                                                                                 //errorLocation.last = 0; 
     1335        void ClearError()                                               {       error = false;
     1336                                                                                                errorId = 0;
     1337                                                                                                errorDesc = "";
     1338                                                                                                errorLocation.row = errorLocation.col = 0;
     1339                                                                                                //errorLocation.last = 0;
    13381340                                                                                        }
    13391341
     
    13811383        @endverbatim
    13821384
    1383         Assuming you want the value of "attributeB" in the 2nd "Child" element, it's very 
     1385        Assuming you want the value of "attributeB" in the 2nd "Child" element, it's very
    13841386        easy to write a *lot* of code that looks like:
    13851387
     
    14011403
    14021404        And that doesn't even cover "else" cases. TiXmlHandle addresses the verbosity
    1403         of such code. A TiXmlHandle checks for null     pointers so it is perfectly safe 
     1405        of such code. A TiXmlHandle checks for null     pointers so it is perfectly safe
    14041406        and correct to use:
    14051407
     
    14221424
    14231425        @verbatim
    1424         int i=0; 
     1426        int i=0;
    14251427        while ( true )
    14261428        {
     
    14331435        @endverbatim
    14341436
    1435         It seems reasonable, but it is in fact two embedded while loops. The Child method is 
    1436         a linear walk to find the element, so this code would iterate much more than it needs 
     1437        It seems reasonable, but it is in fact two embedded while loops. The Child method is
     1438        a linear walk to find the element, so this code would iterate much more than it needs
    14371439        to. Instead, prefer:
    14381440
     
    14641466        TiXmlHandle FirstChildElement( const char * value ) const;
    14651467
    1466         /** Return a handle to the "index" child with the given name. 
     1468        /** Return a handle to the "index" child with the given name.
    14671469                The first child is 0, the second 1, etc.
    14681470        */
    14691471        TiXmlHandle Child( const char* value, int index ) const;
    1470         /** Return a handle to the "index" child. 
     1472        /** Return a handle to the "index" child.
    14711473                The first child is 0, the second 1, etc.
    14721474        */
    14731475        TiXmlHandle Child( int index ) const;
    1474         /** Return a handle to the "index" child element with the given name. 
     1476        /** Return a handle to the "index" child element with the given name.
    14751477                The first child element is 0, the second 1, etc. Note that only TiXmlElements
    14761478                are indexed: other types are not counted.
    14771479        */
    14781480        TiXmlHandle ChildElement( const char* value, int index ) const;
    1479         /** Return a handle to the "index" child element. 
     1481        /** Return a handle to the "index" child element.
    14801482                The first child element is 0, the second 1, etc. Note that only TiXmlElements
    14811483                are indexed: other types are not counted.
     
    14921494
    14931495        /// Return the handle as a TiXmlNode. This may return null.
    1494         TiXmlNode* Node() const                 { return node; } 
     1496        TiXmlNode* Node() const                 { return node; }
    14951497        /// Return the handle as a TiXmlElement. This may return null.
    14961498        TiXmlElement* Element() const   { return ( ( node && node->ToElement() ) ? node->ToElement() : 0 ); }
Note: See TracChangeset for help on using the changeset viewer.