source: NonGTP/Xerces/xerces-c_2_8_0/include/xercesc/sax/Locator.hpp @ 2674

Revision 2674, 3.9 KB checked in by mattausch, 16 years ago (diff)
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: Locator.hpp 568078 2007-08-21 11:43:25Z amassari $
20 */
21
22
23#ifndef LOCATOR_HPP
24#define LOCATOR_HPP
25
26#include <xercesc/util/XercesDefs.hpp>
27
28XERCES_CPP_NAMESPACE_BEGIN
29
30/**
31  * Interface for associating a SAX event with a document location.
32  *
33  * <p>If a SAX parser provides location information to the SAX
34  * application, it does so by implementing this interface and then
35  * passing an instance to the application using the document
36  * handler's setDocumentLocator method.  The application can use the
37  * object to obtain the location of any other document handler event
38  * in the XML source document.</p>
39  *
40  * <p>Note that the results returned by the object will be valid only
41  * during the scope of each document handler method: the application
42  * will receive unpredictable results if it attempts to use the
43  * locator at any other time.</p>
44  *
45  * <p>SAX parsers are not required to supply a locator, but they are
46  * very strong encouraged to do so.  If the parser supplies a
47  * locator, it must do so before reporting any other document events.
48  * If no locator has been set by the time the application receives
49  * the startDocument event, the application should assume that a
50  * locator is not available.</p>
51  *
52  * @see DocumentHandler#setDocumentLocator
53  */
54
55class SAX_EXPORT Locator
56{
57public:
58
59    /** @name Constructors and Destructor */
60    //@{
61    /** Default constructor */
62    Locator()
63    {
64    }
65
66    /** Destructor */
67    virtual ~Locator()
68    {
69    }
70
71    //@}
72
73    /** @name The locator interface */
74    //@{
75  /**
76    * Return the public identifier for the current document event.
77    * <p>This will be the public identifier
78    * @return A string containing the public identifier, or
79    *         null if none is available.
80    * @see #getSystemId
81    */
82    virtual const XMLCh* getPublicId() const = 0;
83
84  /**
85    * Return the system identifier for the current document event.
86    *
87    * <p>If the system identifier is a URL, the parser must resolve it
88    * fully before passing it to the application.</p>
89    *
90    * @return A string containing the system identifier, or null
91    *         if none is available.
92    * @see #getPublicId
93    */
94    virtual const XMLCh* getSystemId() const = 0;
95
96  /**
97    * Return the line number where the current document event ends.
98    * Note that this is the line position of the first character
99    * after the text associated with the document event.
100    * @return The line number, or -1 if none is available.
101    * @see #getColumnNumber
102    */
103    virtual XMLSSize_t getLineNumber() const = 0;
104
105  /**
106    * Return the column number where the current document event ends.
107    * Note that this is the column number of the first
108    * character after the text associated with the document
109    * event.  The first column in a line is position 1.
110    * @return The column number, or -1 if none is available.
111    * @see #getLineNumber
112    */
113    virtual XMLSSize_t getColumnNumber() const = 0;
114    //@}
115
116private :
117    /* Copy constructor */
118    Locator(const Locator&);
119
120    /* Assignment operator */
121    Locator& operator=(const Locator&);
122};
123
124XERCES_CPP_NAMESPACE_END
125
126#endif
Note: See TracBrowser for help on using the repository browser.