[2674] | 1 | #ifndef DOMError_HEADER_GUARD_ |
---|
| 2 | #define DOMError_HEADER_GUARD_ |
---|
| 3 | |
---|
| 4 | /* |
---|
| 5 | * Licensed to the Apache Software Foundation (ASF) under one or more |
---|
| 6 | * contributor license agreements. See the NOTICE file distributed with |
---|
| 7 | * this work for additional information regarding copyright ownership. |
---|
| 8 | * The ASF licenses this file to You under the Apache License, Version 2.0 |
---|
| 9 | * (the "License"); you may not use this file except in compliance with |
---|
| 10 | * the License. You may obtain a copy of the License at |
---|
| 11 | * |
---|
| 12 | * http://www.apache.org/licenses/LICENSE-2.0 |
---|
| 13 | * |
---|
| 14 | * Unless required by applicable law or agreed to in writing, software |
---|
| 15 | * distributed under the License is distributed on an "AS IS" BASIS, |
---|
| 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
---|
| 17 | * See the License for the specific language governing permissions and |
---|
| 18 | * limitations under the License. |
---|
| 19 | */ |
---|
| 20 | |
---|
| 21 | /* |
---|
| 22 | * $Id: DOMError.hpp 568078 2007-08-21 11:43:25Z amassari $ |
---|
| 23 | */ |
---|
| 24 | |
---|
| 25 | |
---|
| 26 | #include <xercesc/util/XercesDefs.hpp> |
---|
| 27 | |
---|
| 28 | XERCES_CPP_NAMESPACE_BEGIN |
---|
| 29 | |
---|
| 30 | class DOMLocator; |
---|
| 31 | |
---|
| 32 | |
---|
| 33 | /** |
---|
| 34 | * DOMError is an interface that describes an error. |
---|
| 35 | * |
---|
| 36 | * @see DOMErrorHandler#handleError |
---|
| 37 | * @since DOM Level 3 |
---|
| 38 | */ |
---|
| 39 | |
---|
| 40 | class CDOM_EXPORT DOMError |
---|
| 41 | { |
---|
| 42 | protected: |
---|
| 43 | // ----------------------------------------------------------------------- |
---|
| 44 | // Hidden constructors |
---|
| 45 | // ----------------------------------------------------------------------- |
---|
| 46 | /** @name Hidden constructors */ |
---|
| 47 | //@{ |
---|
| 48 | DOMError() {}; |
---|
| 49 | //@} |
---|
| 50 | |
---|
| 51 | private: |
---|
| 52 | // ----------------------------------------------------------------------- |
---|
| 53 | // Unimplemented constructors and operators |
---|
| 54 | // ----------------------------------------------------------------------- |
---|
| 55 | /** @name Unimplemented constructors and operators */ |
---|
| 56 | //@{ |
---|
| 57 | DOMError(const DOMError &); |
---|
| 58 | DOMError & operator = (const DOMError &); |
---|
| 59 | //@} |
---|
| 60 | |
---|
| 61 | public: |
---|
| 62 | // ----------------------------------------------------------------------- |
---|
| 63 | // All constructors are hidden, just the destructor is available |
---|
| 64 | // ----------------------------------------------------------------------- |
---|
| 65 | /** @name Destructor */ |
---|
| 66 | //@{ |
---|
| 67 | /** |
---|
| 68 | * Destructor |
---|
| 69 | * |
---|
| 70 | */ |
---|
| 71 | virtual ~DOMError() {}; |
---|
| 72 | //@} |
---|
| 73 | |
---|
| 74 | // ----------------------------------------------------------------------- |
---|
| 75 | // Class types |
---|
| 76 | // ----------------------------------------------------------------------- |
---|
| 77 | /** @name Public constants */ |
---|
| 78 | //@{ |
---|
| 79 | /** |
---|
| 80 | * The severity of the error described by the <code>DOMError</code>. |
---|
| 81 | * |
---|
| 82 | * @since DOM Level 3 |
---|
| 83 | */ |
---|
| 84 | enum ErrorSeverity |
---|
| 85 | { |
---|
| 86 | DOM_SEVERITY_WARNING = 0, |
---|
| 87 | DOM_SEVERITY_ERROR = 1, |
---|
| 88 | DOM_SEVERITY_FATAL_ERROR = 2 |
---|
| 89 | }; |
---|
| 90 | //@} |
---|
| 91 | |
---|
| 92 | |
---|
| 93 | // ----------------------------------------------------------------------- |
---|
| 94 | // Virtual DOMError interface |
---|
| 95 | // ----------------------------------------------------------------------- |
---|
| 96 | /** @name Functions introduced in DOM Level 3 */ |
---|
| 97 | //@{ |
---|
| 98 | // ----------------------------------------------------------------------- |
---|
| 99 | // Getter methods |
---|
| 100 | // ----------------------------------------------------------------------- |
---|
| 101 | /** |
---|
| 102 | * Get the severity of the error |
---|
| 103 | * |
---|
| 104 | * <p><b>"Experimental - subject to change"</b></p> |
---|
| 105 | * |
---|
| 106 | * @see setSeverity |
---|
| 107 | * @since DOM Level 3 |
---|
| 108 | */ |
---|
| 109 | virtual short getSeverity() const = 0; |
---|
| 110 | |
---|
| 111 | /** |
---|
| 112 | * Get the message describing the error that occured. |
---|
| 113 | * |
---|
| 114 | * <p><b>"Experimental - subject to change"</b></p> |
---|
| 115 | * |
---|
| 116 | * @see setMessage |
---|
| 117 | * @since DOM Level 3 |
---|
| 118 | */ |
---|
| 119 | virtual const XMLCh* getMessage() const = 0; |
---|
| 120 | |
---|
| 121 | /** |
---|
| 122 | * Get the location of the error |
---|
| 123 | * |
---|
| 124 | * <p><b>"Experimental - subject to change"</b></p> |
---|
| 125 | * |
---|
| 126 | * @see setLocation |
---|
| 127 | * @since DOM Level 3 |
---|
| 128 | */ |
---|
| 129 | virtual DOMLocator* getLocation() const = 0; |
---|
| 130 | |
---|
| 131 | /** |
---|
| 132 | * The related platform dependent exception if any. |
---|
| 133 | * |
---|
| 134 | * <p><b>"Experimental - subject to change"</b></p> |
---|
| 135 | * |
---|
| 136 | * @see setRelatedException |
---|
| 137 | * @since DOM Level 3 |
---|
| 138 | */ |
---|
| 139 | virtual void* getRelatedException() const = 0; |
---|
| 140 | |
---|
| 141 | /** |
---|
| 142 | * A <code>XMLCh*</code> indicating which related data is expected in |
---|
| 143 | * relatedData. Users should refer to the specification of the error |
---|
| 144 | * in order to find its <code>XMLCh*</code> type and relatedData |
---|
| 145 | * definitions if any. |
---|
| 146 | * |
---|
| 147 | * Note: As an example, [DOM Level 3 Load and Save] does not keep the |
---|
| 148 | * [baseURI] property defined on a Processing Instruction information item. |
---|
| 149 | * Therefore, the DOMBuilder generates a SEVERITY_WARNING with type |
---|
| 150 | * "infoset-baseURI" and the lost [baseURI] property represented as a |
---|
| 151 | * DOMString in the relatedData attribute. |
---|
| 152 | * |
---|
| 153 | * <p><b>"Experimental - subject to change"</b></p> |
---|
| 154 | * |
---|
| 155 | * @see setType |
---|
| 156 | * @since DOM Level 3 |
---|
| 157 | */ |
---|
| 158 | virtual const XMLCh* getType() const = 0; |
---|
| 159 | |
---|
| 160 | /** |
---|
| 161 | * The related DOMError.type dependent data if any. |
---|
| 162 | * |
---|
| 163 | * <p><b>"Experimental - subject to change"</b></p> |
---|
| 164 | * |
---|
| 165 | * @see setRelatedData |
---|
| 166 | * @since DOM Level 3 |
---|
| 167 | */ |
---|
| 168 | virtual void* getRelatedData() const = 0; |
---|
| 169 | |
---|
| 170 | |
---|
| 171 | // ----------------------------------------------------------------------- |
---|
| 172 | // Setter methods |
---|
| 173 | // ----------------------------------------------------------------------- |
---|
| 174 | /** |
---|
| 175 | * Set the severity of the error |
---|
| 176 | * |
---|
| 177 | * <p><b>"Experimental - subject to change"</b></p> |
---|
| 178 | * |
---|
| 179 | * @param severity the type of the error to set |
---|
| 180 | * @see getLocation |
---|
| 181 | * @since DOM Level 3 |
---|
| 182 | */ |
---|
| 183 | virtual void setSeverity(const short severity) = 0; |
---|
| 184 | |
---|
| 185 | /** |
---|
| 186 | * Set the error message |
---|
| 187 | * |
---|
| 188 | * <p><b>"Experimental - subject to change"</b></p> |
---|
| 189 | * |
---|
| 190 | * @param message the error message to set. |
---|
| 191 | * @see getMessage |
---|
| 192 | * @since DOM Level 3 |
---|
| 193 | */ |
---|
| 194 | virtual void setMessage(const XMLCh* const message) = 0; |
---|
| 195 | |
---|
| 196 | /** |
---|
| 197 | * Set the location of the error |
---|
| 198 | * |
---|
| 199 | * <p><b>"Experimental - subject to change"</b></p> |
---|
| 200 | * |
---|
| 201 | * @param location the location of the error to set. |
---|
| 202 | * @see getLocation |
---|
| 203 | * @since DOM Level 3 |
---|
| 204 | */ |
---|
| 205 | virtual void setLocation(DOMLocator* const location) = 0; |
---|
| 206 | |
---|
| 207 | /** |
---|
| 208 | * The related platform dependent exception if any. |
---|
| 209 | * |
---|
| 210 | * <p><b>"Experimental - subject to change"</b></p> |
---|
| 211 | * |
---|
| 212 | * @param exc the related exception to set. |
---|
| 213 | * @see getRelatedException |
---|
| 214 | * @since DOM Level 3 |
---|
| 215 | */ |
---|
| 216 | virtual void setRelatedException(void* exc) const = 0; |
---|
| 217 | |
---|
| 218 | /** |
---|
| 219 | * A <code>XMLCh*</code> indicating which related data is expected in |
---|
| 220 | * relatedData. Users should refer to the specification of the error |
---|
| 221 | * in order to find its <code>XMLCh*</code> type and relatedData |
---|
| 222 | * definitions if any. |
---|
| 223 | * |
---|
| 224 | * Note: As an example, [DOM Level 3 Load and Save] does not keep the |
---|
| 225 | * [baseURI] property defined on a Processing Instruction information item. |
---|
| 226 | * Therefore, the DOMBuilder generates a SEVERITY_WARNING with type |
---|
| 227 | * "infoset-baseURI" and the lost [baseURI] property represented as a |
---|
| 228 | * DOMString in the relatedData attribute. |
---|
| 229 | * |
---|
| 230 | * <p><b>"Experimental - subject to change"</b></p> |
---|
| 231 | * |
---|
| 232 | * @see getType |
---|
| 233 | * @since DOM Level 3 |
---|
| 234 | */ |
---|
| 235 | virtual void setType(const XMLCh* type) = 0; |
---|
| 236 | |
---|
| 237 | /** |
---|
| 238 | * The related DOMError.type dependent data if any. |
---|
| 239 | * |
---|
| 240 | * <p><b>"Experimental - subject to change"</b></p> |
---|
| 241 | * |
---|
| 242 | * @see getRelatedData |
---|
| 243 | * @since DOM Level 3 |
---|
| 244 | */ |
---|
| 245 | virtual void setRelatedData(void* relatedData) = 0; |
---|
| 246 | |
---|
| 247 | //@} |
---|
| 248 | |
---|
| 249 | }; |
---|
| 250 | |
---|
| 251 | XERCES_CPP_NAMESPACE_END |
---|
| 252 | |
---|
| 253 | #endif |
---|