[2674] | 1 | #ifndef DOMUserDataHandler_HEADER_GUARD_ |
---|
| 2 | #define DOMUserDataHandler_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: DOMUserDataHandler.hpp 568078 2007-08-21 11:43:25Z amassari $ |
---|
| 23 | */ |
---|
| 24 | |
---|
| 25 | #include <xercesc/util/XercesDefs.hpp> |
---|
| 26 | #include <xercesc/dom/DOMNode.hpp> |
---|
| 27 | |
---|
| 28 | XERCES_CPP_NAMESPACE_BEGIN |
---|
| 29 | |
---|
| 30 | /** |
---|
| 31 | * When associating an object to a key on a node using <code>setUserData</code> |
---|
| 32 | * the application can provide a handler that gets called when the node the |
---|
| 33 | * object is associated to is being cloned or imported. This can be used by |
---|
| 34 | * the application to implement various behaviors regarding the data it |
---|
| 35 | * associates to the DOM nodes. This interface defines that handler. |
---|
| 36 | * |
---|
| 37 | * <p><b>"Experimental - subject to change"</b></p> |
---|
| 38 | * |
---|
| 39 | * <p>See also the <a href='http://www.w3.org/2001/07/WD-DOM-Level-3-Core-20010726'>Document Object Model (DOM) Level 3 Core Specification</a>. |
---|
| 40 | * @since DOM Level 3 |
---|
| 41 | */ |
---|
| 42 | class CDOM_EXPORT DOMUserDataHandler { |
---|
| 43 | protected: |
---|
| 44 | // ----------------------------------------------------------------------- |
---|
| 45 | // Hidden constructors |
---|
| 46 | // ----------------------------------------------------------------------- |
---|
| 47 | /** @name Hidden constructors */ |
---|
| 48 | //@{ |
---|
| 49 | DOMUserDataHandler() {}; |
---|
| 50 | //@} |
---|
| 51 | |
---|
| 52 | private: |
---|
| 53 | // ----------------------------------------------------------------------- |
---|
| 54 | // Unimplemented constructors and operators |
---|
| 55 | // ----------------------------------------------------------------------- |
---|
| 56 | /** @name Unimplemented constructors and operators */ |
---|
| 57 | //@{ |
---|
| 58 | DOMUserDataHandler(const DOMUserDataHandler &); |
---|
| 59 | DOMUserDataHandler & operator = (const DOMUserDataHandler &); |
---|
| 60 | //@} |
---|
| 61 | |
---|
| 62 | public: |
---|
| 63 | // ----------------------------------------------------------------------- |
---|
| 64 | // All constructors are hidden, just the destructor is available |
---|
| 65 | // ----------------------------------------------------------------------- |
---|
| 66 | /** @name Destructor */ |
---|
| 67 | //@{ |
---|
| 68 | /** |
---|
| 69 | * Destructor |
---|
| 70 | * |
---|
| 71 | */ |
---|
| 72 | virtual ~DOMUserDataHandler() {}; |
---|
| 73 | //@} |
---|
| 74 | |
---|
| 75 | // ----------------------------------------------------------------------- |
---|
| 76 | // Class Types |
---|
| 77 | // ----------------------------------------------------------------------- |
---|
| 78 | /** @name Public Constants */ |
---|
| 79 | //@{ |
---|
| 80 | /** |
---|
| 81 | * Operation Type |
---|
| 82 | * |
---|
| 83 | * <p><code>NODE_CLONED:</code> |
---|
| 84 | * The node is cloned.</p> |
---|
| 85 | * |
---|
| 86 | * <p><code>NODE_IMPORTED</code> |
---|
| 87 | * The node is imported.</p> |
---|
| 88 | * |
---|
| 89 | * <p><code>NODE_DELETED</code> |
---|
| 90 | * The node is deleted.</p> |
---|
| 91 | * |
---|
| 92 | * <p><code>NODE_RENAMED</code> |
---|
| 93 | * The node is renamed. |
---|
| 94 | * |
---|
| 95 | * <p><b>"Experimental - subject to change"</b></p> |
---|
| 96 | * |
---|
| 97 | * @since DOM Level 3 |
---|
| 98 | */ |
---|
| 99 | enum DOMOperationType { |
---|
| 100 | NODE_CLONED = 1, |
---|
| 101 | NODE_IMPORTED = 2, |
---|
| 102 | NODE_DELETED = 3, |
---|
| 103 | NODE_RENAMED = 4 |
---|
| 104 | }; |
---|
| 105 | //@} |
---|
| 106 | |
---|
| 107 | |
---|
| 108 | // ----------------------------------------------------------------------- |
---|
| 109 | // Virtual DOMUserDataHandler interface |
---|
| 110 | // ----------------------------------------------------------------------- |
---|
| 111 | /** @name Functions introduced in DOM Level 3 */ |
---|
| 112 | //@{ |
---|
| 113 | /** |
---|
| 114 | * This method is called whenever the node for which this handler is |
---|
| 115 | * registered is imported or cloned. |
---|
| 116 | * |
---|
| 117 | * <p><b>"Experimental - subject to change"</b></p> |
---|
| 118 | * |
---|
| 119 | * @param operation Specifies the type of operation that is being |
---|
| 120 | * performed on the node. |
---|
| 121 | * @param key Specifies the key for which this handler is being called. |
---|
| 122 | * @param data Specifies the data for which this handler is being called. |
---|
| 123 | * @param src Specifies the node being cloned, imported, or renamed. |
---|
| 124 | * @param dst Specifies the node newly created. |
---|
| 125 | * @since DOM Level 3 |
---|
| 126 | */ |
---|
| 127 | virtual void handle(DOMOperationType operation, |
---|
| 128 | const XMLCh* const key, |
---|
| 129 | void* data, |
---|
| 130 | const DOMNode* src, |
---|
| 131 | const DOMNode* dst) = 0; |
---|
| 132 | |
---|
| 133 | //@} |
---|
| 134 | |
---|
| 135 | }; |
---|
| 136 | |
---|
| 137 | XERCES_CPP_NAMESPACE_END |
---|
| 138 | |
---|
| 139 | #endif |
---|
| 140 | |
---|