Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.10

Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

XPathExecutionContextDefault.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(XPATHEXECUTIONCONTEXTDEFAULT_HEADER_GUARD_1357924680)
00017 #define XPATHEXECUTIONCONTEXTDEFAULT_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/Include/XalanObjectCache.hpp>
00027 #include <xalanc/Include/XalanVector.hpp>
00028 
00029 
00030 
00031 #include <xalanc/XalanDOM/XalanDOMString.hpp>
00032 
00033 
00034 
00038 // Base class include file.
00039 #include <xalanc/XPath/XPathExecutionContext.hpp>
00040 
00041 
00042 
00043 #include <xalanc/PlatformSupport/XalanDOMStringCache.hpp>
00044 
00045 
00046 
00047 #include <xalanc/XPath/MutableNodeRefList.hpp>
00048 #include <xalanc/XPath/XalanQNameByValue.hpp>
00049 
00050 
00051 
00052 XALAN_CPP_NAMESPACE_BEGIN
00053 
00054 
00055 
00056 class DOMSupport;
00057 class XPathEnvSupport;
00058 class XalanQName;
00059 
00060 
00061 
00065 class XALAN_XPATH_EXPORT XPathExecutionContextDefault : public XPathExecutionContext
00066 {
00067 public:
00068 
00069     typedef XalanVector<XalanNode*>             CurrentNodeStackType;
00070     typedef XalanVector<const NodeRefListBase*> ContextNodeListStackType;
00071     
00082     XPathExecutionContextDefault(
00083             XPathEnvSupport&        theXPathEnvSupport,
00084             DOMSupport&             theDOMSupport,
00085             XObjectFactory&         theXObjectFactory,
00086             XalanNode*              theCurrentNode = 0,
00087             const NodeRefListBase*  theContextNodeList = 0,
00088             const PrefixResolver*   thePrefixResolver = 0);
00089 
00099     explicit
00100     XPathExecutionContextDefault(
00101             MemoryManagerType&      theManager,
00102             XalanNode*              theCurrentNode = 0,
00103             const NodeRefListBase*  theContextNodeList = 0,
00104             const PrefixResolver*   thePrefixResolver = 0);
00105 
00106     static XPathExecutionContextDefault*
00107     create(
00108             MemoryManagerType&      theManager,
00109             XalanNode*              theCurrentNode = 0,
00110             const NodeRefListBase*  theContextNodeList = 0,
00111             const PrefixResolver*   thePrefixResolver = 0);
00112 
00113     virtual
00114     ~XPathExecutionContextDefault();
00115 
00116 
00122     XPathEnvSupport*
00123     getXPathEnvSupport() const
00124     {
00125         return m_xpathEnvSupport;
00126     }
00127 
00133     void
00134     setXPathEnvSupport(XPathEnvSupport*     theSupport)
00135     {
00136         m_xpathEnvSupport = theSupport;
00137     }
00138 
00144     void
00145     setDOMSupport(DOMSupport*   theDOMSupport)
00146     {
00147         m_domSupport = theDOMSupport;
00148     }
00149 
00155     void
00156     setXObjectFactory(XObjectFactory*   theXObjectFactory)
00157     {
00158         m_xobjectFactory = theXObjectFactory;
00159     }
00160 
00166     XalanQNameByValue&
00167     getScratchQName() const
00168     {
00169 #if defined(XALAN_NO_MUTABLE)
00170         return ((XPathExecutionContextDefault*)this)->m_scratchQName;
00171 #else
00172         return m_scratchQName;
00173 #endif
00174     }
00175 
00176     virtual void doFormatNumber(
00177             double                              number,
00178             const XalanDOMString&               pattern,
00179             const XalanDecimalFormatSymbols*    theDFS,
00180             XalanDOMString&                     theResult,
00181             const XalanNode*                    context = 0,
00182             const LocatorType*                  locator = 0);
00183 
00184     // These interfaces are inherited from XPathExecutionContext...
00185 
00186     virtual void
00187     reset();
00188 
00189     virtual XalanNode*
00190     getCurrentNode() const;
00191 
00192     virtual void
00193     pushCurrentNode(XalanNode*      theCurrentNode);
00194 
00195     virtual void
00196     popCurrentNode();
00197 
00198     virtual bool
00199     isNodeAfter(
00200             const XalanNode&    node1,
00201             const XalanNode&    node2) const;
00202 
00203     virtual void
00204     pushContextNodeList(const NodeRefListBase&  theList);
00205 
00206     virtual void    
00207     popContextNodeList();
00208 
00209     virtual const NodeRefListBase&
00210     getContextNodeList() const;
00211 
00212     virtual size_type
00213     getContextNodeListLength() const;
00214 
00215     virtual size_type
00216     getContextNodeListPosition(const XalanNode&     contextNode) const;
00217 
00218     virtual bool
00219     elementAvailable(const XalanQName&  theQName) const;
00220 
00221     virtual bool
00222     elementAvailable(
00223             const XalanDOMString&   theName,
00224             const LocatorType*      locator) const;
00225 
00226     virtual bool
00227     functionAvailable(const XalanQName&     theQName) const;
00228 
00229     virtual bool
00230     functionAvailable(
00231             const XalanDOMString&   theName,
00232             const LocatorType*      locator) const;
00233 
00234     virtual const XObjectPtr
00235     extFunction(
00236             const XalanDOMString&           theNamespace,
00237             const XalanDOMString&           functionName,
00238             XalanNode*                      context,
00239             const XObjectArgVectorType&     argVec,
00240             const LocatorType*              locator);
00241 
00242     virtual XalanDocument*
00243     parseXML(
00244             MemoryManagerType&      theManager,
00245             const XalanDOMString&   urlString,
00246             const XalanDOMString&   base) const;
00247 
00248     virtual MutableNodeRefList*
00249     borrowMutableNodeRefList();
00250 
00251     virtual bool
00252     returnMutableNodeRefList(MutableNodeRefList*    theList);
00253 
00254     virtual MutableNodeRefList*
00255     createMutableNodeRefList(MemoryManagerType& theManager) const;
00256 
00257     virtual XalanDOMString&
00258     getCachedString();
00259 
00260     virtual bool
00261     releaseCachedString(XalanDOMString&     theString);
00262 
00263     virtual void
00264     getNodeSetByKey(
00265             XalanDocument*          doc,
00266             const XalanQName&       qname,
00267             const XalanDOMString&   ref,
00268             MutableNodeRefList&     nodelist);
00269 
00270     virtual void
00271     getNodeSetByKey(
00272             XalanDocument*          doc,
00273             const XalanDOMString&   name,
00274             const XalanDOMString&   ref,
00275             const LocatorType*      locator,
00276             MutableNodeRefList&     nodelist);
00277 
00278     virtual const XObjectPtr
00279     getVariable(
00280             const XalanQName&   name,
00281             const LocatorType*  locator = 0);
00282 
00283     virtual const PrefixResolver*
00284     getPrefixResolver() const;
00285 
00286     virtual void
00287     setPrefixResolver(const PrefixResolver*     thePrefixResolver);
00288 
00289     virtual const XalanDOMString*
00290     getNamespaceForPrefix(const XalanDOMString&     prefix) const;
00291 
00292     virtual const XalanDOMString&
00293     findURIFromDoc(const XalanDocument*     owner) const;
00294 
00295     virtual const XalanDOMString&
00296     getUnparsedEntityURI(
00297             const XalanDOMString&   theName,
00298             const XalanDocument&    theDocument) const;
00299 
00300     virtual bool
00301     shouldStripSourceNode(const XalanText&  node);
00302 
00303     virtual XalanDocument*
00304     getSourceDocument(const XalanDOMString&     theURI) const;
00305 
00306     virtual void
00307     setSourceDocument(
00308             const XalanDOMString&   theURI,
00309             XalanDocument*          theDocument);
00310 
00311     // These interfaces are inherited from ExecutionContext...
00312 
00313     virtual void formatNumber(
00314             double                              number,
00315             const XalanDOMString&               pattern,
00316             XalanDOMString&                     theResult,
00317             const XalanNode*                    context = 0,
00318             const LocatorType*                  locator = 0);
00319 
00320     virtual void formatNumber(
00321             double                              number,
00322             const XalanDOMString&               pattern,
00323             const XalanDOMString&               dfsName,
00324             XalanDOMString&                     theResult,
00325             const XalanNode*                    context = 0,
00326             const LocatorType*                  locator = 0);
00327 
00328 
00329     virtual void
00330     error(
00331             const XalanDOMString&   msg,
00332             const XalanNode*        sourceNode = 0,
00333             const LocatorType*      locator = 0) const;
00334 
00335     virtual void
00336     warn(
00337             const XalanDOMString&   msg,
00338             const XalanNode*        sourceNode = 0,
00339             const LocatorType*      locator = 0) const;
00340 
00341     virtual void
00342     message(
00343             const XalanDOMString&   msg,
00344             const XalanNode*        sourceNode = 0,
00345             const LocatorType*      locator = 0) const;
00346 
00347 protected:
00348 
00349     typedef XalanObjectCache<MutableNodeRefList, DefaultCacheCreateFunctorMemMgr<MutableNodeRefList>, DeleteFunctor<MutableNodeRefList>, ClearCacheResetFunctor<MutableNodeRefList> >   NodeListCacheType;
00350 
00351     enum { eNodeListCacheListSize = 50 };
00352 
00353     struct ContextNodeListPositionCache
00354     {
00355         ContextNodeListPositionCache() :
00356             m_node(0),
00357             m_index(0)
00358         {
00359         }
00360 
00361         void
00362         clear()
00363         {
00364             if (m_node != 0)
00365             {
00366                 m_node = 0;
00367             }
00368         }
00369 
00370         const XalanNode*    m_node;
00371 
00372         size_type           m_index;
00373     };
00374 
00375     XPathEnvSupport*                        m_xpathEnvSupport;
00376 
00377     DOMSupport*                             m_domSupport;
00378 
00379     CurrentNodeStackType                    m_currentNodeStack;
00380 
00381     ContextNodeListStackType                m_contextNodeListStack;
00382 
00383     const PrefixResolver*                   m_prefixResolver;
00384 
00385     XalanDOMString                          m_currentPattern;
00386 
00387     NodeListCacheType                       m_nodeListCache;
00388 
00389     XalanDOMStringCache                     m_stringCache;
00390 
00391     mutable ContextNodeListPositionCache    m_cachedPosition;
00392 
00393     mutable XalanQNameByValue               m_scratchQName;
00394 
00395     static const NodeRefList                s_dummyList;
00396 };
00397 
00398 
00399 
00400 XALAN_CPP_NAMESPACE_END
00401 
00402 
00403 
00404 #endif  // XPATHEXECUTIONCONTEXTDEFAULT_HEADER_GUARD_1357924680

Interpreting class diagrams

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

dot

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

Apache Logo