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 * Extension of AbstractXMLObject that adds DOM caching methods
\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 * Extension of AbstractXMLObject that adds DOM caching methods
\r
38 class XMLTOOL_API AbstractDOMCachingXMLObject : public virtual AbstractXMLObject
\r
41 virtual ~AbstractDOMCachingXMLObject();
\r
43 DOMElement* getDOM() const {
\r
47 void setDOM(DOMElement* dom, bool bindDocument=false) const;
\r
49 void setDocument(DOMDocument* doc) const {
\r
51 m_document->release();
\r
55 virtual void releaseDOM() const;
\r
57 virtual void releaseParentDOM(bool propagateRelease=true) const;
\r
59 virtual void releaseChildrenDOM(bool propagateRelease=true) const;
\r
61 XMLObject* clone() const;
\r
64 AbstractDOMCachingXMLObject() : m_dom(NULL), m_document(NULL) {}
\r
66 /** Copy constructor. */
\r
67 AbstractDOMCachingXMLObject(const AbstractDOMCachingXMLObject& src)
\r
68 : AbstractXMLObject(src), m_dom(NULL), m_document(NULL) {}
\r
71 * If a DOM representation exists, this clones it into a new document.
\r
73 * @param doc the document to clone into, or NULL, in which case a new document is created
\r
74 * @return the cloned DOM
\r
76 DOMElement* cloneDOM(DOMDocument* doc=NULL) const;
\r
79 mutable DOMElement* m_dom;
\r
80 mutable DOMDocument* m_document;
\r
85 #if defined (_MSC_VER)
\r
86 #pragma warning( pop )
\r
89 #endif /* __xmltooling_abstractdomxmlobj_h__ */
\r