Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.6

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  * The Apache Software License, Version 1.1
00003  *
00004  *
00005  * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights 
00006  * reserved.
00007  *
00008  * Redistribution and use in source and binary forms, with or without
00009  * modification, are permitted provided that the following conditions
00010  * are met:
00011  *
00012  * 1. Redistributions of source code must retain the above copyright
00013  *    notice, this list of conditions and the following disclaimer. 
00014  *
00015  * 2. Redistributions in binary form must reproduce the above copyright
00016  *    notice, this list of conditions and the following disclaimer in
00017  *    the documentation and/or other materials provided with the
00018  *    distribution.
00019  *
00020  * 3. The end-user documentation included with the redistribution,
00021  *    if any, must include the following acknowledgment:  
00022  *       "This product includes software developed by the
00023  *        Apache Software Foundation (http://www.apache.org/)."
00024  *    Alternately, this acknowledgment may appear in the software itself,
00025  *    if and wherever such third-party acknowledgments normally appear.
00026  *
00027  * 4. The names "Xalan" and "Apache Software Foundation" must
00028  *    not be used to endorse or promote products derived from this
00029  *    software without prior written permission. For written 
00030  *    permission, please contact apache@apache.org.
00031  *
00032  * 5. Products derived from this software may not be called "Apache",
00033  *    nor may "Apache" appear in their name, without prior written
00034  *    permission of the Apache Software Foundation.
00035  *
00036  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
00037  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00038  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00039  * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
00040  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00041  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00042  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
00043  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00044  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00045  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
00046  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00047  * SUCH DAMAGE.
00048  * ====================================================================
00049  *
00050  * This software consists of voluntary contributions made by many
00051  * individuals on behalf of the Apache Software Foundation and was
00052  * originally based on software copyright (c) 1999, International
00053  * Business Machines, Inc., http://www.ibm.com.  For more
00054  * information on the Apache Software Foundation, please see
00055  * <http://www.apache.org/>.
00056  *
00057  * $ Id: $
00058  *
00059  *
00060  * @author <a href="mailto:david_n_bertoni@lotus.com">David N. Bertoni</a>
00061  */
00062 #if !defined(XPATHEXECUTIONCONTEXTDEFAULT_HEADER_GUARD_1357924680)
00063 #define XPATHEXECUTIONCONTEXTDEFAULT_HEADER_GUARD_1357924680
00064 
00065 
00066 
00067 // Base include file.  Must be first.
00068 #include <xalanc/XPath/XPathDefinitions.hpp>
00069 
00070 
00071 
00072 #include <deque>
00073 
00074 
00075 
00076 #include <xalanc/Include/XalanObjectCache.hpp>
00077 
00078 
00079 
00080 #include <xalanc/XalanDOM/XalanDOMString.hpp>
00081 
00082 
00083 
00084 // Base class include file.
00085 #include <xalanc/XPath/XPathExecutionContext.hpp>
00086 
00087 
00088 
00089 #include <xalanc/PlatformSupport/XalanDOMStringCache.hpp>
00090 
00091 
00092 
00093 #include <xalanc/XPath/MutableNodeRefList.hpp>
00094 #include <xalanc/XPath/XalanQNameByValue.hpp>
00095 
00096 
00097 
00098 XALAN_CPP_NAMESPACE_BEGIN
00099 
00100 
00101 
00102 class DOMSupport;
00103 class XPathEnvSupport;
00104 class XalanQName;
00105 
00106 
00107 
00111 class XALAN_XPATH_EXPORT XPathExecutionContextDefault : public XPathExecutionContext
00112 {
00113 public:
00114     
00125     XPathExecutionContextDefault(
00126             XPathEnvSupport&        theXPathEnvSupport,
00127             DOMSupport&             theDOMSupport,
00128             XObjectFactory&         theXObjectFactory,
00129             XalanNode*              theCurrentNode = 0,
00130             const NodeRefListBase*  theContextNodeList = 0,
00131             const PrefixResolver*   thePrefixResolver = 0);
00132 
00142     explicit
00143     XPathExecutionContextDefault(
00144             XalanNode*              theCurrentNode = 0,
00145             const NodeRefListBase*  theContextNodeList = 0,
00146             const PrefixResolver*   thePrefixResolver = 0);
00147 
00148     virtual
00149     ~XPathExecutionContextDefault();
00150 
00151 
00157     XPathEnvSupport*
00158     getXPathEnvSupport() const
00159     {
00160         return m_xpathEnvSupport;
00161     }
00162 
00168     void
00169     setXPathEnvSupport(XPathEnvSupport*     theSupport)
00170     {
00171         m_xpathEnvSupport = theSupport;
00172     }
00173 
00179     void
00180     setDOMSupport(DOMSupport*   theDOMSupport)
00181     {
00182         m_domSupport = theDOMSupport;
00183     }
00184 
00190     void
00191     setXObjectFactory(XObjectFactory*   theXObjectFactory)
00192     {
00193         m_xobjectFactory = theXObjectFactory;
00194     }
00195 
00201     XalanQNameByValue&
00202     getScratchQName() const
00203     {
00204 #if defined(XALAN_NO_MUTABLE)
00205         return ((XPathExecutionContextDefault*)this)->m_scratchQName;
00206 #else
00207         return m_scratchQName;
00208 #endif
00209     }
00210 
00211     // These interfaces are inherited from XPathExecutionContext...
00212 
00213     virtual void
00214     reset();
00215 
00216     virtual XalanNode*
00217     getCurrentNode() const;
00218 
00219     virtual void
00220     setCurrentNode(XalanNode*       theCurrentNode);
00221 
00222     virtual bool
00223     isNodeAfter(
00224             const XalanNode&    node1,
00225             const XalanNode&    node2) const;
00226 
00227     virtual const NodeRefListBase&
00228     getContextNodeList() const;
00229 
00230     virtual void    
00231     setContextNodeList(const NodeRefListBase&   theList);
00232 
00233     virtual size_type
00234     getContextNodeListLength() const;
00235 
00236     virtual size_type
00237     getContextNodeListPosition(const XalanNode&     contextNode) const;
00238 
00239     virtual bool
00240     elementAvailable(const XalanQName&  theQName) const;
00241 
00242     virtual bool
00243     elementAvailable(
00244             const XalanDOMString&   theName,
00245             const LocatorType*      locator) const;
00246 
00247     virtual bool
00248     functionAvailable(const XalanQName&     theQName) const;
00249 
00250     virtual bool
00251     functionAvailable(
00252             const XalanDOMString&   theName,
00253             const LocatorType*      locator) const;
00254 
00255     virtual const XObjectPtr
00256     extFunction(
00257             const XalanDOMString&           theNamespace,
00258             const XalanDOMString&           functionName,
00259             XalanNode*                      context,
00260             const XObjectArgVectorType&     argVec,
00261             const LocatorType*              locator);
00262 
00263     virtual XalanDocument*
00264     parseXML(
00265             const XalanDOMString&   urlString,
00266             const XalanDOMString&   base) const;
00267 
00268     virtual MutableNodeRefList*
00269     borrowMutableNodeRefList();
00270 
00271     virtual bool
00272     returnMutableNodeRefList(MutableNodeRefList*    theList);
00273 
00274     virtual MutableNodeRefList*
00275     createMutableNodeRefList() const;
00276 
00277     virtual XalanDOMString&
00278     getCachedString();
00279 
00280     virtual bool
00281     releaseCachedString(XalanDOMString&     theString);
00282 
00283     virtual void
00284     getNodeSetByKey(
00285             XalanDocument*          doc,
00286             const XalanQName&       qname,
00287             const XalanDOMString&   ref,
00288             MutableNodeRefList&     nodelist);
00289 
00290     virtual void
00291     getNodeSetByKey(
00292             XalanDocument*          doc,
00293             const XalanDOMString&   name,
00294             const XalanDOMString&   ref,
00295             const LocatorType*      locator,
00296             MutableNodeRefList&     nodelist);
00297 
00298     virtual const XObjectPtr
00299     getVariable(
00300             const XalanQName&   name,
00301             const LocatorType*  locator = 0);
00302 
00303     virtual const PrefixResolver*
00304     getPrefixResolver() const;
00305 
00306     virtual void
00307     setPrefixResolver(const PrefixResolver*     thePrefixResolver);
00308 
00309     virtual const XalanDOMString*
00310     getNamespaceForPrefix(const XalanDOMString&     prefix) const;
00311 
00312     virtual XalanDOMString
00313     findURIFromDoc(const XalanDocument*     owner) const;
00314 
00315     virtual const XalanDOMString&
00316     getUnparsedEntityURI(
00317             const XalanDOMString&       theName,
00318             const XalanDocument&        theDocument) const;
00319 
00320     virtual bool
00321     shouldStripSourceNode(const XalanNode&  node);
00322 
00323     virtual bool
00324     getThrowFoundIndex() const;
00325 
00326     virtual void
00327     setThrowFoundIndex(bool     fThrow);
00328 
00329     virtual XalanDocument*
00330     getSourceDocument(const XalanDOMString&     theURI) const;
00331 
00332     virtual void
00333     setSourceDocument(
00334             const XalanDOMString&   theURI,
00335             XalanDocument*          theDocument);
00336 
00337     virtual const XalanDecimalFormatSymbols*
00338     getDecimalFormatSymbols(const XalanQName&   qname);
00339 
00340 
00341     // These interfaces are inherited from ExecutionContext...
00342 
00343     virtual void
00344     error(
00345             const XalanDOMString&   msg,
00346             const XalanNode*        sourceNode = 0,
00347             const LocatorType*      locator = 0) const;
00348 
00349     virtual void
00350     error(
00351             const char*         msg,
00352             const XalanNode*    sourceNode = 0,
00353             const LocatorType*  locator = 0) const;
00354 
00355     virtual void
00356     warn(
00357             const XalanDOMString&   msg,
00358             const XalanNode*        sourceNode = 0,
00359             const LocatorType*      locator = 0) const;
00360 
00361     virtual void
00362     warn(
00363             const char*         msg,
00364             const XalanNode*    sourceNode = 0,
00365             const LocatorType*  locator = 0) const;
00366 
00367     virtual void
00368     message(
00369             const XalanDOMString&   msg,
00370             const XalanNode*        sourceNode = 0,
00371             const LocatorType*      locator = 0) const;
00372 
00373     virtual void
00374     message(
00375             const char*         msg,
00376             const XalanNode*    sourceNode = 0,
00377             const LocatorType*  locator = 0) const;
00378 
00379 protected:
00380 
00381     typedef XalanObjectCache<MutableNodeRefList, DefaultCacheCreateFunctor<MutableNodeRefList>, DeleteFunctor<MutableNodeRefList>, ClearCacheResetFunctor<MutableNodeRefList> > NodeListCacheType;
00382 
00383     enum { eNodeListCacheListSize = 50 };
00384 
00385     struct ContextNodeListPositionCache
00386     {
00387         ContextNodeListPositionCache() :
00388             m_node(0),
00389             m_index(0)
00390         {
00391         }
00392 
00393         void
00394         clear()
00395         {
00396             if (m_node != 0)
00397             {
00398                 m_node = 0;
00399             }
00400         }
00401 
00402         const XalanNode*    m_node;
00403 
00404         size_type           m_index;
00405     };
00406 
00407     XPathEnvSupport*                        m_xpathEnvSupport;
00408 
00409     DOMSupport*                             m_domSupport;
00410 
00411     XalanNode*                              m_currentNode;
00412 
00413     const NodeRefListBase*                  m_contextNodeList;
00414 
00415     const PrefixResolver*                   m_prefixResolver;
00416 
00417     bool                                    m_throwFoundIndex;
00418 
00419     XalanDOMString                          m_currentPattern;
00420 
00421     NodeListCacheType                       m_nodeListCache;
00422 
00423     XalanDOMStringCache                     m_stringCache;
00424 
00425     mutable ContextNodeListPositionCache    m_cachedPosition;
00426 
00427     mutable XalanQNameByValue               m_scratchQName;
00428 
00429     static const NodeRefList    s_dummyList;
00430 };
00431 
00432 
00433 
00434 XALAN_CPP_NAMESPACE_END
00435 
00436 
00437 
00438 #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.6
Copyright © 2000, 2001, 2002, 2003 The Apache Software Foundation. All Rights Reserved.