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