1 | /*
|
---|
2 | * Copyright 2002,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 | * $Id: XSDLocator.hpp,v 1.6 2004/09/08 13:56:57 peiyongz Exp $
|
---|
19 | */
|
---|
20 |
|
---|
21 |
|
---|
22 | /**
|
---|
23 | * A Locator implementation
|
---|
24 | */
|
---|
25 |
|
---|
26 | #ifndef XSDLOCATOR_HPP
|
---|
27 | #define XSDLOCATOR_HPP
|
---|
28 |
|
---|
29 | #include <xercesc/util/XMemory.hpp>
|
---|
30 | #include <xercesc/sax/Locator.hpp>
|
---|
31 |
|
---|
32 | XERCES_CPP_NAMESPACE_BEGIN
|
---|
33 |
|
---|
34 | class VALIDATORS_EXPORT XSDLocator: public XMemory, public Locator
|
---|
35 | {
|
---|
36 | public:
|
---|
37 |
|
---|
38 | /** @name Constructors and Destructor */
|
---|
39 | //@{
|
---|
40 | /** Default constructor */
|
---|
41 | XSDLocator();
|
---|
42 |
|
---|
43 | /** Destructor */
|
---|
44 | virtual ~XSDLocator()
|
---|
45 | {
|
---|
46 | }
|
---|
47 |
|
---|
48 | //@}
|
---|
49 |
|
---|
50 | /** @name The locator interface */
|
---|
51 | //@{
|
---|
52 | /**
|
---|
53 | * Return the public identifier for the current document event.
|
---|
54 | * <p>This will be the public identifier
|
---|
55 | * @return A string containing the public identifier, or
|
---|
56 | * null if none is available.
|
---|
57 | * @see #getSystemId
|
---|
58 | */
|
---|
59 | virtual const XMLCh* getPublicId() const;
|
---|
60 |
|
---|
61 | /**
|
---|
62 | * Return the system identifier for the current document event.
|
---|
63 | *
|
---|
64 | * <p>If the system identifier is a URL, the parser must resolve it
|
---|
65 | * fully before passing it to the application.</p>
|
---|
66 | *
|
---|
67 | * @return A string containing the system identifier, or null
|
---|
68 | * if none is available.
|
---|
69 | * @see #getPublicId
|
---|
70 | */
|
---|
71 | virtual const XMLCh* getSystemId() const;
|
---|
72 |
|
---|
73 | /**
|
---|
74 | * Return the line number where the current document event ends.
|
---|
75 | * Note that this is the line position of the first character
|
---|
76 | * after the text associated with the document event.
|
---|
77 | * @return The line number, or -1 if none is available.
|
---|
78 | * @see #getColumnNumber
|
---|
79 | */
|
---|
80 | virtual XMLSSize_t getLineNumber() const;
|
---|
81 |
|
---|
82 | /**
|
---|
83 | * Return the column number where the current document event ends.
|
---|
84 | * Note that this is the column number of the first
|
---|
85 | * character after the text associated with the document
|
---|
86 | * event. The first column in a line is position 1.
|
---|
87 | * @return The column number, or -1 if none is available.
|
---|
88 | * @see #getLineNumber
|
---|
89 | */
|
---|
90 | virtual XMLSSize_t getColumnNumber() const;
|
---|
91 | //@}
|
---|
92 |
|
---|
93 | // -----------------------------------------------------------------------
|
---|
94 | // Setter methods
|
---|
95 | // -----------------------------------------------------------------------
|
---|
96 | void setValues(const XMLCh* const systemId,
|
---|
97 | const XMLCh* const publicId,
|
---|
98 | const XMLSSize_t lineNo, const XMLSSize_t columnNo);
|
---|
99 |
|
---|
100 | private :
|
---|
101 | // -----------------------------------------------------------------------
|
---|
102 | // Unimplemented constructors and destructor
|
---|
103 | // -----------------------------------------------------------------------
|
---|
104 | XSDLocator(const XSDLocator&);
|
---|
105 | XSDLocator& operator=(const XSDLocator&);
|
---|
106 |
|
---|
107 | // -----------------------------------------------------------------------
|
---|
108 | // Private data members
|
---|
109 | // -----------------------------------------------------------------------
|
---|
110 | XMLSSize_t fLineNo;
|
---|
111 | XMLSSize_t fColumnNo;
|
---|
112 | const XMLCh* fSystemId;
|
---|
113 | const XMLCh* fPublicId;
|
---|
114 | };
|
---|
115 |
|
---|
116 | // ---------------------------------------------------------------------------
|
---|
117 | // XSDLocator: Getter methods
|
---|
118 | // ---------------------------------------------------------------------------
|
---|
119 | inline XMLSSize_t XSDLocator::getLineNumber() const
|
---|
120 | {
|
---|
121 | return fLineNo;
|
---|
122 | }
|
---|
123 |
|
---|
124 | inline XMLSSize_t XSDLocator::getColumnNumber() const
|
---|
125 | {
|
---|
126 | return fColumnNo;
|
---|
127 | }
|
---|
128 |
|
---|
129 | inline const XMLCh* XSDLocator::getPublicId() const
|
---|
130 | {
|
---|
131 | return fPublicId;
|
---|
132 | }
|
---|
133 |
|
---|
134 | inline const XMLCh* XSDLocator::getSystemId() const
|
---|
135 | {
|
---|
136 | return fSystemId;
|
---|
137 | }
|
---|
138 |
|
---|
139 | XERCES_CPP_NAMESPACE_END
|
---|
140 |
|
---|
141 | #endif
|
---|