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: Locator.hpp,v $
|
---|
19 | * Revision 1.5 2004/09/08 13:56:19 peiyongz
|
---|
20 | * Apache License Version 2.0
|
---|
21 | *
|
---|
22 | * Revision 1.4 2003/03/07 18:10:06 tng
|
---|
23 | * Return a reference instead of void for operator=
|
---|
24 | *
|
---|
25 | * Revision 1.3 2002/11/04 14:56:26 tng
|
---|
26 | * C++ Namespace Support.
|
---|
27 | *
|
---|
28 | * Revision 1.2 2002/05/27 18:33:07 tng
|
---|
29 | * To get ready for 64 bit large file, use XMLSSize_t to represent line and column number.
|
---|
30 | *
|
---|
31 | * Revision 1.1.1.1 2002/02/01 22:22:08 peiyongz
|
---|
32 | * sane_include
|
---|
33 | *
|
---|
34 | * Revision 1.6 2000/03/02 19:54:35 roddey
|
---|
35 | * This checkin includes many changes done while waiting for the
|
---|
36 | * 1.1.0 code to be finished. I can't list them all here, but a list is
|
---|
37 | * available elsewhere.
|
---|
38 | *
|
---|
39 | * Revision 1.5 2000/02/24 20:12:55 abagchi
|
---|
40 | * Swat for removing Log from API docs
|
---|
41 | *
|
---|
42 | * Revision 1.4 2000/02/12 03:31:55 rahulj
|
---|
43 | * Removed duplicate CVS Log entries.
|
---|
44 | *
|
---|
45 | * Revision 1.3 2000/02/09 01:55:06 abagchi
|
---|
46 | * Removed private function docs
|
---|
47 | *
|
---|
48 | * Revision 1.2 2000/02/06 07:47:58 rahulj
|
---|
49 | * Year 2K copyright swat.
|
---|
50 | *
|
---|
51 | * Revision 1.1.1.1 1999/11/09 01:07:46 twl
|
---|
52 | * Initial checkin
|
---|
53 | *
|
---|
54 | * Revision 1.3 1999/11/08 20:45:01 rahul
|
---|
55 | * Swat for adding in Product name and CVS comment log variable.
|
---|
56 | *
|
---|
57 | */
|
---|
58 |
|
---|
59 |
|
---|
60 | #ifndef LOCATOR_HPP
|
---|
61 | #define LOCATOR_HPP
|
---|
62 |
|
---|
63 | #include <xercesc/util/XercesDefs.hpp>
|
---|
64 |
|
---|
65 | XERCES_CPP_NAMESPACE_BEGIN
|
---|
66 |
|
---|
67 | /**
|
---|
68 | * Interface for associating a SAX event with a document location.
|
---|
69 | *
|
---|
70 | * <p>If a SAX parser provides location information to the SAX
|
---|
71 | * application, it does so by implementing this interface and then
|
---|
72 | * passing an instance to the application using the document
|
---|
73 | * handler's setDocumentLocator method. The application can use the
|
---|
74 | * object to obtain the location of any other document handler event
|
---|
75 | * in the XML source document.</p>
|
---|
76 | *
|
---|
77 | * <p>Note that the results returned by the object will be valid only
|
---|
78 | * during the scope of each document handler method: the application
|
---|
79 | * will receive unpredictable results if it attempts to use the
|
---|
80 | * locator at any other time.</p>
|
---|
81 | *
|
---|
82 | * <p>SAX parsers are not required to supply a locator, but they are
|
---|
83 | * very strong encouraged to do so. If the parser supplies a
|
---|
84 | * locator, it must do so before reporting any other document events.
|
---|
85 | * If no locator has been set by the time the application receives
|
---|
86 | * the startDocument event, the application should assume that a
|
---|
87 | * locator is not available.</p>
|
---|
88 | *
|
---|
89 | * @see DocumentHandler#setDocumentLocator
|
---|
90 | */
|
---|
91 |
|
---|
92 | class SAX_EXPORT Locator
|
---|
93 | {
|
---|
94 | public:
|
---|
95 |
|
---|
96 | /** @name Constructors and Destructor */
|
---|
97 | //@{
|
---|
98 | /** Default constructor */
|
---|
99 | Locator()
|
---|
100 | {
|
---|
101 | }
|
---|
102 |
|
---|
103 | /** Destructor */
|
---|
104 | virtual ~Locator()
|
---|
105 | {
|
---|
106 | }
|
---|
107 |
|
---|
108 | //@}
|
---|
109 |
|
---|
110 | /** @name The locator interface */
|
---|
111 | //@{
|
---|
112 | /**
|
---|
113 | * Return the public identifier for the current document event.
|
---|
114 | * <p>This will be the public identifier
|
---|
115 | * @return A string containing the public identifier, or
|
---|
116 | * null if none is available.
|
---|
117 | * @see #getSystemId
|
---|
118 | */
|
---|
119 | virtual const XMLCh* getPublicId() const = 0;
|
---|
120 |
|
---|
121 | /**
|
---|
122 | * Return the system identifier for the current document event.
|
---|
123 | *
|
---|
124 | * <p>If the system identifier is a URL, the parser must resolve it
|
---|
125 | * fully before passing it to the application.</p>
|
---|
126 | *
|
---|
127 | * @return A string containing the system identifier, or null
|
---|
128 | * if none is available.
|
---|
129 | * @see #getPublicId
|
---|
130 | */
|
---|
131 | virtual const XMLCh* getSystemId() const = 0;
|
---|
132 |
|
---|
133 | /**
|
---|
134 | * Return the line number where the current document event ends.
|
---|
135 | * Note that this is the line position of the first character
|
---|
136 | * after the text associated with the document event.
|
---|
137 | * @return The line number, or -1 if none is available.
|
---|
138 | * @see #getColumnNumber
|
---|
139 | */
|
---|
140 | virtual XMLSSize_t getLineNumber() const = 0;
|
---|
141 |
|
---|
142 | /**
|
---|
143 | * Return the column number where the current document event ends.
|
---|
144 | * Note that this is the column number of the first
|
---|
145 | * character after the text associated with the document
|
---|
146 | * event. The first column in a line is position 1.
|
---|
147 | * @return The column number, or -1 if none is available.
|
---|
148 | * @see #getLineNumber
|
---|
149 | */
|
---|
150 | virtual XMLSSize_t getColumnNumber() const = 0;
|
---|
151 | //@}
|
---|
152 |
|
---|
153 | private :
|
---|
154 | /* Copy constructor */
|
---|
155 | Locator(const Locator&);
|
---|
156 |
|
---|
157 | /* Assignment operator */
|
---|
158 | Locator& operator=(const Locator&);
|
---|
159 | };
|
---|
160 |
|
---|
161 | XERCES_CPP_NAMESPACE_END
|
---|
162 |
|
---|
163 | #endif
|
---|