Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.8

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

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 <deque>
00027 
00028 
00029 
00030 #include <xalanc/Include/XalanObjectCache.hpp>
00031 
00032 
00033 
00034 #include <xalanc/XalanDOM/XalanDOMString.hpp>
00035 
00036 
00037 
00041 // Base class include file.
00042 #include <xalanc/XPath/XPathExecutionContext.hpp>
00043 
00044 
00045 
00046 #include <xalanc/PlatformSupport/XalanDOMStringCache.hpp>
00047 
00048 
00049 
00050 #include <xalanc/XPath/MutableNodeRefList.hpp>
00051 #include <xalanc/XPath/XalanQNameByValue.hpp>
00052 
00053 
00054 
00055 XALAN_CPP_NAMESPACE_BEGIN
00056 
00057 
00058 
00059 class DOMSupport;
00060 class XPathEnvSupport;
00061 class XalanQName;
00062 
00063 
00064 
00068 class XALAN_XPATH_EXPORT XPathExecutionContextDefault : public XPathExecutionContext
00069 {
00070 public:
00071 
00072 #if defined(XALAN_NO_STD_NAMESPACE)
00073     typedef deque<XalanNode*>               CurrentNodeStackType;
00074     typedef deque<const NodeRefListBase*>   ContextNodeListStackType;
00075 #else
00076     typedef std::deque<XalanNode*>              CurrentNodeStackType;
00077     typedef std::deque<const NodeRefListBase*>  ContextNodeListStackType;
00078 #endif
00079 
00090     XPathExecutionContextDefault(
00091             XPathEnvSupport&        theXPathEnvSupport,
00092             DOMSupport&             theDOMSupport,
00093             XObjectFactory&         theXObjectFactory,
00094             XalanNode*              theCurrentNode = 0,
00095             const NodeRefListBase*  theContextNodeList = 0,
00096             const PrefixResolver*   thePrefixResolver = 0);
00097 
00107     explicit
00108     XPathExecutionContextDefault(
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             const XalanDOMString&   urlString,
00245             const XalanDOMString&   base) const;
00246 
00247     virtual MutableNodeRefList*
00248     borrowMutableNodeRefList();
00249 
00250     virtual bool
00251     returnMutableNodeRefList(MutableNodeRefList*    theList);
00252 
00253     virtual MutableNodeRefList*
00254     createMutableNodeRefList() const;
00255 
00256     virtual XalanDOMString&
00257     getCachedString();
00258 
00259     virtual bool
00260     releaseCachedString(XalanDOMString&     theString);
00261 
00262     virtual void
00263     getNodeSetByKey(
00264             XalanDocument*          doc,
00265             const XalanQName&       qname,
00266             const XalanDOMString&   ref,
00267             MutableNodeRefList&     nodelist);
00268 
00269     virtual void
00270     getNodeSetByKey(
00271             XalanDocument*          doc,
00272             const XalanDOMString&   name,
00273             const XalanDOMString&   ref,
00274             const LocatorType*      locator,
00275             MutableNodeRefList&     nodelist);
00276 
00277     virtual const XObjectPtr
00278     getVariable(
00279             const XalanQName&   name,
00280             const LocatorType*  locator = 0);
00281 
00282     virtual const PrefixResolver*
00283     getPrefixResolver() const;
00284 
00285     virtual void
00286     setPrefixResolver(const PrefixResolver*     thePrefixResolver);
00287 
00288     virtual const XalanDOMString*
00289     getNamespaceForPrefix(const XalanDOMString&     prefix) const;
00290 
00291     virtual XalanDOMString
00292     findURIFromDoc(const XalanDocument*     owner) const;
00293 
00294     virtual const XalanDOMString&
00295     getUnparsedEntityURI(
00296             const XalanDOMString&       theName,
00297             const XalanDocument&        theDocument) const;
00298 
00299     virtual bool
00300     shouldStripSourceNode(const XalanText&  node);
00301 
00302     virtual XalanDocument*
00303     getSourceDocument(const XalanDOMString&     theURI) const;
00304 
00305     virtual void
00306     setSourceDocument(
00307             const XalanDOMString&   theURI,
00308             XalanDocument*          theDocument);
00309 
00310     // These interfaces are inherited from ExecutionContext...
00311 
00312     virtual void formatNumber(
00313             double                              number,
00314             const XalanDOMString&               pattern,
00315             XalanDOMString&                     theResult,
00316             const XalanNode*                    context = 0,
00317             const LocatorType*                  locator = 0);
00318 
00319     virtual void formatNumber(
00320             double                              number,
00321             const XalanDOMString&               pattern,
00322             const XalanDOMString&               dfsName,
00323             XalanDOMString&                     theResult,
00324             const XalanNode*                    context = 0,
00325             const LocatorType*                  locator = 0);
00326 
00327 
00328     virtual void
00329     error(
00330             const XalanDOMString&   msg,
00331             const XalanNode*        sourceNode = 0,
00332             const LocatorType*      locator = 0) const;
00333 
00334     virtual void
00335     error(
00336             const char*         msg,
00337             const XalanNode*    sourceNode = 0,
00338             const LocatorType*  locator = 0) const;
00339 
00340     virtual void
00341     warn(
00342             const XalanDOMString&   msg,
00343             const XalanNode*        sourceNode = 0,
00344             const LocatorType*      locator = 0) const;
00345 
00346     virtual void
00347     warn(
00348             const char*         msg,
00349             const XalanNode*    sourceNode = 0,
00350             const LocatorType*  locator = 0) const;
00351 
00352     virtual void
00353     message(
00354             const XalanDOMString&   msg,
00355             const XalanNode*        sourceNode = 0,
00356             const LocatorType*      locator = 0) const;
00357 
00358     virtual void
00359     message(
00360             const char*         msg,
00361             const XalanNode*    sourceNode = 0,
00362             const LocatorType*  locator = 0) const;
00363 
00364 protected:
00365 
00366     typedef XalanObjectCache<MutableNodeRefList, DefaultCacheCreateFunctor<MutableNodeRefList>, DeleteFunctor<MutableNodeRefList>, ClearCacheResetFunctor<MutableNodeRefList> > NodeListCacheType;
00367 
00368     enum { eNodeListCacheListSize = 50 };
00369 
00370     struct ContextNodeListPositionCache
00371     {
00372         ContextNodeListPositionCache() :
00373             m_node(0),
00374             m_index(0)
00375         {
00376         }
00377 
00378         void
00379         clear()
00380         {
00381             if (m_node != 0)
00382             {
00383                 m_node = 0;
00384             }
00385         }
00386 
00387         const XalanNode*    m_node;
00388 
00389         size_type           m_index;
00390     };
00391 
00392     XPathEnvSupport*                        m_xpathEnvSupport;
00393 
00394     DOMSupport*                             m_domSupport;
00395 
00396     CurrentNodeStackType                    m_currentNodeStack;
00397 
00398     ContextNodeListStackType                m_contextNodeListStack;
00399 
00400     const PrefixResolver*                   m_prefixResolver;
00401 
00402     XalanDOMString                          m_currentPattern;
00403 
00404     NodeListCacheType                       m_nodeListCache;
00405 
00406     XalanDOMStringCache                     m_stringCache;
00407 
00408     mutable ContextNodeListPositionCache    m_cachedPosition;
00409 
00410     mutable XalanQNameByValue               m_scratchQName;
00411 
00412     static const NodeRefList    s_dummyList;
00413 };
00414 
00415 
00416 
00417 XALAN_CPP_NAMESPACE_END
00418 
00419 
00420 
00421 #endif  // XPATHEXECUTIONCONTEXTDEFAULT_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.8
Copyright © 1999-2004 The Apache Software Foundation. All Rights Reserved.