[2674] | 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: DOM_DOMException.hpp 568078 2007-08-21 11:43:25Z amassari $ |
---|
| 20 | */ |
---|
| 21 | |
---|
| 22 | #ifndef DOM_DOMException_HEADER_GUARD_ |
---|
| 23 | #define DOM_DOMException_HEADER_GUARD_ |
---|
| 24 | |
---|
| 25 | #include <xercesc/util/XercesDefs.hpp> |
---|
| 26 | #include "DOMString.hpp" |
---|
| 27 | |
---|
| 28 | XERCES_CPP_NAMESPACE_BEGIN |
---|
| 29 | |
---|
| 30 | |
---|
| 31 | /** |
---|
| 32 | * Encapsulate a general DOM error or warning. |
---|
| 33 | * |
---|
| 34 | * <p> The DOM will create and throw an instance of DOMException |
---|
| 35 | * when an error condition is detected. Exceptions can occur |
---|
| 36 | * when an application directly manipulates the DOM document |
---|
| 37 | * tree that is produced by the parser, or when a document tree |
---|
| 38 | * is created from scratch using the DOM API. DOM exceptions will |
---|
| 39 | * not be generated by the parser while constructing a document |
---|
| 40 | * tree from an XML source document. |
---|
| 41 | * |
---|
| 42 | * <p>Unlike the other classes in the C++ DOM API, DOM_DOMException |
---|
| 43 | * is NOT a reference to an underlying implementation class, and |
---|
| 44 | * does not provide automatic memory management. Code that catches |
---|
| 45 | * a DOM exception is responsible for deleting it, or otherwise |
---|
| 46 | * arranging for its disposal. |
---|
| 47 | * |
---|
| 48 | */ |
---|
| 49 | class DEPRECATED_DOM_EXPORT DOM_DOMException { |
---|
| 50 | public: |
---|
| 51 | /** @name Enumerators for DOM Exceptions */ |
---|
| 52 | //@{ |
---|
| 53 | enum ExceptionCode { |
---|
| 54 | INDEX_SIZE_ERR = 1, |
---|
| 55 | DOMSTRING_SIZE_ERR = 2, |
---|
| 56 | HIERARCHY_REQUEST_ERR = 3, |
---|
| 57 | WRONG_DOCUMENT_ERR = 4, |
---|
| 58 | INVALID_CHARACTER_ERR = 5, |
---|
| 59 | NO_DATA_ALLOWED_ERR = 6, |
---|
| 60 | NO_MODIFICATION_ALLOWED_ERR = 7, |
---|
| 61 | NOT_FOUND_ERR = 8, |
---|
| 62 | NOT_SUPPORTED_ERR = 9, |
---|
| 63 | INUSE_ATTRIBUTE_ERR = 10, |
---|
| 64 | INVALID_STATE_ERR = 11, |
---|
| 65 | SYNTAX_ERR = 12, |
---|
| 66 | INVALID_MODIFICATION_ERR = 13, |
---|
| 67 | NAMESPACE_ERR = 14, |
---|
| 68 | INVALID_ACCESS_ERR = 15 |
---|
| 69 | }; |
---|
| 70 | //@} |
---|
| 71 | public: |
---|
| 72 | /** @name Constructors and assignment operator */ |
---|
| 73 | //@{ |
---|
| 74 | /** |
---|
| 75 | * Default constructor for DOM_DOMException. |
---|
| 76 | * |
---|
| 77 | */ |
---|
| 78 | DOM_DOMException(); |
---|
| 79 | |
---|
| 80 | /** |
---|
| 81 | * Constructor which takes an error code and a message. |
---|
| 82 | * |
---|
| 83 | * @param code The error code which indicates the exception |
---|
| 84 | * @param message The string containing the error message |
---|
| 85 | */ |
---|
| 86 | DOM_DOMException(short code, const DOMString &message); |
---|
| 87 | |
---|
| 88 | /** |
---|
| 89 | * Copy constructor. |
---|
| 90 | * |
---|
| 91 | * @param other The object to be copied. |
---|
| 92 | */ |
---|
| 93 | DOM_DOMException(const DOM_DOMException &other); |
---|
| 94 | |
---|
| 95 | //@} |
---|
| 96 | /** @name Destructor. */ |
---|
| 97 | //@{ |
---|
| 98 | /** |
---|
| 99 | * Destructor for DOM_DOMException. Applications are responsible |
---|
| 100 | * for deleting DOM_Exception objects that they catch after they |
---|
| 101 | * have completed their exception processing. |
---|
| 102 | * |
---|
| 103 | */ |
---|
| 104 | virtual ~DOM_DOMException(); |
---|
| 105 | //@} |
---|
| 106 | |
---|
| 107 | /** @name Public variables. */ |
---|
| 108 | //@{ |
---|
| 109 | /** |
---|
| 110 | * A code value, from the set defined by the ExceptionCode enum, |
---|
| 111 | * indicating the type of error that occured. |
---|
| 112 | */ |
---|
| 113 | ExceptionCode code; |
---|
| 114 | |
---|
| 115 | /** |
---|
| 116 | * A string value. Applications may use this field to hold an error |
---|
| 117 | * message. The field value is not set by the DOM implementation, |
---|
| 118 | * meaning that the string will be empty when an exception is first |
---|
| 119 | * thrown. |
---|
| 120 | */ |
---|
| 121 | DOMString msg; |
---|
| 122 | //@} |
---|
| 123 | |
---|
| 124 | }; |
---|
| 125 | |
---|
| 126 | XERCES_CPP_NAMESPACE_END |
---|
| 127 | |
---|
| 128 | #endif |
---|
| 129 | |
---|