source: NonGTP/Xerces/xerces/include/xercesc/framework/XMLPScanToken.hpp @ 358

Revision 358, 5.4 KB checked in by bittner, 19 years ago (diff)

xerces added

Line 
1/*
2 * Copyright 1999-2000,2004 The Apache Software Foundation.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17/*
18 * $Log: XMLPScanToken.hpp,v $
19 * Revision 1.4  2004/09/08 13:55:59  peiyongz
20 * Apache License Version 2.0
21 *
22 * Revision 1.3  2003/05/15 18:26:07  knoaman
23 * Partial implementation of the configurable memory manager.
24 *
25 * Revision 1.2  2002/11/04 15:00:21  tng
26 * C++ Namespace Support.
27 *
28 * Revision 1.1.1.1  2002/02/01 22:21:52  peiyongz
29 * sane_include
30 *
31 * Revision 1.4  2000/02/24 20:00:23  abagchi
32 * Swat for removing Log from API docs
33 *
34 * Revision 1.3  2000/02/15 01:21:31  roddey
35 * Some initial documentation improvements. More to come...
36 *
37 * Revision 1.2  2000/02/06 07:47:48  rahulj
38 * Year 2K copyright swat.
39 *
40 * Revision 1.1.1.1  1999/11/09 01:08:36  twl
41 * Initial checkin
42 *
43 * Revision 1.2  1999/11/08 20:44:39  rahul
44 * Swat for adding in Product name and CVS comment log variable.
45 *
46 */
47
48
49#if !defined(XMLPSCANTOKEN_HPP)
50#define XMLPSCANTOKEN_HPP
51
52#include <xercesc/util/XMemory.hpp>
53
54XERCES_CPP_NAMESPACE_BEGIN
55
56class XMLScanner;
57
58/**
59 *  This simple class is used as a sanity check when the scanner is used to
60 *  do progressive parsing. It insures that things are not done out of
61 *  sequence and that sequences of scan calls are made correctly to the
62 *  right scanner instances.
63 *
64 *  To client code, it is just a magic cookie which is obtained when a
65 *  progressive parse is begun, and which is passed back in on each subsequent
66 *  call of the progressive parse.
67 */
68class XMLPARSER_EXPORT XMLPScanToken : public XMemory
69{
70public :
71    // -----------------------------------------------------------------------
72    //  Constructors and Destructor
73    // -----------------------------------------------------------------------
74    /** @name Constructor */
75    //@{
76    XMLPScanToken();
77    XMLPScanToken(const XMLPScanToken& toCopy);
78    //@}
79
80    /** @name Destructor */
81    //@{
82    ~XMLPScanToken();
83    //@}
84
85
86    // -----------------------------------------------------------------------
87    //  Public operators
88    // -----------------------------------------------------------------------
89    XMLPScanToken& operator=(const XMLPScanToken& toCopy);
90
91
92protected :
93    // -----------------------------------------------------------------------
94    //  XMLScanner is our friend, can you say friend? Sure...
95    // -----------------------------------------------------------------------
96    friend class XMLScanner;
97
98
99    // -----------------------------------------------------------------------
100    //  Hidden methods for use by XMLScanner
101    // -----------------------------------------------------------------------
102    void set
103    (
104        const   XMLUInt32   scannerId
105        , const XMLUInt32   sequenceId
106    );
107
108
109private :
110    // -----------------------------------------------------------------------
111    //  Private data members
112    //
113    //  fScannerId
114    //      This field is set to the id of the scanner, to catch problems
115    //      where a token is gotten from one scanner and passed to another.
116    //      Each scanner is assigned an incrementing id.
117    //
118    //  fSequenceId
119    //      In order to avoid problems such as calling scanNext() without
120    //      a call to scanFirst() and such, this value is set when scanFirst()
121    //      is called and matches this token to the current sequence id of
122    //      the scanner.
123    // -----------------------------------------------------------------------
124    XMLUInt32   fScannerId;
125    XMLUInt32   fSequenceId;
126};
127
128
129// ---------------------------------------------------------------------------
130//  XMLPScanToken: Constructors and Operators
131// ---------------------------------------------------------------------------
132inline XMLPScanToken::XMLPScanToken() :
133
134    fScannerId(0)
135    , fSequenceId(0)
136{
137}
138
139inline XMLPScanToken::XMLPScanToken(const XMLPScanToken& toCopy) :
140
141    fScannerId(toCopy.fScannerId)
142    , fSequenceId(toCopy.fSequenceId)
143{
144}
145
146inline XMLPScanToken::~XMLPScanToken()
147{
148}
149
150
151// ---------------------------------------------------------------------------
152//  XMLPScanToken: Public operators
153// ---------------------------------------------------------------------------
154inline XMLPScanToken& XMLPScanToken::operator=(const XMLPScanToken& toCopy)
155{
156    if (this == &toCopy)
157        return *this;
158
159    fScannerId = toCopy.fScannerId;
160    fSequenceId = toCopy.fSequenceId;
161
162    return *this;
163}
164
165
166// ---------------------------------------------------------------------------
167//  XMLPScanToken: Hidden methods
168// ---------------------------------------------------------------------------
169inline void XMLPScanToken::set( const   XMLUInt32   scannerId
170                                , const XMLUInt32   sequenceId)
171{
172    fScannerId = scannerId;
173    fSequenceId = sequenceId;
174}
175
176XERCES_CPP_NAMESPACE_END
177
178#endif
Note: See TracBrowser for help on using the repository browser.