1 | /*
|
---|
2 | * The Apache Software License, Version 1.1
|
---|
3 | *
|
---|
4 | * Copyright (c) 1999-2000 The Apache Software Foundation. All rights
|
---|
5 | * reserved.
|
---|
6 | *
|
---|
7 | * Redistribution and use in source and binary forms, with or without
|
---|
8 | * modification, are permitted provided that the following conditions
|
---|
9 | * are met:
|
---|
10 | *
|
---|
11 | * 1. Redistributions of source code must retain the above copyright
|
---|
12 | * notice, this list of conditions and the following disclaimer.
|
---|
13 | *
|
---|
14 | * 2. Redistributions in binary form must reproduce the above copyright
|
---|
15 | * notice, this list of conditions and the following disclaimer in
|
---|
16 | * the documentation and/or other materials provided with the
|
---|
17 | * distribution.
|
---|
18 | *
|
---|
19 | * 3. The end-user documentation included with the redistribution,
|
---|
20 | * if any, must include the following acknowledgment:
|
---|
21 | * "This product includes software developed by the
|
---|
22 | * Apache Software Foundation (http://www.apache.org/)."
|
---|
23 | * Alternately, this acknowledgment may appear in the software itself,
|
---|
24 | * if and wherever such third-party acknowledgments normally appear.
|
---|
25 | *
|
---|
26 | * 4. The names "Xerces" and "Apache Software Foundation" must
|
---|
27 | * not be used to endorse or promote products derived from this
|
---|
28 | * software without prior written permission. For written
|
---|
29 | * permission, please contact apache\@apache.org.
|
---|
30 | *
|
---|
31 | * 5. Products derived from this software may not be called "Apache",
|
---|
32 | * nor may "Apache" appear in their name, without prior written
|
---|
33 | * permission of the Apache Software Foundation.
|
---|
34 | *
|
---|
35 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
---|
36 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
37 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
---|
38 | * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
---|
39 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
---|
40 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
---|
41 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
---|
42 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
---|
43 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
---|
44 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
---|
45 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
---|
46 | * SUCH DAMAGE.
|
---|
47 | * ====================================================================
|
---|
48 | *
|
---|
49 | * This software consists of voluntary contributions made by many
|
---|
50 | * individuals on behalf of the Apache Software Foundation, and was
|
---|
51 | * originally based on software copyright (c) 1999, International
|
---|
52 | * Business Machines, Inc., http://www.ibm.com . For more information
|
---|
53 | * on the Apache Software Foundation, please see
|
---|
54 | * <http://www.apache.org/>.
|
---|
55 | */
|
---|
56 |
|
---|
57 | /*
|
---|
58 | * $Log: Locator.hpp,v $
|
---|
59 | * Revision 1.4 2003/03/07 18:10:06 tng
|
---|
60 | * Return a reference instead of void for operator=
|
---|
61 | *
|
---|
62 | * Revision 1.3 2002/11/04 14:56:26 tng
|
---|
63 | * C++ Namespace Support.
|
---|
64 | *
|
---|
65 | * Revision 1.2 2002/05/27 18:33:07 tng
|
---|
66 | * To get ready for 64 bit large file, use XMLSSize_t to represent line and column number.
|
---|
67 | *
|
---|
68 | * Revision 1.1.1.1 2002/02/01 22:22:08 peiyongz
|
---|
69 | * sane_include
|
---|
70 | *
|
---|
71 | * Revision 1.6 2000/03/02 19:54:35 roddey
|
---|
72 | * This checkin includes many changes done while waiting for the
|
---|
73 | * 1.1.0 code to be finished. I can't list them all here, but a list is
|
---|
74 | * available elsewhere.
|
---|
75 | *
|
---|
76 | * Revision 1.5 2000/02/24 20:12:55 abagchi
|
---|
77 | * Swat for removing Log from API docs
|
---|
78 | *
|
---|
79 | * Revision 1.4 2000/02/12 03:31:55 rahulj
|
---|
80 | * Removed duplicate CVS Log entries.
|
---|
81 | *
|
---|
82 | * Revision 1.3 2000/02/09 01:55:06 abagchi
|
---|
83 | * Removed private function docs
|
---|
84 | *
|
---|
85 | * Revision 1.2 2000/02/06 07:47:58 rahulj
|
---|
86 | * Year 2K copyright swat.
|
---|
87 | *
|
---|
88 | * Revision 1.1.1.1 1999/11/09 01:07:46 twl
|
---|
89 | * Initial checkin
|
---|
90 | *
|
---|
91 | * Revision 1.3 1999/11/08 20:45:01 rahul
|
---|
92 | * Swat for adding in Product name and CVS comment log variable.
|
---|
93 | *
|
---|
94 | */
|
---|
95 |
|
---|
96 |
|
---|
97 | #ifndef LOCATOR_HPP
|
---|
98 | #define LOCATOR_HPP
|
---|
99 |
|
---|
100 | #include <xercesc/util/XercesDefs.hpp>
|
---|
101 |
|
---|
102 | XERCES_CPP_NAMESPACE_BEGIN
|
---|
103 |
|
---|
104 | /**
|
---|
105 | * Interface for associating a SAX event with a document location.
|
---|
106 | *
|
---|
107 | * <p>If a SAX parser provides location information to the SAX
|
---|
108 | * application, it does so by implementing this interface and then
|
---|
109 | * passing an instance to the application using the document
|
---|
110 | * handler's setDocumentLocator method. The application can use the
|
---|
111 | * object to obtain the location of any other document handler event
|
---|
112 | * in the XML source document.</p>
|
---|
113 | *
|
---|
114 | * <p>Note that the results returned by the object will be valid only
|
---|
115 | * during the scope of each document handler method: the application
|
---|
116 | * will receive unpredictable results if it attempts to use the
|
---|
117 | * locator at any other time.</p>
|
---|
118 | *
|
---|
119 | * <p>SAX parsers are not required to supply a locator, but they are
|
---|
120 | * very strong encouraged to do so. If the parser supplies a
|
---|
121 | * locator, it must do so before reporting any other document events.
|
---|
122 | * If no locator has been set by the time the application receives
|
---|
123 | * the startDocument event, the application should assume that a
|
---|
124 | * locator is not available.</p>
|
---|
125 | *
|
---|
126 | * @see DocumentHandler#setDocumentLocator
|
---|
127 | */
|
---|
128 |
|
---|
129 | class SAX_EXPORT Locator
|
---|
130 | {
|
---|
131 | public:
|
---|
132 |
|
---|
133 | /** @name Constructors and Destructor */
|
---|
134 | //@{
|
---|
135 | /** Default constructor */
|
---|
136 | Locator()
|
---|
137 | {
|
---|
138 | }
|
---|
139 |
|
---|
140 | /** Destructor */
|
---|
141 | virtual ~Locator()
|
---|
142 | {
|
---|
143 | }
|
---|
144 |
|
---|
145 | //@}
|
---|
146 |
|
---|
147 | /** @name The locator interface */
|
---|
148 | //@{
|
---|
149 | /**
|
---|
150 | * Return the public identifier for the current document event.
|
---|
151 | * <p>This will be the public identifier
|
---|
152 | * @return A string containing the public identifier, or
|
---|
153 | * null if none is available.
|
---|
154 | * @see #getSystemId
|
---|
155 | */
|
---|
156 | virtual const XMLCh* getPublicId() const = 0;
|
---|
157 |
|
---|
158 | /**
|
---|
159 | * Return the system identifier for the current document event.
|
---|
160 | *
|
---|
161 | * <p>If the system identifier is a URL, the parser must resolve it
|
---|
162 | * fully before passing it to the application.</p>
|
---|
163 | *
|
---|
164 | * @return A string containing the system identifier, or null
|
---|
165 | * if none is available.
|
---|
166 | * @see #getPublicId
|
---|
167 | */
|
---|
168 | virtual const XMLCh* getSystemId() const = 0;
|
---|
169 |
|
---|
170 | /**
|
---|
171 | * Return the line number where the current document event ends.
|
---|
172 | * Note that this is the line position of the first character
|
---|
173 | * after the text associated with the document event.
|
---|
174 | * @return The line number, or -1 if none is available.
|
---|
175 | * @see #getColumnNumber
|
---|
176 | */
|
---|
177 | virtual XMLSSize_t getLineNumber() const = 0;
|
---|
178 |
|
---|
179 | /**
|
---|
180 | * Return the column number where the current document event ends.
|
---|
181 | * Note that this is the column number of the first
|
---|
182 | * character after the text associated with the document
|
---|
183 | * event. The first column in a line is position 1.
|
---|
184 | * @return The column number, or -1 if none is available.
|
---|
185 | * @see #getLineNumber
|
---|
186 | */
|
---|
187 | virtual XMLSSize_t getColumnNumber() const = 0;
|
---|
188 | //@}
|
---|
189 |
|
---|
190 | private :
|
---|
191 | /* Copy constructor */
|
---|
192 | Locator(const Locator&);
|
---|
193 |
|
---|
194 | /* Assignment operator */
|
---|
195 | Locator& operator=(const Locator&);
|
---|
196 | };
|
---|
197 |
|
---|
198 | XERCES_CPP_NAMESPACE_END
|
---|
199 |
|
---|
200 | #endif
|
---|