source: NonGTP/Xerces/xercesc/dom/impl/DOMLocatorImpl.hpp @ 188

Revision 188, 9.1 KB checked in by mattausch, 19 years ago (diff)

added xercesc to support

Line 
1/*
2 * The Apache Software License, Version 1.1
3 *
4 * Copyright (c) 2002 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: DOMLocatorImpl.hpp,v $
59 * Revision 1.5  2003/03/07 18:07:17  tng
60 * Return a reference instead of void for operator=
61 *
62 * Revision 1.4  2002/11/04 15:07:34  tng
63 * C++ Namespace Support.
64 *
65 * Revision 1.3  2002/05/30 19:26:00  knoaman
66 * documentation update
67 *
68 * Revision 1.2  2002/05/27 18:25:41  tng
69 * To get ready for 64 bit large file, use XMLSSize_t to represent line and column number.
70 *
71 * Revision 1.1  2002/05/23 15:47:24  knoaman
72 * DOM L3 core - support for DOMError, DOMErrorHandler and DOMLocator
73 *
74 */
75
76
77#ifndef DOMLOCATORIMPL_HPP
78#define DOMLOCATORIMPL_HPP
79
80#include <xercesc/dom/DOMLocator.hpp>
81
82XERCES_CPP_NAMESPACE_BEGIN
83
84
85
86/**
87  * Introduced in DOM Level 3
88  *
89  * Implementation of a DOMLocator interface.
90  *
91  * @see DOMLocator#DOMLocator
92  */
93
94class CDOM_EXPORT DOMLocatorImpl : public DOMLocator
95{
96public:
97    /** @name Constructors and Destructor */
98    //@{
99
100    /** Constructor */
101    DOMLocatorImpl();
102
103    DOMLocatorImpl
104    (
105        const XMLSSize_t lineNum
106        , const XMLSSize_t columnNum
107        , DOMNode* const errorNode
108        , const XMLCh* const uri
109        , const XMLSSize_t offset = -1
110    );
111
112    /** Desctructor */
113    virtual ~DOMLocatorImpl();
114
115    //@}
116
117    /** @name Get function */
118    //@{
119
120   /**
121    * <p><b>"Experimental - subject to change"</b></p>
122    *
123    * Get the line number where the error occured. The value is -1 if there is
124    * no line number available.
125    *
126    * @see #setLineNumber
127    */
128    virtual XMLSSize_t getLineNumber() const;
129
130   /**
131    * <p><b>"Experimental - subject to change"</b></p>
132    *
133    * Get the column number where the error occured. The value is -1 if there
134    * is no column number available.
135    *
136    * @see #setColumnNumber
137    */
138    virtual XMLSSize_t getColumnNumber() const;
139
140   /**
141    * <p><b>"Experimental - subject to change"</b></p>
142    *
143    * Get the byte or character offset into the input source, if we're parsing
144    * a file or a byte stream then this will be the byte offset into that
145    * stream, but if a character media is parsed then the offset will be the
146    * character offset. The value is -1 if there is no offset available.
147    *
148    * @see #setOffset
149    */
150    virtual XMLSSize_t getOffset() const;
151
152   /**
153    * <p><b>"Experimental - subject to change"</b></p>
154    *
155    * Get the DOM Node where the error occured, or <code>null</code> if there
156    * is no node available.
157    *
158    * @see #setErrorNode
159    */
160    virtual DOMNode* getErrorNode() const;
161
162   /**
163    * <p><b>"Experimental - subject to change"</b></p>
164    *
165    * Get the URI where the error occured, or <code>null</code> if there is no
166    * URI available.
167    *
168    * @see #setURI
169    */
170    virtual const XMLCh* getURI() const;
171
172    //@}
173
174
175   /** @name Set function */
176    //@{
177
178   /**
179    * <p><b>"Experimental - subject to change"</b></p>
180    *
181    * Set the line number of the error
182    *
183    * @param lineNumber the line number to set
184    *
185    * @see #getLinNumner
186    */
187    virtual void setLineNumber(const XMLSSize_t lineNumber);
188
189   /**
190    * <p><b>"Experimental - subject to change"</b></p>
191    *
192    * Set the column number of the error
193    *
194    * @param columnNumber the column number to set.
195    *
196    * @see #getColumnNumner
197    */
198    virtual void setColumnNumber(const XMLSSize_t columnNumber);
199
200   /**
201    * <p><b>"Experimental - subject to change"</b></p>
202    *
203    * Set the byte/character offset.
204    *
205    * @param offset the byte/characte offset to set.
206    *
207    * @see #getOffset
208    */
209    virtual void setOffset(const XMLSSize_t offset);
210
211   /**
212    * <p><b>"Experimental - subject to change"</b></p>
213    *
214    * Set the DOM Node where the error occured
215    *
216    * @param errorNode the DOM Node to set
217    *
218    * @see #getErrorNode
219    */
220    virtual void setErrorNode(DOMNode* const errorNode);
221
222   /**
223    * <p><b>"Experimental - subject to change"</b></p>
224    *
225    * Set the URI where the error occured
226    *
227    * @param uri the URI to set.
228    *
229    * @see #getURI
230    */
231    virtual void setURI(const XMLCh* const uri);
232
233    //@}
234
235
236private :
237    /* Unimplemented constructors and operators */
238
239    /* Copy constructor */
240    DOMLocatorImpl(const DOMLocatorImpl&);
241
242    /* Assignment operator */
243    DOMLocatorImpl& operator=(const DOMLocatorImpl&);
244
245    // -----------------------------------------------------------------------
246    //  Private data members
247    //
248    //  fLineNum
249    //  fColumnNum
250    //      Track line/column number of where the error occured
251    //
252    //  fOffset
253    //      Track character/byte offset in the input source where the error
254    //      occured
255    //
256    //  fErrorNode
257    //      Current error node where the error occured
258    //
259    //  fURI
260    //      The uri where the error occured
261    // -----------------------------------------------------------------------
262    XMLSSize_t   fLineNum;
263    XMLSSize_t   fColumnNum;
264    XMLSSize_t   fOffset;
265    DOMNode*     fErrorNode;
266    const XMLCh* fURI;
267};
268
269
270// ---------------------------------------------------------------------------
271//  DOMLocatorImpl: Getter methods
272// ---------------------------------------------------------------------------
273inline XMLSSize_t DOMLocatorImpl::getLineNumber() const
274{
275    return fLineNum;
276}
277
278inline XMLSSize_t DOMLocatorImpl::getColumnNumber() const
279{
280    return fColumnNum;
281}
282
283inline XMLSSize_t DOMLocatorImpl::getOffset() const
284{
285    return fOffset;
286}
287
288inline DOMNode* DOMLocatorImpl::getErrorNode() const
289{
290    return fErrorNode;
291}
292
293inline const XMLCh* DOMLocatorImpl::getURI() const
294{
295    return fURI;
296}
297
298
299// ---------------------------------------------------------------------------
300//  DOMLocatorImpl: Setter methods
301// ---------------------------------------------------------------------------
302inline void DOMLocatorImpl::setLineNumber(const XMLSSize_t lineNumber)
303{
304    fLineNum = lineNumber;
305}
306
307inline void DOMLocatorImpl::setColumnNumber(const XMLSSize_t columnNumber)
308{
309    fColumnNum = columnNumber;
310}
311
312inline void DOMLocatorImpl::setOffset(const XMLSSize_t offset)
313{
314    fOffset = offset;
315}
316
317inline void DOMLocatorImpl::setErrorNode(DOMNode* const errorNode)
318{
319    fErrorNode = errorNode;
320}
321
322inline void DOMLocatorImpl::setURI(const XMLCh* const uri)
323{
324    fURI = uri;
325}
326
327XERCES_CPP_NAMESPACE_END
328
329#endif
Note: See TracBrowser for help on using the repository browser.