2 * Copyright 2001-2006 Internet2
\r
4 * Licensed under the Apache License, Version 2.0 (the "License");
\r
5 * you may not use this file except in compliance with the License.
\r
6 * You may obtain a copy of the License at
\r
8 * http://www.apache.org/licenses/LICENSE-2.0
\r
10 * Unless required by applicable law or agreed to in writing, software
\r
11 * distributed under the License is distributed on an "AS IS" BASIS,
\r
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
13 * See the License for the specific language governing permissions and
\r
14 * limitations under the License.
\r
18 * @file AbstractDOMCachingXMLObject.h
\r
20 * AbstractXMLObject mixin that implements DOM caching
\r
23 #if !defined(__xmltooling_abstractdomxmlobj_h__)
\r
24 #define __xmltooling_abstractdomxmlobj_h__
\r
26 #include <xmltooling/AbstractXMLObject.h>
\r
28 #if defined (_MSC_VER)
\r
29 #pragma warning( push )
\r
30 #pragma warning( disable : 4250 4251 )
\r
33 namespace xmltooling {
\r
36 * AbstractXMLObject mixin that implements DOM caching.
\r
37 * Inherit from this class to implement standard DOM caching behavior.
\r
39 class XMLTOOL_API AbstractDOMCachingXMLObject : public virtual AbstractXMLObject
\r
42 virtual ~AbstractDOMCachingXMLObject();
\r
44 DOMElement* getDOM() const {
\r
48 void setDOM(DOMElement* dom, bool bindDocument=false) const;
\r
50 void setDocument(DOMDocument* doc) const {
\r
52 m_document->release();
\r
56 virtual void releaseDOM() const;
\r
58 virtual void releaseParentDOM(bool propagateRelease=true) const;
\r
60 virtual void releaseChildrenDOM(bool propagateRelease=true) const;
\r
62 XMLObject* clone() const;
\r
65 AbstractDOMCachingXMLObject() : m_dom(NULL), m_document(NULL) {}
\r
67 /** Copy constructor. */
\r
68 AbstractDOMCachingXMLObject(const AbstractDOMCachingXMLObject& src)
\r
69 : AbstractXMLObject(src), m_dom(NULL), m_document(NULL) {}
\r
72 * If a DOM representation exists, this clones it into a new document.
\r
74 * @param doc the document to clone into, or NULL, in which case a new document is created
\r
75 * @return the cloned DOM
\r
77 DOMElement* cloneDOM(DOMDocument* doc=NULL) const;
\r
80 mutable DOMElement* m_dom;
\r
81 mutable DOMDocument* m_document;
\r
86 #if defined (_MSC_VER)
\r
87 #pragma warning( pop )
\r
90 #endif /* __xmltooling_abstractdomxmlobj_h__ */
\r