Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.9

Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

XPathConstructionContext.hpp

Go to the documentation of this file.
00001 /*
00002  * Copyright 1999-2004 The Apache Software Foundation.
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 #if !defined(XPATHCONSTRUCTIONCONTEXT_HEADER_GUARD_1357924680)
00017 #define XPATHCONSTRUCTIONCONTEXT_HEADER_GUARD_1357924680
00018 
00019 
00020 
00021 // Base include file.  Must be first.
00022 #include <xalanc/XPath/XPathDefinitions.hpp>
00023 
00024 
00025 
00026 #include <xalanc/XalanDOM/XalanDOMString.hpp>
00027 
00028 
00029 
00030 XALAN_DECLARE_XERCES_CLASS(Locator)
00031 
00032 
00033 
00034 XALAN_CPP_NAMESPACE_BEGIN
00035 
00036 
00037 
00038 typedef XERCES_CPP_NAMESPACE_QUALIFIER Locator  LocatorType;
00039 
00040 
00041 
00042 class XalanNode;
00043 
00044 
00045 
00046 //
00050 // An abstract class which provides support for constructing the internal
00051 // representation  of a stylesheet.
00052 //
00053 class XALAN_XPATH_EXPORT XPathConstructionContext
00054 {
00055 public:
00056 
00057     XPathConstructionContext(MemoryManagerType&              theManager);
00058 
00059     virtual
00060     ~XPathConstructionContext();
00061 
00062 
00067     virtual void
00068     reset() = 0;
00069 
00079     virtual const XalanDOMString&
00080     getPooledString(const XalanDOMString&   theString) = 0;
00081 
00092     virtual const XalanDOMString&
00093     getPooledString(
00094             const XalanDOMChar*         theString,
00095             XalanDOMString::size_type   theLength = XalanDOMString::npos) = 0;
00096 
00102     virtual XalanDOMString&
00103     getCachedString() = 0;
00104 
00112     virtual bool
00113     releaseCachedString(XalanDOMString&     theString) = 0;
00114 
00115     class GetAndReleaseCachedString
00116     {
00117     public:
00118 
00119         GetAndReleaseCachedString(XPathConstructionContext&     theConstructionContext) :
00120             m_constructionContext(&theConstructionContext),
00121             m_string(&theConstructionContext.getCachedString())
00122         {
00123         }
00124 
00125         // Note non-const copy semantics...
00126         GetAndReleaseCachedString(GetAndReleaseCachedString&    theSource) :
00127             m_constructionContext(theSource.m_constructionContext),
00128             m_string(theSource.m_string)
00129         {
00130             theSource.m_string = 0;
00131         }
00132 
00133         ~GetAndReleaseCachedString()
00134         {
00135             if (m_string != 0)
00136             {
00137                 m_constructionContext->releaseCachedString(*m_string);
00138             }
00139         }
00140 
00141         XalanDOMString&
00142         get() const
00143         {
00144             assert(m_string != 0);
00145 
00146             return *m_string;
00147         }
00148 
00149         XPathConstructionContext&
00150         getConstructionContext() const
00151         {
00152             return *m_constructionContext;
00153         }
00154 
00155 
00156     private:
00157 
00158         // Not implemented...
00159         GetAndReleaseCachedString&
00160         operator=(const GetAndReleaseCachedString&);
00161 
00162 
00163         // Data members...
00164         XPathConstructionContext*   m_constructionContext;
00165 
00166         XalanDOMString*             m_string;
00167     };
00168 
00169     MemoryManagerType&
00170     getMemoryManager()
00171     {
00172         return m_memoryManager;
00173     }
00174 
00175     virtual void
00176     error(
00177             const XalanDOMString&   msg,
00178             const XalanNode*        sourceNode,
00179             const LocatorType*      locator) const = 0;
00180 
00181     virtual void
00182     warn(
00183             const XalanDOMString&   msg,
00184             const XalanNode*        sourceNode,
00185             const LocatorType*      locator) const = 0;
00186 
00187     MemoryManagerType&              m_memoryManager;
00188 };
00189 
00190 
00191 
00192 XALAN_CPP_NAMESPACE_END
00193 
00194 
00195 
00196 #endif  // XPATHCONSTRUCTIONCONTEXT_HEADER_GUARD_1357924680

Interpreting class diagrams

Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.

Xalan-C++ XSLT Processor Version 1.9
Copyright © 1999-2004 The Apache Software Foundation. All Rights Reserved.