source: icXML/icXML-devel/src/xercesc/framework/XMLPScanToken.hpp @ 2732

Last change on this file since 2732 was 2722, checked in by cameron, 7 years ago

Original Xerces files with import mods for icxercesc

File size: 4.8 KB
Line 
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements.  See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License.  You may obtain a copy of the License at
8 *
9 *      http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18/*
19 * $Id: XMLPScanToken.hpp 527149 2007-04-10 14:56:39Z amassari $
20 */
21
22#if !defined(XERCESC_INCLUDE_GUARD_XMLPSCANTOKEN_HPP)
23#define XERCESC_INCLUDE_GUARD_XMLPSCANTOKEN_HPP
24
25#include <xercesc/util/XMemory.hpp>
26
27XERCES_CPP_NAMESPACE_BEGIN
28
29class XMLScanner;
30
31/**
32 *  This simple class is used as a sanity check when the scanner is used to
33 *  do progressive parsing. It insures that things are not done out of
34 *  sequence and that sequences of scan calls are made correctly to the
35 *  right scanner instances.
36 *
37 *  To client code, it is just a magic cookie which is obtained when a
38 *  progressive parse is begun, and which is passed back in on each subsequent
39 *  call of the progressive parse.
40 */
41class XMLPARSER_EXPORT XMLPScanToken : public XMemory
42{
43public :
44    // -----------------------------------------------------------------------
45    //  Constructors and Destructor
46    // -----------------------------------------------------------------------
47    /** @name Constructor */
48    //@{
49    XMLPScanToken();
50    XMLPScanToken(const XMLPScanToken& toCopy);
51    //@}
52
53    /** @name Destructor */
54    //@{
55    ~XMLPScanToken();
56    //@}
57
58
59    // -----------------------------------------------------------------------
60    //  Public operators
61    // -----------------------------------------------------------------------
62    XMLPScanToken& operator=(const XMLPScanToken& toCopy);
63
64
65protected :
66    // -----------------------------------------------------------------------
67    //  XMLScanner is our friend, can you say friend? Sure...
68    // -----------------------------------------------------------------------
69    friend class XMLScanner;
70
71
72    // -----------------------------------------------------------------------
73    //  Hidden methods for use by XMLScanner
74    // -----------------------------------------------------------------------
75    void set
76    (
77        const   XMLUInt32   scannerId
78        , const XMLUInt32   sequenceId
79    );
80
81
82private :
83    // -----------------------------------------------------------------------
84    //  Private data members
85    //
86    //  fScannerId
87    //      This field is set to the id of the scanner, to catch problems
88    //      where a token is gotten from one scanner and passed to another.
89    //      Each scanner is assigned an incrementing id.
90    //
91    //  fSequenceId
92    //      In order to avoid problems such as calling scanNext() without
93    //      a call to scanFirst() and such, this value is set when scanFirst()
94    //      is called and matches this token to the current sequence id of
95    //      the scanner.
96    // -----------------------------------------------------------------------
97    XMLUInt32   fScannerId;
98    XMLUInt32   fSequenceId;
99};
100
101
102// ---------------------------------------------------------------------------
103//  XMLPScanToken: Constructors and Operators
104// ---------------------------------------------------------------------------
105inline XMLPScanToken::XMLPScanToken() :
106
107    fScannerId(0)
108    , fSequenceId(0)
109{
110}
111
112inline XMLPScanToken::XMLPScanToken(const XMLPScanToken& toCopy) :
113    XMemory(toCopy)
114    , fScannerId(toCopy.fScannerId)
115    , fSequenceId(toCopy.fSequenceId)
116{
117}
118
119inline XMLPScanToken::~XMLPScanToken()
120{
121}
122
123
124// ---------------------------------------------------------------------------
125//  XMLPScanToken: Public operators
126// ---------------------------------------------------------------------------
127inline XMLPScanToken& XMLPScanToken::operator=(const XMLPScanToken& toCopy)
128{
129    if (this == &toCopy)
130        return *this;
131
132    fScannerId = toCopy.fScannerId;
133    fSequenceId = toCopy.fSequenceId;
134
135    return *this;
136}
137
138
139// ---------------------------------------------------------------------------
140//  XMLPScanToken: Hidden methods
141// ---------------------------------------------------------------------------
142inline void XMLPScanToken::set( const   XMLUInt32   scannerId
143                                , const XMLUInt32   sequenceId)
144{
145    fScannerId = scannerId;
146    fSequenceId = sequenceId;
147}
148
149XERCES_CPP_NAMESPACE_END
150
151#endif
Note: See TracBrowser for help on using the repository browser.