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