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: DOMUserDataHandler.hpp 527149 2007-04-10 14:56:39Z amassari $ 20 */ 21 22 #if !defined(XERCESC_INCLUDE_GUARD_DOMUSERDATAHANDLER_HPP) 23 #define XERCESC_INCLUDE_GUARD_DOMUSERDATAHANDLER_HPP 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>See also the <a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>Document Object Model (DOM) Level 3 Core Specification</a>. 38 * @since DOM Level 3 39 */ 40 class CDOM_EXPORT DOMUserDataHandler { 41 protected: 42 // ----------------------------------------------------------------------- 43 // Hidden constructors 44 // ----------------------------------------------------------------------- 45 /** @name Hidden constructors */ 46 //@{ DOMUserDataHandler()47 DOMUserDataHandler() {}; 48 //@} 49 50 private: 51 // ----------------------------------------------------------------------- 52 // Unimplemented constructors and operators 53 // ----------------------------------------------------------------------- 54 /** @name Unimplemented constructors and operators */ 55 //@{ 56 DOMUserDataHandler(const DOMUserDataHandler &); 57 DOMUserDataHandler & operator = (const DOMUserDataHandler &); 58 //@} 59 60 public: 61 // ----------------------------------------------------------------------- 62 // All constructors are hidden, just the destructor is available 63 // ----------------------------------------------------------------------- 64 /** @name Destructor */ 65 //@{ 66 /** 67 * Destructor 68 * 69 */ ~DOMUserDataHandler()70 virtual ~DOMUserDataHandler() {}; 71 //@} 72 73 // ----------------------------------------------------------------------- 74 // Class Types 75 // ----------------------------------------------------------------------- 76 /** @name Public Constants */ 77 //@{ 78 /** 79 * Operation Type 80 * 81 * <p><code>NODE_CLONED:</code> 82 * The node is cloned.</p> 83 * 84 * <p><code>NODE_IMPORTED</code> 85 * The node is imported.</p> 86 * 87 * <p><code>NODE_DELETED</code> 88 * The node is deleted.</p> 89 * 90 * <p><code>NODE_RENAMED</code> 91 * The node is renamed. 92 * 93 * <p><code>NODE_ADOPTED</code> 94 * The node is adopted. 95 * 96 * @since DOM Level 3 97 */ 98 enum DOMOperationType { 99 NODE_CLONED = 1, 100 NODE_IMPORTED = 2, 101 NODE_DELETED = 3, 102 NODE_RENAMED = 4, 103 NODE_ADOPTED = 5 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 * @param operation Specifies the type of operation that is being 118 * performed on the node. 119 * @param key Specifies the key for which this handler is being called. 120 * @param data Specifies the data for which this handler is being called. 121 * @param src Specifies the node being cloned, adopted, imported, or renamed. 122 * This is <code>null</code> when the node is being deleted. 123 * @param dst Specifies the node newly created if any, or <code>null</code>. 124 * 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 DOMNode* dst) = 0; 132 133 //@} 134 135 }; 136 137 XERCES_CPP_NAMESPACE_END 138 139 #endif 140 141