Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 740 for code


Ignore:
Timestamp:
Dec 31, 2007, 1:32:53 AM (17 years ago)
Author:
landauf
Message:

updated tinyxml to the version ticpp uses

Location:
code/branches/FICN/src/tinyxml
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/FICN/src/tinyxml/tinyxml.cc

    r738 r740  
    2222distribution.
    2323*/
     24#include "tinyxml.h"
    2425
    2526#include <ctype.h>
     
    2930#include <iostream>
    3031#endif
    31 
    32 #include "tinyxml.h"
    3332
    3433
     
    14671466}
    14681467
     1468TiXmlStylesheetReference::TiXmlStylesheetReference( const char * _type,
     1469                                                                                                        const char * _href )
     1470        : TiXmlNode( TiXmlNode::STYLESHEETREFERENCE )
     1471{
     1472        type = _type;
     1473        href = _href;
     1474}
     1475
     1476
     1477#ifdef TIXML_USE_STL
     1478TiXmlStylesheetReference::TiXmlStylesheetReference(     const std::string& _type,
     1479                                                                                                        const std::string& _href )
     1480        : TiXmlNode( TiXmlNode::STYLESHEETREFERENCE )
     1481{
     1482        type = _type;
     1483        href = _href;
     1484}
     1485#endif
     1486
     1487
     1488TiXmlStylesheetReference::TiXmlStylesheetReference( const TiXmlStylesheetReference& copy )
     1489        : TiXmlNode( TiXmlNode::STYLESHEETREFERENCE )
     1490{
     1491        copy.CopyTo( this );
     1492}
     1493
     1494
     1495void TiXmlStylesheetReference::operator=( const TiXmlStylesheetReference& copy )
     1496{
     1497        Clear();
     1498        copy.CopyTo( this );
     1499}
     1500
     1501
     1502void TiXmlStylesheetReference::Print( FILE* cfile, int /*depth*/, TIXML_STRING* str ) const
     1503{
     1504        if ( cfile ) fprintf( cfile, "<?xml-stylesheet " );
     1505        if ( str )       (*str) += "<?xml-stylesheet ";
     1506
     1507        if ( !type.empty() ) {
     1508                if ( cfile ) fprintf (cfile, "type=\"%s\" ", type.c_str ());
     1509                if ( str ) { (*str) += "type=\""; (*str) += type; (*str) += "\" "; }
     1510        }
     1511        if ( !href.empty() ) {
     1512                if ( cfile ) fprintf (cfile, "href=\"%s\" ", href.c_str ());
     1513                if ( str ) { (*str) += "href=\""; (*str) += href; (*str) += "\" "; }
     1514        }
     1515        if ( cfile ) fprintf (cfile, "?>");
     1516        if ( str )       (*str) += "?>";
     1517}
     1518
     1519void TiXmlStylesheetReference::CopyTo( TiXmlStylesheetReference* target ) const
     1520{
     1521        TiXmlNode::CopyTo( target );
     1522
     1523        target->type = type;
     1524        target->href = href;
     1525}
     1526
     1527bool TiXmlStylesheetReference::Accept( TiXmlVisitor* visitor ) const
     1528{
     1529        return visitor->Visit( *this );
     1530}
     1531
     1532TiXmlNode* TiXmlStylesheetReference::Clone() const
     1533{
     1534        TiXmlStylesheetReference* clone = new TiXmlStylesheetReference();
     1535
     1536        if ( !clone )
     1537                return 0;
     1538
     1539        CopyTo( clone );
     1540        return clone;
     1541}
    14691542
    14701543void TiXmlUnknown::Print( FILE* cfile, int depth ) const
  • code/branches/FICN/src/tinyxml/tinyxml.h

    r738 r740  
    4242#if defined( _DEBUG ) && !defined( DEBUG )
    4343#define DEBUG
     44#endif
     45
     46#ifdef TIXML_USE_TICPP
     47        #ifndef TIXML_USE_STL
     48                #define TIXML_USE_STL
     49        #endif
    4450#endif
    4551
     
    8187                #define TIXML_SSCANF   sscanf
    8288        #endif
    83 #endif 
     89#endif
    8490
    8591class TiXmlDocument;
     
    9096class TiXmlText;
    9197class TiXmlDeclaration;
     98class TiXmlStylesheetReference;
    9299class TiXmlParsingData;
    93100
     
    96103const int TIXML_PATCH_VERSION = 3;
    97104
    98 /*      Internal structure for tracking location of items 
     105/*      Internal structure for tracking location of items
    99106        in the XML file.
    100107*/
     
    118125        false, <b>no children of this node or its sibilings</b> will be Visited.
    119126
    120         All flavors of Visit methods have a default implementation that returns 'true' (continue 
     127        All flavors of Visit methods have a default implementation that returns 'true' (continue
    121128        visiting). You need to only override methods that are interesting to you.
    122129
     
    144151        /// Visit a declaration
    145152        virtual bool Visit( const TiXmlDeclaration& /*declaration*/ )   { return true; }
     153        /// Visit a stylesheet reference
     154        virtual bool Visit( const TiXmlStylesheetReference& /*stylesheet*/ )    { return true; }
    146155        /// Visit a text node
    147156        virtual bool Visit( const TiXmlText& /*text*/ )                                 { return true; }
     
    153162
    154163// Only used by Attribute::Query functions
    155 enum 
    156 { 
     164enum
     165{
    157166        TIXML_SUCCESS,
    158167        TIXML_NO_ATTRIBUTE,
     
    193202        @endverbatim
    194203*/
     204#ifdef TIXML_USE_TICPP
     205#include "ticpprc.h"
     206class TiXmlBase : public TiCppRC
     207#else
    195208class TiXmlBase
     209#endif
    196210{
    197211        friend class TiXmlNode;
     
    206220                or the string class (TiXmlString in non-STL mode, std::string
    207221                in STL mode.) Either or both cfile and str can be null.
    208                
    209                 This is a formatted print, and will insert 
     222
     223                This is a formatted print, and will insert
    210224                tabs and newlines.
    211                
     225
    212226                (For an unformatted stream, use the << operator.)
    213227        */
     
    254268        static const int utf8ByteTable[256];
    255269
    256         virtual const char* Parse(      const char* p, 
    257                                                                 TiXmlParsingData* data, 
     270        virtual const char* Parse(      const char* p,
     271                                                                TiXmlParsingData* data,
    258272                                                                TiXmlEncoding encoding /*= TIXML_ENCODING_UNKNOWN */ ) = 0;
    259273
    260         /** Expands entities in a string. Note this should not contian the tag's '<', '>', etc, 
     274        /** Expands entities in a string. Note this should not contian the tag's '<', '>', etc,
    261275                or they will be transformed into entities!
    262276        */
     
    289303
    290304        static const char* SkipWhiteSpace( const char*, TiXmlEncoding encoding );
    291         inline static bool IsWhiteSpace( char c )               
    292         { 
    293                 return ( isspace( (unsigned char) c ) || c == '\n' || c == '\r' ); 
     305        inline static bool IsWhiteSpace( char c )
     306        {
     307                return ( isspace( (unsigned char) c ) || c == '\n' || c == '\r' );
    294308        }
    295309        inline static bool IsWhiteSpace( int c )
     
    376390    /// Field containing a generic user pointer
    377391        void*                   userData;
    378        
     392
    379393        // None of these methods are reliable for any language except English.
    380394        // Good for approximation, not great for accuracy.
     
    428442
    429443public:
    430         #ifdef TIXML_USE_STL   
     444        #ifdef TIXML_USE_STL
    431445
    432446            /** An input stream operator, for every class. Tolerant of newlines and
     
    442456                    a node to a stream is very well defined. You'll get a nice stream
    443457                    of output, without any extra whitespace or newlines.
    444                    
     458
    445459                    But reading is not as well defined. (As it always is.) If you create
    446460                    a TiXmlElement (for example) and read that from an input stream,
     
    450464                    A TiXmlDocument will read nodes until it reads a root element, and
    451465                        all the children of that root element.
    452             */ 
     466            */
    453467            friend std::ostream& operator<< (std::ostream& out, const TiXmlNode& base);
    454468
     
    469483                TEXT,
    470484                DECLARATION,
     485                STYLESHEETREFERENCE,
    471486                TYPECOUNT
    472487        };
     
    532547        const TiXmlNode* LastChild() const      { return lastChild; }           /// The last child of this node. Will be null if there are no children.
    533548        TiXmlNode* LastChild()  { return lastChild; }
    534        
     549
    535550        const TiXmlNode* LastChild( const char * value ) const;                 /// The last child of this node matching 'value'. Will be null if there are no children.
    536551        TiXmlNode* LastChild( const char * _value ) {
     
    702717        virtual const TiXmlText*        ToText()        const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type.
    703718        virtual const TiXmlDeclaration* ToDeclaration() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type.
     719        virtual const TiXmlStylesheetReference* ToStylesheetReference() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type.
    704720
    705721        virtual TiXmlDocument*          ToDocument()    { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type.
     
    709725        virtual TiXmlText*                  ToText()        { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type.
    710726        virtual TiXmlDeclaration*       ToDeclaration() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type.
     727        virtual TiXmlStylesheetReference*       ToStylesheetReference() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type.
    711728
    712729        /** Create an exact duplicate of this node and return it. The memory must be deleted
    713                 by the caller. 
     730                by the caller.
    714731        */
    715732        virtual TiXmlNode* Clone() const = 0;
    716733
    717         /** Accept a hierchical visit the nodes in the TinyXML DOM. Every node in the 
     734        /** Accept a hierchical visit the nodes in the TinyXML DOM. Every node in the
    718735                XML tree will be conditionally visited and the host will be called back
    719736                via the TiXmlVisitor interface.
     
    726743
    727744                - http://www.saxproject.org/
    728                 - http://c2.com/cgi/wiki?HierarchicalVisitorPattern 
     745                - http://c2.com/cgi/wiki?HierarchicalVisitorPattern
    729746
    730747                Which are both good references for "visiting".
     
    823840        /** QueryIntValue examines the value string. It is an alternative to the
    824841                IntValue() method with richer error checking.
    825                 If the value is an integer, it is stored in 'value' and 
     842                If the value is an integer, it is stored in 'value' and
    826843                the call returns TIXML_SUCCESS. If it is not
    827844                an integer, it returns TIXML_WRONG_TYPE.
     
    842859    #ifdef TIXML_USE_STL
    843860        /// STL std::string form.
    844         void SetName( const std::string& _name )        { name = _name; }       
    845         /// STL std::string form.       
     861        void SetName( const std::string& _name )        { name = _name; }
     862        /// STL std::string form.
    846863        void SetValue( const std::string& _value )      { value = _value; }
    847864        #endif
     
    850867        const TiXmlAttribute* Next() const;
    851868        TiXmlAttribute* Next() {
    852                 return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Next() ); 
     869                return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Next() );
    853870        }
    854871
     
    856873        const TiXmlAttribute* Previous() const;
    857874        TiXmlAttribute* Previous() {
    858                 return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Previous() ); 
     875                return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Previous() );
    859876        }
    860877
     
    892909/*      A class used to manage a group of attributes.
    893910        It is only used internally, both by the ELEMENT and the DECLARATION.
    894        
     911
    895912        The set can be changed transparent to the Element and Declaration
    896913        classes that use it, but NOT transparent to the Attribute
     
    982999        /** QueryIntAttribute examines the attribute - it is an alternative to the
    9831000                Attribute() method with richer error checking.
    984                 If the attribute is an integer, it is stored in 'value' and 
     1001                If the attribute is an integer, it is stored in 'value' and
    9851002                the call returns TIXML_SUCCESS. If it is not
    9861003                an integer, it returns TIXML_WRONG_TYPE. If the attribute
    9871004                does not exist, then TIXML_NO_ATTRIBUTE is returned.
    988         */     
     1005        */
    9891006        int QueryIntAttribute( const char* name, int* _value ) const;
    9901007        /// QueryDoubleAttribute examines the attribute - see QueryIntAttribute().
     
    10041021                attribute into the specified type. Very easy, very powerful, but
    10051022                be careful to make sure to call this with the correct type.
    1006                
     1023
    10071024                NOTE: This method doesn't work correctly for 'string' types.
    10081025
     
    10241041         This is - in theory - a bug fix for "QueryValueAtribute returns truncated std::string"
    10251042         but template specialization is hard to get working cross-compiler. Leaving the bug for now.
    1026          
     1043
    10271044        // The above will fail for std::string because the space character is used as a seperator.
    10281045        // Specialize for strings. Bug [ 1695429 ] QueryValueAtribute returns truncated std::string
     
    10811098                and concise, GetText() is limited compared to getting the TiXmlText child
    10821099                and accessing it directly.
    1083        
     1100
    10841101                If the first child of 'this' is a TiXmlText, the GetText()
    10851102                returns the character string of the Text node, else null is returned.
     
    10911108                @endverbatim
    10921109
    1093                 'str' will be a pointer to "This is text". 
    1094                
     1110                'str' will be a pointer to "This is text".
     1111
    10951112                Note that this function can be misleading. If the element foo was created from
    10961113                this XML:
    10971114                @verbatim
    1098                 <foo><b>This is text</b></foo> 
     1115                <foo><b>This is text</b></foo>
    10991116                @endverbatim
    11001117
     
    11021119                another element. From this XML:
    11031120                @verbatim
    1104                 <foo>This is <b>text</b></foo> 
     1121                <foo>This is <b>text</b></foo>
    11051122                @endverbatim
    11061123                GetText() will return "This is ".
    11071124
    1108                 WARNING: GetText() accesses a child node - don't become confused with the 
    1109                                  similarly named TiXmlHandle::Text() and TiXmlNode::ToText() which are 
     1125                WARNING: GetText() accesses a child node - don't become confused with the
     1126                                 similarly named TiXmlHandle::Text() and TiXmlNode::ToText() which are
    11101127                                 safe type casts on the referenced node.
    11111128        */
     
    11251142        virtual TiXmlElement*           ToElement()               { return this; } ///< Cast to a more defined type. Will return null not of the requested type.
    11261143
    1127         /** Walk the XML tree visiting this node and all of its children. 
     1144        /** Walk the XML tree visiting this node and all of its children.
    11281145        */
    11291146        virtual bool Accept( TiXmlVisitor* visitor ) const;
     
    11791196        virtual TiXmlComment*  ToComment() { return this; } ///< Cast to a more defined type. Will return null not of the requested type.
    11801197
    1181         /** Walk the XML tree visiting this node and all of its children. 
     1198        /** Walk the XML tree visiting this node and all of its children.
    11821199        */
    11831200        virtual bool Accept( TiXmlVisitor* visitor ) const;
     
    11971214
    11981215
    1199 /** XML text. A text node can have 2 ways to output the next. "normal" output 
     1216/** XML text. A text node can have 2 ways to output the next. "normal" output
    12001217        and CDATA. It will default to the mode it was parsed from the XML file and
    1201         you generally want to leave it alone, but you can change the output mode with 
     1218        you generally want to leave it alone, but you can change the output mode with
    12021219        SetCDATA() and query it with CDATA().
    12031220*/
     
    12061223        friend class TiXmlElement;
    12071224public:
    1208         /** Constructor for text element. By default, it is treated as 
     1225        /** Constructor for text element. By default, it is treated as
    12091226                normal, encoded text. If you want it be output as a CDATA text
    12101227                element, set the parameter _cdata to 'true'
     
    12421259        virtual TiXmlText*       ToText()       { return this; } ///< Cast to a more defined type. Will return null not of the requested type.
    12431260
    1244         /** Walk the XML tree visiting this node and all of its children. 
     1261        /** Walk the XML tree visiting this node and all of its children.
    12451262        */
    12461263        virtual bool Accept( TiXmlVisitor* content ) const;
     
    13181335        virtual TiXmlDeclaration*       ToDeclaration()       { return this; } ///< Cast to a more defined type. Will return null not of the requested type.
    13191336
    1320         /** Walk the XML tree visiting this node and all of its children. 
     1337        /** Walk the XML tree visiting this node and all of its children.
    13211338        */
    13221339        virtual bool Accept( TiXmlVisitor* visitor ) const;
     
    13361353};
    13371354
     1355/** A stylesheet reference looks like this:
     1356        @verbatim
     1357                <?xml-stylesheet type="text/xsl" href="style.xsl"?>
     1358        @endverbatim
     1359
     1360        Note: In this version of the code, the attributes are
     1361        handled as special cases, not generic attributes, simply
     1362        because there can only be at most 2 and they are always the same.
     1363*/
     1364class TiXmlStylesheetReference : public TiXmlNode
     1365{
     1366public:
     1367        /// Construct an empty declaration.
     1368        TiXmlStylesheetReference()   : TiXmlNode( TiXmlNode::STYLESHEETREFERENCE ) {}
     1369
     1370#ifdef TIXML_USE_STL
     1371        /// Constructor.
     1372        TiXmlStylesheetReference(       const std::string& _type,
     1373                                                                const std::string& _href );
     1374#endif
     1375
     1376        /// Construct.
     1377        TiXmlStylesheetReference(       const char* _type,
     1378                                                                const char* _href );
     1379
     1380        TiXmlStylesheetReference( const TiXmlStylesheetReference& copy );
     1381        void operator=( const TiXmlStylesheetReference& copy );
     1382
     1383        virtual ~TiXmlStylesheetReference()     {}
     1384
     1385        /// Type. Will return an empty string if none was found.
     1386        const char *Type() const { return type.c_str (); }
     1387        /// Href. Will return an empty string if none was found.
     1388        const char *Href() const                { return href.c_str (); }
     1389
     1390        /// Creates a copy of this StylesheetReference and returns it.
     1391        virtual TiXmlNode* Clone() const;
     1392        // Print this declaration to a FILE stream.
     1393        virtual void Print( FILE* cfile, int depth, TIXML_STRING* str ) const;
     1394        virtual void Print( FILE* cfile, int depth ) const {
     1395                Print( cfile, depth, 0 );
     1396        }
     1397
     1398        virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
     1399
     1400        virtual const TiXmlStylesheetReference* ToStylesheetReference() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type.
     1401        virtual TiXmlStylesheetReference*       ToStylesheetReference()       { return this; } ///< Cast to a more defined type. Will return null not of the requested type.
     1402
     1403        /** Walk the XML tree visiting this node and all of its children.
     1404        */
     1405        virtual bool Accept( TiXmlVisitor* visitor ) const;
     1406
     1407protected:
     1408        void CopyTo( TiXmlStylesheetReference* target ) const;
     1409        // used to be public
     1410        #ifdef TIXML_USE_STL
     1411        virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
     1412        #endif
     1413
     1414private:
     1415
     1416        TIXML_STRING type;
     1417        TIXML_STRING href;
     1418};
    13381419
    13391420/** Any tag that tinyXml doesn't recognize is saved as an
     
    13631444        virtual TiXmlUnknown*           ToUnknown()         { return this; } ///< Cast to a more defined type. Will return null not of the requested type.
    13641445
    1365         /** Walk the XML tree visiting this node and all of its children. 
     1446        /** Walk the XML tree visiting this node and all of its children.
    13661447        */
    13671448        virtual bool Accept( TiXmlVisitor* content ) const;
     
    14531534                - The ErrorDesc() method will return the name of the error. (very useful)
    14541535                - The ErrorRow() and ErrorCol() will return the location of the error (if known)
    1455         */     
     1536        */
    14561537        bool Error() const                                              { return error; }
    14571538
     
    14641545        int ErrorId()   const                           { return errorId; }
    14651546
    1466         /** Returns the location (if known) of the error. The first column is column 1, 
     1547        /** Returns the location (if known) of the error. The first column is column 1,
    14671548                and the first row is row 1. A value of 0 means the row and column wasn't applicable
    14681549                (memory errors, for example, have no row/column) or the parser lost the error. (An
     
    14771558                to report the correct values for row and column. It does not change the output
    14781559                or input in any way.
    1479                
     1560
    14801561                By calling this method, with a tab size
    14811562                greater than 0, the row and column of each node and attribute is stored
     
    15051586                state is automatically cleared if you Parse a new XML block.
    15061587        */
    1507         void ClearError()                                               {       error = false; 
    1508                                                                                                 errorId = 0; 
    1509                                                                                                 errorDesc = ""; 
    1510                                                                                                 errorLocation.row = errorLocation.col = 0; 
    1511                                                                                                 //errorLocation.last = 0; 
     1588        void ClearError()                                               {       error = false;
     1589                                                                                                errorId = 0;
     1590                                                                                                errorDesc = "";
     1591                                                                                                errorLocation.row = errorLocation.col = 0;
     1592                                                                                                //errorLocation.last = 0;
    15121593                                                                                        }
    15131594
     
    15191600                calling code pust call delete[] on the return char* to avoid a memory leak.
    15201601        */
    1521         //char* PrintToMemory() const; 
     1602        //char* PrintToMemory() const;
    15221603
    15231604        /// Print this Document to a FILE stream.
     
    15291610        virtual TiXmlDocument*          ToDocument()          { return this; } ///< Cast to a more defined type. Will return null not of the requested type.
    15301611
    1531         /** Walk the XML tree visiting this node and all of its children. 
     1612        /** Walk the XML tree visiting this node and all of its children.
    15321613        */
    15331614        virtual bool Accept( TiXmlVisitor* content ) const;
     
    15671648        @endverbatim
    15681649
    1569         Assuming you want the value of "attributeB" in the 2nd "Child" element, it's very 
     1650        Assuming you want the value of "attributeB" in the 2nd "Child" element, it's very
    15701651        easy to write a *lot* of code that looks like:
    15711652
     
    15871668
    15881669        And that doesn't even cover "else" cases. TiXmlHandle addresses the verbosity
    1589         of such code. A TiXmlHandle checks for null     pointers so it is perfectly safe 
     1670        of such code. A TiXmlHandle checks for null     pointers so it is perfectly safe
    15901671        and correct to use:
    15911672
     
    16081689
    16091690        @verbatim
    1610         int i=0; 
     1691        int i=0;
    16111692        while ( true )
    16121693        {
     
    16191700        @endverbatim
    16201701
    1621         It seems reasonable, but it is in fact two embedded while loops. The Child method is 
    1622         a linear walk to find the element, so this code would iterate much more than it needs 
     1702        It seems reasonable, but it is in fact two embedded while loops. The Child method is
     1703        a linear walk to find the element, so this code would iterate much more than it needs
    16231704        to. Instead, prefer:
    16241705
     
    16501731        TiXmlHandle FirstChildElement( const char * value ) const;
    16511732
    1652         /** Return a handle to the "index" child with the given name. 
     1733        /** Return a handle to the "index" child with the given name.
    16531734                The first child is 0, the second 1, etc.
    16541735        */
    16551736        TiXmlHandle Child( const char* value, int index ) const;
    1656         /** Return a handle to the "index" child. 
     1737        /** Return a handle to the "index" child.
    16571738                The first child is 0, the second 1, etc.
    16581739        */
    16591740        TiXmlHandle Child( int index ) const;
    1660         /** Return a handle to the "index" child element with the given name. 
     1741        /** Return a handle to the "index" child element with the given name.
    16611742                The first child element is 0, the second 1, etc. Note that only TiXmlElements
    16621743                are indexed: other types are not counted.
    16631744        */
    16641745        TiXmlHandle ChildElement( const char* value, int index ) const;
    1665         /** Return a handle to the "index" child element. 
     1746        /** Return a handle to the "index" child element.
    16661747                The first child element is 0, the second 1, etc. Note that only TiXmlElements
    16671748                are indexed: other types are not counted.
     
    16791760        /** Return the handle as a TiXmlNode. This may return null.
    16801761        */
    1681         TiXmlNode* ToNode() const                       { return node; } 
     1762        TiXmlNode* ToNode() const                       { return node; }
    16821763        /** Return the handle as a TiXmlElement. This may return null.
    16831764        */
     
    16901771        TiXmlUnknown* ToUnknown() const         { return ( ( node && node->ToUnknown() ) ? node->ToUnknown() : 0 ); }
    16911772
    1692         /** @deprecated use ToNode. 
     1773        /** @deprecated use ToNode.
    16931774                Return the handle as a TiXmlNode. This may return null.
    16941775        */
    1695         TiXmlNode* Node() const                 { return ToNode(); } 
    1696         /** @deprecated use ToElement. 
     1776        TiXmlNode* Node() const                 { return ToNode(); }
     1777        /** @deprecated use ToElement.
    16971778                Return the handle as a TiXmlElement. This may return null.
    16981779        */
     
    17541835        /// Query the indention string.
    17551836        const char* Indent()                                                    { return indent.c_str(); }
    1756         /** Set the line breaking string. By default set to newline (\n). 
     1837        /** Set the line breaking string. By default set to newline (\n).
    17571838                Some operating systems prefer other characters, or can be
    17581839                set to the null/empty string for no indenation.
     
    17621843        const char* LineBreak()                                                 { return lineBreak.c_str(); }
    17631844
    1764         /** Switch over to "stream printing" which is the most dense formatting without 
     1845        /** Switch over to "stream printing" which is the most dense formatting without
    17651846                linebreaks. Common when the XML is needed for network transmission.
    17661847        */
    17671848        void SetStreamPrinting()                                                { indent = "";
    17681849                                                                                                          lineBreak = "";
    1769                                                                                                         }       
     1850                                                                                                        }
    17701851        /// Return the result.
    17711852        const char* CStr()                                                              { return buffer.c_str(); }
  • code/branches/FICN/src/tinyxml/tinyxmlerror.cc

    r738 r740  
    33Original code (2.0 and earlier )copyright (c) 2000-2006 Lee Thomason (www.grinninglizard.com)
    44
    5 This software is provided 'as-is', without any express or implied
    6 warranty. In no event will the authors be held liable for any
     5This software is provided 'as-is', without any express or implied 
     6warranty. In no event will the authors be held liable for any 
    77damages arising from the use of this software.
    88
    9 Permission is granted to anyone to use this software for any
    10 purpose, including commercial applications, and to alter it and
     9Permission is granted to anyone to use this software for any 
     10purpose, including commercial applications, and to alter it and 
    1111redistribute it freely, subject to the following restrictions:
    1212
  • code/branches/FICN/src/tinyxml/tinyxmlparser.cc

    r738 r740  
    838838        // - Comments: <!--
    839839        // - Decleration: <?xml
     840        // - StylesheetReference <?xml-stylesheet
    840841        // - Everthing else is unknown to tinyxml.
    841842        //
    842843
    843844        const char* xmlHeader = { "<?xml" };
     845        const char* xmlSSHeader = { "<?xml-stylesheet" };
    844846        const char* commentHeader = { "<!--" };
    845847        const char* dtdHeader = { "<!" };
    846848        const char* cdataHeader = { "<![CDATA[" };
    847849
    848         if ( StringEqual( p, xmlHeader, true, encoding ) )
     850        if ( StringEqual( p, xmlSSHeader, true, encoding ) )
     851        {
     852                #ifdef DEBUG_PARSER
     853                        TIXML_LOG( "XML parsing Stylesheet Reference\n" );
     854                #endif
     855                returnNode = new TiXmlStylesheetReference();
     856        }
     857        else if ( StringEqual( p, xmlHeader, true, encoding ) )
    849858        {
    850859                #ifdef DEBUG_PARSER
     
    16371646}
    16381647
     1648#ifdef TIXML_USE_STL
     1649void TiXmlStylesheetReference::StreamIn( std::istream * in, TIXML_STRING * tag )
     1650{
     1651        while ( in->good() )
     1652        {
     1653                int c = in->get();
     1654                if ( c <= 0 )
     1655                {
     1656                        TiXmlDocument* document = GetDocument();
     1657                        if ( document )
     1658                                document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN );
     1659                        return;
     1660                }
     1661                (*tag) += (char) c;
     1662
     1663                if ( c == '>' )
     1664                {
     1665                        // All is well.
     1666                        return;
     1667                }
     1668        }
     1669}
     1670#endif
     1671
     1672const char* TiXmlStylesheetReference::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding _encoding )
     1673{
     1674        p = SkipWhiteSpace( p, _encoding );
     1675        // Find the beginning, find the end, and look for
     1676        // the stuff in-between.
     1677        TiXmlDocument* document = GetDocument();
     1678        if ( !p || !*p || !StringEqual( p, "<?xml-stylesheet", true, _encoding ) )
     1679        {
     1680                if ( document ) document->SetError( TIXML_ERROR_PARSING_DECLARATION, 0, 0, _encoding );
     1681                return 0;
     1682        }
     1683        if ( data )
     1684        {
     1685                data->Stamp( p, _encoding );
     1686                location = data->Cursor();
     1687        }
     1688        p += 5;
     1689
     1690        type = "";
     1691        href = "";
     1692
     1693        while ( p && *p )
     1694        {
     1695                if ( *p == '>' )
     1696                {
     1697                        ++p;
     1698                        return p;
     1699                }
     1700
     1701                p = SkipWhiteSpace( p, _encoding );
     1702                if ( StringEqual( p, "type", true, _encoding ) )
     1703                {
     1704                        TiXmlAttribute attrib;
     1705                        p = attrib.Parse( p, data, _encoding );
     1706                        type = attrib.Value();
     1707                }
     1708                else if ( StringEqual( p, "href", true, _encoding ) )
     1709                {
     1710                        TiXmlAttribute attrib;
     1711                        p = attrib.Parse( p, data, _encoding );
     1712                        href = attrib.Value();
     1713                }
     1714                else
     1715                {
     1716                        // Read over whatever it is.
     1717                        while( p && *p && *p != '>' && !IsWhiteSpace( *p ) )
     1718                                ++p;
     1719                }
     1720        }
     1721        return 0;
     1722}
Note: See TracChangeset for help on using the changeset viewer.