2 * Copyright 2001-2009 Internet2
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 * @file xmltooling/AbstractDOMCachingXMLObject.h
20 * AbstractXMLObject mixin that implements DOM caching
23 #ifndef __xmltooling_abstractdomxmlobj_h__
24 #define __xmltooling_abstractdomxmlobj_h__
26 #include <xmltooling/AbstractXMLObject.h>
28 #if defined (_MSC_VER)
29 #pragma warning( push )
30 #pragma warning( disable : 4250 4251 )
33 namespace xmltooling {
36 * AbstractXMLObject mixin that implements DOM caching.
37 * Inherit from this class to implement standard DOM caching behavior.
39 class XMLTOOL_API AbstractDOMCachingXMLObject : public virtual AbstractXMLObject
42 virtual ~AbstractDOMCachingXMLObject();
44 // Virtual function overrides.
45 xercesc::DOMElement* getDOM() const;
46 void setDOM(xercesc::DOMElement* dom, bool bindDocument=false) const;
47 void setDocument(xercesc::DOMDocument* doc) const;
48 void releaseDOM() const;
49 void releaseParentDOM(bool propagateRelease=true) const;
50 void releaseChildrenDOM(bool propagateRelease=true) const;
51 XMLObject* clone() const;
55 AbstractDOMCachingXMLObject();
57 /** Copy constructor. */
58 AbstractDOMCachingXMLObject(const AbstractDOMCachingXMLObject& src);
61 * If a DOM representation exists, this clones it into a new document.
63 * @param doc the document to clone into, or NULL, in which case a new document is created
64 * @return the cloned DOM
66 xercesc::DOMElement* cloneDOM(xercesc::DOMDocument* doc=NULL) const;
69 mutable xercesc::DOMElement* m_dom;
70 mutable xercesc::DOMDocument* m_document;
75 #if defined (_MSC_VER)
76 #pragma warning( pop )
79 #endif /* __xmltooling_abstractdomxmlobj_h__ */