Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/xercesc/framework/XMLPScanToken.hpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002  * Licensed to the Apache Software Foundation (ASF) under one or more
0003  * contributor license agreements.  See the NOTICE file distributed with
0004  * this work for additional information regarding copyright ownership.
0005  * The ASF licenses this file to You under the Apache License, Version 2.0
0006  * (the "License"); you may not use this file except in compliance with
0007  * the License.  You may obtain a copy of the License at
0008  * 
0009  *      http://www.apache.org/licenses/LICENSE-2.0
0010  * 
0011  * Unless required by applicable law or agreed to in writing, software
0012  * distributed under the License is distributed on an "AS IS" BASIS,
0013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0014  * See the License for the specific language governing permissions and
0015  * limitations under the License.
0016  */
0017 
0018 /*
0019  * $Id$
0020  */
0021 
0022 #if !defined(XERCESC_INCLUDE_GUARD_XMLPSCANTOKEN_HPP)
0023 #define XERCESC_INCLUDE_GUARD_XMLPSCANTOKEN_HPP
0024 
0025 #include <xercesc/util/XMemory.hpp>
0026 
0027 XERCES_CPP_NAMESPACE_BEGIN
0028 
0029 class XMLScanner;
0030 
0031 /**
0032  *  This simple class is used as a sanity check when the scanner is used to
0033  *  do progressive parsing. It insures that things are not done out of
0034  *  sequence and that sequences of scan calls are made correctly to the
0035  *  right scanner instances.
0036  *
0037  *  To client code, it is just a magic cookie which is obtained when a
0038  *  progressive parse is begun, and which is passed back in on each subsequent
0039  *  call of the progressive parse.
0040  */
0041 class XMLPARSER_EXPORT XMLPScanToken : public XMemory
0042 {
0043 public :
0044     // -----------------------------------------------------------------------
0045     //  Constructors and Destructor
0046     // -----------------------------------------------------------------------
0047     /** @name Constructor */
0048     //@{
0049     XMLPScanToken();
0050     XMLPScanToken(const XMLPScanToken& toCopy);
0051     //@}
0052 
0053     /** @name Destructor */
0054     //@{
0055     ~XMLPScanToken();
0056     //@}
0057 
0058 
0059     // -----------------------------------------------------------------------
0060     //  Public operators
0061     // -----------------------------------------------------------------------
0062     XMLPScanToken& operator=(const XMLPScanToken& toCopy);
0063 
0064 
0065 protected :
0066     // -----------------------------------------------------------------------
0067     //  XMLScanner is our friend, can you say friend? Sure...
0068     // -----------------------------------------------------------------------
0069     friend class XMLScanner;
0070 
0071 
0072     // -----------------------------------------------------------------------
0073     //  Hidden methods for use by XMLScanner
0074     // -----------------------------------------------------------------------
0075     void set
0076     (
0077         const   XMLUInt32   scannerId
0078         , const XMLUInt32   sequenceId
0079     );
0080 
0081 
0082 private :
0083     // -----------------------------------------------------------------------
0084     //  Private data members
0085     //
0086     //  fScannerId
0087     //      This field is set to the id of the scanner, to catch problems
0088     //      where a token is gotten from one scanner and passed to another.
0089     //      Each scanner is assigned an incrementing id.
0090     //
0091     //  fSequenceId
0092     //      In order to avoid problems such as calling scanNext() without
0093     //      a call to scanFirst() and such, this value is set when scanFirst()
0094     //      is called and matches this token to the current sequence id of
0095     //      the scanner.
0096     // -----------------------------------------------------------------------
0097     XMLUInt32   fScannerId;
0098     XMLUInt32   fSequenceId;
0099 };
0100 
0101 
0102 // ---------------------------------------------------------------------------
0103 //  XMLPScanToken: Constructors and Operators
0104 // ---------------------------------------------------------------------------
0105 inline XMLPScanToken::XMLPScanToken() :
0106 
0107     fScannerId(0)
0108     , fSequenceId(0)
0109 {
0110 }
0111 
0112 inline XMLPScanToken::XMLPScanToken(const XMLPScanToken& toCopy) :
0113     XMemory(toCopy)
0114     , fScannerId(toCopy.fScannerId)
0115     , fSequenceId(toCopy.fSequenceId)
0116 {
0117 }
0118 
0119 inline XMLPScanToken::~XMLPScanToken()
0120 {
0121 }
0122 
0123 
0124 // ---------------------------------------------------------------------------
0125 //  XMLPScanToken: Public operators
0126 // ---------------------------------------------------------------------------
0127 inline XMLPScanToken& XMLPScanToken::operator=(const XMLPScanToken& toCopy)
0128 {
0129     if (this == &toCopy)
0130         return *this;
0131 
0132     fScannerId = toCopy.fScannerId;
0133     fSequenceId = toCopy.fSequenceId;
0134 
0135     return *this;
0136 }
0137 
0138 
0139 // ---------------------------------------------------------------------------
0140 //  XMLPScanToken: Hidden methods
0141 // ---------------------------------------------------------------------------
0142 inline void XMLPScanToken::set( const   XMLUInt32   scannerId
0143                                 , const XMLUInt32   sequenceId)
0144 {
0145     fScannerId = scannerId;
0146     fSequenceId = sequenceId;
0147 }
0148 
0149 XERCES_CPP_NAMESPACE_END
0150 
0151 #endif