[188] | 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: DOMErrorImpl.hpp,v $
|
---|
| 59 | * Revision 1.9 2003/12/02 14:33:13 amassari
|
---|
| 60 | * Don't use the word "exception" as a variable name, as VC 7.1 complains about it
|
---|
| 61 | *
|
---|
| 62 | * Revision 1.8 2003/09/04 14:38:25 gareth
|
---|
| 63 | * Fix for bug #22008. Removed the ability to adopt the DOMObject.
|
---|
| 64 | *
|
---|
| 65 | * Revision 1.7 2003/05/15 15:56:24 gareth
|
---|
| 66 | * Removed unnecessary include.
|
---|
| 67 | *
|
---|
| 68 | * Revision 1.6 2003/05/14 18:06:53 gareth
|
---|
| 69 | * Updated DOMError to http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/core.html.
|
---|
| 70 | *
|
---|
| 71 | * Revision 1.5 2003/03/07 18:07:17 tng
|
---|
| 72 | * Return a reference instead of void for operator=
|
---|
| 73 | *
|
---|
| 74 | * Revision 1.4 2002/11/04 15:07:34 tng
|
---|
| 75 | * C++ Namespace Support.
|
---|
| 76 | *
|
---|
| 77 | * Revision 1.3 2002/07/15 19:25:49 tng
|
---|
| 78 | * DOM L3: declare a dummy DOMError::set/getRelatedException
|
---|
| 79 | *
|
---|
| 80 | * Revision 1.2 2002/05/30 19:26:00 knoaman
|
---|
| 81 | * documentation update
|
---|
| 82 | *
|
---|
| 83 | * Revision 1.1 2002/05/23 15:47:24 knoaman
|
---|
| 84 | * DOM L3 core - support for DOMError, DOMErrorHandler and DOMLocator
|
---|
| 85 | *
|
---|
| 86 | */
|
---|
| 87 |
|
---|
| 88 |
|
---|
| 89 | #ifndef DOMERRORIMPL_HPP
|
---|
| 90 | #define DOMERRORIMPL_HPP
|
---|
| 91 |
|
---|
| 92 | #include <xercesc/dom/DOMError.hpp>
|
---|
| 93 | #include <xercesc/util/XMLString.hpp>
|
---|
| 94 | XERCES_CPP_NAMESPACE_BEGIN
|
---|
| 95 |
|
---|
| 96 |
|
---|
| 97 | /**
|
---|
| 98 | * Introduced in DOM Level 3
|
---|
| 99 | * Implementation of a DOMError interface.
|
---|
| 100 | *
|
---|
| 101 | * @see DOMError#DOMError
|
---|
| 102 | */
|
---|
| 103 |
|
---|
| 104 | class CDOM_EXPORT DOMErrorImpl : public DOMError
|
---|
| 105 | {
|
---|
| 106 | public:
|
---|
| 107 | /** @name Constructors and Destructor */
|
---|
| 108 | //@{
|
---|
| 109 |
|
---|
| 110 | /** Constructors */
|
---|
| 111 | DOMErrorImpl(const short severity);
|
---|
| 112 |
|
---|
| 113 | DOMErrorImpl
|
---|
| 114 | (
|
---|
| 115 | const short severity
|
---|
| 116 | , const XMLCh* const message
|
---|
| 117 | , DOMLocator* const location
|
---|
| 118 | );
|
---|
| 119 |
|
---|
| 120 | DOMErrorImpl
|
---|
| 121 | (
|
---|
| 122 | const short severity
|
---|
| 123 | , const XMLCh* type
|
---|
| 124 | , const XMLCh* message
|
---|
| 125 | , void* relatedData
|
---|
| 126 | );
|
---|
| 127 |
|
---|
| 128 | /** Desctructor */
|
---|
| 129 | virtual ~DOMErrorImpl();
|
---|
| 130 |
|
---|
| 131 | //@}
|
---|
| 132 |
|
---|
| 133 | /** @name Get function */
|
---|
| 134 | //@{
|
---|
| 135 |
|
---|
| 136 | /**
|
---|
| 137 | * <p><b>"Experimental - subject to change"</b></p>
|
---|
| 138 | *
|
---|
| 139 | * Get the severity of the error
|
---|
| 140 | */
|
---|
| 141 | virtual short getSeverity() const;
|
---|
| 142 |
|
---|
| 143 | /**
|
---|
| 144 | * <p><b>"Experimental - subject to change"</b></p>
|
---|
| 145 | *
|
---|
| 146 | * Get the message describing the error that occured.
|
---|
| 147 | */
|
---|
| 148 | virtual const XMLCh* getMessage() const;
|
---|
| 149 |
|
---|
| 150 | /**
|
---|
| 151 | * <p><b>"Experimental - subject to change"</b></p>
|
---|
| 152 | *
|
---|
| 153 | * Get the location of the error
|
---|
| 154 | */
|
---|
| 155 | virtual DOMLocator* getLocation() const;
|
---|
| 156 |
|
---|
| 157 | /**
|
---|
| 158 | * The related platform dependent exception if any.
|
---|
| 159 | *
|
---|
| 160 | * <p><b>"Experimental - subject to change"</b></p>
|
---|
| 161 | *
|
---|
| 162 | * @see setRelatedException
|
---|
| 163 | * @since DOM Level 3
|
---|
| 164 | */
|
---|
| 165 | virtual void* getRelatedException() const;
|
---|
| 166 |
|
---|
| 167 | virtual const XMLCh* getType() const;
|
---|
| 168 |
|
---|
| 169 | virtual void* getRelatedData() const;
|
---|
| 170 |
|
---|
| 171 | //@}
|
---|
| 172 |
|
---|
| 173 |
|
---|
| 174 | /** @name Set function */
|
---|
| 175 | //@{
|
---|
| 176 |
|
---|
| 177 | /**
|
---|
| 178 | * <p><b>"Experimental - subject to change"</b></p>
|
---|
| 179 | *
|
---|
| 180 | * Set the severity of the error
|
---|
| 181 | *
|
---|
| 182 | * @param severity the type of the error to set
|
---|
| 183 | */
|
---|
| 184 | virtual void setSeverity(const short severity);
|
---|
| 185 |
|
---|
| 186 | /**
|
---|
| 187 | * <p><b>"Experimental - subject to change"</b></p>
|
---|
| 188 | *
|
---|
| 189 | * Set the error message
|
---|
| 190 | *
|
---|
| 191 | * @param message the error message to set.
|
---|
| 192 | */
|
---|
| 193 | virtual void setMessage(const XMLCh* const message);
|
---|
| 194 |
|
---|
| 195 | /**
|
---|
| 196 | * <p><b>"Experimental - subject to change"</b></p>
|
---|
| 197 | *
|
---|
| 198 | * Set the location of the error
|
---|
| 199 | *
|
---|
| 200 | * @param location the location of the error to set.
|
---|
| 201 | */
|
---|
| 202 | virtual void setLocation(DOMLocator* const location);
|
---|
| 203 |
|
---|
| 204 | /**
|
---|
| 205 | * @param value <code>true</code> if DOMLocator is owned and should be
|
---|
| 206 | * deleted, <code>false</code> otherwise.
|
---|
| 207 | */
|
---|
| 208 | void setAdoptLocation(const bool value);
|
---|
| 209 |
|
---|
| 210 | /**
|
---|
| 211 | * The related platform dependent exception if any.
|
---|
| 212 | *
|
---|
| 213 | * <p><b>"Experimental - subject to change"</b></p>
|
---|
| 214 | *
|
---|
| 215 | * @param exc the related exception to set.
|
---|
| 216 | * @see getRelatedException
|
---|
| 217 | * @since DOM Level 3
|
---|
| 218 | */
|
---|
| 219 | virtual void setRelatedException(void* exc) const;
|
---|
| 220 |
|
---|
| 221 | virtual void setType(const XMLCh* type);
|
---|
| 222 |
|
---|
| 223 | virtual void setRelatedData(void* relatedData);
|
---|
| 224 |
|
---|
| 225 |
|
---|
| 226 | private :
|
---|
| 227 | /* Unimplemented constructors and operators */
|
---|
| 228 |
|
---|
| 229 | /* Copy constructor */
|
---|
| 230 | DOMErrorImpl(const DOMErrorImpl&);
|
---|
| 231 |
|
---|
| 232 | /* Assignment operator */
|
---|
| 233 | DOMErrorImpl& operator=(const DOMErrorImpl&);
|
---|
| 234 |
|
---|
| 235 | // -----------------------------------------------------------------------
|
---|
| 236 | // Private data members
|
---|
| 237 | //
|
---|
| 238 | // fAdoptLocation
|
---|
| 239 | // Indicates whether we own the DOMLocator object or not.
|
---|
| 240 | //
|
---|
| 241 | // fSeverity
|
---|
| 242 | // The type of the error.
|
---|
| 243 | //
|
---|
| 244 | // fMessage
|
---|
| 245 | // The error message.
|
---|
| 246 | //
|
---|
| 247 | // fLocation
|
---|
| 248 | // The location info of the error.
|
---|
| 249 | //
|
---|
| 250 | // fType
|
---|
| 251 | // The type of the error.
|
---|
| 252 | //
|
---|
| 253 | // fRelatedData
|
---|
| 254 | // The data related to this error.
|
---|
| 255 | //
|
---|
| 256 | // -----------------------------------------------------------------------
|
---|
| 257 | bool fAdoptLocation;
|
---|
| 258 | short fSeverity;
|
---|
| 259 | const XMLCh* fMessage;
|
---|
| 260 | DOMLocator* fLocation;
|
---|
| 261 | const XMLCh* fType;
|
---|
| 262 | void* fRelatedData;
|
---|
| 263 | };
|
---|
| 264 |
|
---|
| 265 | // ---------------------------------------------------------------------------
|
---|
| 266 | // DOMErrorImpl: Getter methods
|
---|
| 267 | // ---------------------------------------------------------------------------
|
---|
| 268 | inline short DOMErrorImpl::getSeverity() const
|
---|
| 269 | {
|
---|
| 270 | return fSeverity;
|
---|
| 271 | }
|
---|
| 272 |
|
---|
| 273 | inline const XMLCh* DOMErrorImpl::getMessage() const
|
---|
| 274 | {
|
---|
| 275 | return fMessage;
|
---|
| 276 | }
|
---|
| 277 |
|
---|
| 278 | inline DOMLocator* DOMErrorImpl::getLocation() const
|
---|
| 279 | {
|
---|
| 280 | return fLocation;
|
---|
| 281 | }
|
---|
| 282 |
|
---|
| 283 | inline void* DOMErrorImpl::getRelatedException() const
|
---|
| 284 | {
|
---|
| 285 | return 0;
|
---|
| 286 | }
|
---|
| 287 |
|
---|
| 288 | inline const XMLCh* DOMErrorImpl::getType() const
|
---|
| 289 | {
|
---|
| 290 | return fType;
|
---|
| 291 | }
|
---|
| 292 |
|
---|
| 293 | inline void* DOMErrorImpl::getRelatedData() const
|
---|
| 294 | {
|
---|
| 295 | return fRelatedData;
|
---|
| 296 | }
|
---|
| 297 |
|
---|
| 298 | // ---------------------------------------------------------------------------
|
---|
| 299 | // DOMLocatorImpl: Setter methods
|
---|
| 300 | // ---------------------------------------------------------------------------
|
---|
| 301 | inline void DOMErrorImpl::setSeverity(const short severity)
|
---|
| 302 | {
|
---|
| 303 | fSeverity = severity;
|
---|
| 304 | }
|
---|
| 305 |
|
---|
| 306 | inline void DOMErrorImpl::setMessage(const XMLCh* const message)
|
---|
| 307 | {
|
---|
| 308 | fMessage = message;
|
---|
| 309 | }
|
---|
| 310 |
|
---|
| 311 | inline void DOMErrorImpl::setAdoptLocation(const bool value)
|
---|
| 312 | {
|
---|
| 313 | fAdoptLocation = value;
|
---|
| 314 | }
|
---|
| 315 |
|
---|
| 316 | inline void DOMErrorImpl::setType(const XMLCh* type)
|
---|
| 317 | {
|
---|
| 318 | fType = type;
|
---|
| 319 | }
|
---|
| 320 |
|
---|
| 321 | inline void DOMErrorImpl::setRelatedData(void* relatedData)
|
---|
| 322 | {
|
---|
| 323 | fRelatedData = relatedData;
|
---|
| 324 | }
|
---|
| 325 |
|
---|
| 326 |
|
---|
| 327 | XERCES_CPP_NAMESPACE_END
|
---|
| 328 |
|
---|
| 329 | #endif
|
---|