Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:27:01

0001 /*
0002  * Licensed to the Apache Software Foundation (ASF) under one or more
0003  * contributor license agreements.  See the NOTICE file distributed with
0004  * this work for additional information regarding copyright ownership.
0005  * The ASF licenses this file to You under the Apache License, Version 2.0
0006  * (the "License"); you may not use this file except in compliance with
0007  * the License.  You may obtain a copy of the License at
0008  *
0009  *      http://www.apache.org/licenses/LICENSE-2.0
0010  *
0011  * Unless required by applicable law or agreed to in writing, software
0012  * distributed under the License is distributed on an "AS IS" BASIS,
0013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0014  * See the License for the specific language governing permissions and
0015  * limitations under the License.
0016  */
0017 
0018 /*
0019  * $Id$
0020  */
0021 
0022 #if !defined(XERCESC_INCLUDE_GUARD_DOMLOCATORIMPL_HPP)
0023 #define XERCESC_INCLUDE_GUARD_DOMLOCATORIMPL_HPP
0024 
0025 #include <xercesc/dom/DOMLocator.hpp>
0026 
0027 XERCES_CPP_NAMESPACE_BEGIN
0028 
0029 /**
0030   * Introduced in DOM Level 3
0031   *
0032   * Implementation of a DOMLocator interface.
0033   *
0034   * @see DOMLocator#DOMLocator
0035   */
0036 
0037 class CDOM_EXPORT DOMLocatorImpl : public DOMLocator
0038 {
0039 public:
0040     /** @name Constructors and Destructor */
0041     //@{
0042 
0043     /** Constructor */
0044     DOMLocatorImpl();
0045 
0046     DOMLocatorImpl
0047     (
0048           const XMLFileLoc lineNum
0049         , const XMLFileLoc columnNum
0050         , DOMNode* const errorNode
0051         , const XMLCh* const uri
0052         , const XMLFilePos offset = ~(XMLFilePos(0))
0053         , const XMLFilePos utf16Offset = ~(XMLFilePos(0))
0054     );
0055 
0056     /** Desctructor */
0057     virtual ~DOMLocatorImpl();
0058 
0059     //@}
0060 
0061     // DOMLocator interface
0062     virtual XMLFileLoc getLineNumber() const;
0063     virtual XMLFileLoc getColumnNumber() const;
0064     virtual XMLFilePos getByteOffset() const;
0065     virtual XMLFilePos getUtf16Offset() const;
0066     virtual DOMNode* getRelatedNode() const;
0067     virtual const XMLCh* getURI() const;
0068 
0069     // Setter functions
0070     void setLineNumber(const XMLFileLoc lineNumber);
0071     void setColumnNumber(const XMLFileLoc columnNumber);
0072     void setByteOffset(const XMLFilePos offset);
0073     void setUtf16Offset(const XMLFilePos offset);
0074     void setRelatedNode(DOMNode* const errorNode);
0075     void setURI(const XMLCh* const uri);
0076 
0077 
0078 private :
0079     /* Unimplemented constructors and operators */
0080 
0081     /* Copy constructor */
0082     DOMLocatorImpl(const DOMLocatorImpl&);
0083 
0084     /* Assignment operator */
0085     DOMLocatorImpl& operator=(const DOMLocatorImpl&);
0086 
0087 protected:
0088     // -----------------------------------------------------------------------
0089     //  Private data members
0090     //
0091     //  fLineNum
0092     //  fColumnNum
0093     //      Track line/column number of where the error occured
0094     //
0095     //  fByteOffset
0096     //      Track byte offset in the input source where the error
0097     //      occured
0098     //
0099     //  fUtf16Offset
0100     //      Track character offset in the input source where the error
0101     //      occured
0102     //
0103     //  fRelatedNode
0104     //      Current node where the error occured
0105     //
0106     //  fURI
0107     //      The uri where the error occured
0108     // -----------------------------------------------------------------------
0109     XMLFileLoc       fLineNum;
0110     XMLFileLoc       fColumnNum;
0111     XMLFilePos      fByteOffset;
0112     XMLFilePos      fUtf16Offset;
0113     DOMNode*        fRelatedNode;
0114     const XMLCh*    fURI;
0115 };
0116 
0117 
0118 // ---------------------------------------------------------------------------
0119 //  DOMLocatorImpl: Getter methods
0120 // ---------------------------------------------------------------------------
0121 inline XMLFileLoc DOMLocatorImpl::getLineNumber() const
0122 {
0123     return fLineNum;
0124 }
0125 
0126 inline XMLFileLoc DOMLocatorImpl::getColumnNumber() const
0127 {
0128     return fColumnNum;
0129 }
0130 
0131 inline XMLFilePos DOMLocatorImpl::getByteOffset() const
0132 {
0133     return fByteOffset;
0134 }
0135 
0136 inline XMLFilePos DOMLocatorImpl::getUtf16Offset() const
0137 {
0138     return fUtf16Offset;
0139 }
0140 
0141 inline DOMNode* DOMLocatorImpl::getRelatedNode() const
0142 {
0143     return fRelatedNode;
0144 }
0145 
0146 inline const XMLCh* DOMLocatorImpl::getURI() const
0147 {
0148     return fURI;
0149 }
0150 
0151 
0152 // ---------------------------------------------------------------------------
0153 //  DOMLocatorImpl: Setter methods
0154 // ---------------------------------------------------------------------------
0155 inline void DOMLocatorImpl::setLineNumber(const XMLFileLoc lineNumber)
0156 {
0157     fLineNum = lineNumber;
0158 }
0159 
0160 inline void DOMLocatorImpl::setColumnNumber(const XMLFileLoc columnNumber)
0161 {
0162     fColumnNum = columnNumber;
0163 }
0164 
0165 inline void DOMLocatorImpl::setByteOffset(const XMLFilePos offset)
0166 {
0167     fByteOffset = offset;
0168 }
0169 
0170 inline void DOMLocatorImpl::setUtf16Offset(const XMLFilePos offset)
0171 {
0172     fUtf16Offset = offset;
0173 }
0174 
0175 inline void DOMLocatorImpl::setRelatedNode(DOMNode* const errorNode)
0176 {
0177     fRelatedNode = errorNode;
0178 }
0179 
0180 inline void DOMLocatorImpl::setURI(const XMLCh* const uri)
0181 {
0182     fURI = uri;
0183 }
0184 
0185 XERCES_CPP_NAMESPACE_END
0186 
0187 #endif