00001 /* 00002 * The Apache Software License, Version 1.1 00003 * 00004 * 00005 * Copyright (c) 1999-2004 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 00115 #if defined(XALAN_NO_STD_NAMESPACE) 00116 typedef deque<XalanNode*> CurrentNodeStackType; 00117 typedef deque<const NodeRefListBase*> ContextNodeListStackType; 00118 #else 00119 typedef std::deque<XalanNode*> CurrentNodeStackType; 00120 typedef std::deque<const NodeRefListBase*> ContextNodeListStackType; 00121 #endif 00122 00133 XPathExecutionContextDefault( 00134 XPathEnvSupport& theXPathEnvSupport, 00135 DOMSupport& theDOMSupport, 00136 XObjectFactory& theXObjectFactory, 00137 XalanNode* theCurrentNode = 0, 00138 const NodeRefListBase* theContextNodeList = 0, 00139 const PrefixResolver* thePrefixResolver = 0); 00140 00150 explicit 00151 XPathExecutionContextDefault( 00152 XalanNode* theCurrentNode = 0, 00153 const NodeRefListBase* theContextNodeList = 0, 00154 const PrefixResolver* thePrefixResolver = 0); 00155 00156 virtual 00157 ~XPathExecutionContextDefault(); 00158 00159 00165 XPathEnvSupport* 00166 getXPathEnvSupport() const 00167 { 00168 return m_xpathEnvSupport; 00169 } 00170 00176 void 00177 setXPathEnvSupport(XPathEnvSupport* theSupport) 00178 { 00179 m_xpathEnvSupport = theSupport; 00180 } 00181 00187 void 00188 setDOMSupport(DOMSupport* theDOMSupport) 00189 { 00190 m_domSupport = theDOMSupport; 00191 } 00192 00198 void 00199 setXObjectFactory(XObjectFactory* theXObjectFactory) 00200 { 00201 m_xobjectFactory = theXObjectFactory; 00202 } 00203 00209 XalanQNameByValue& 00210 getScratchQName() const 00211 { 00212 #if defined(XALAN_NO_MUTABLE) 00213 return ((XPathExecutionContextDefault*)this)->m_scratchQName; 00214 #else 00215 return m_scratchQName; 00216 #endif 00217 } 00218 00219 // These interfaces are inherited from XPathExecutionContext... 00220 00221 virtual void 00222 reset(); 00223 00224 virtual XalanNode* 00225 getCurrentNode() const; 00226 00227 virtual void 00228 pushCurrentNode(XalanNode* theCurrentNode); 00229 00230 virtual void 00231 popCurrentNode(); 00232 00233 virtual bool 00234 isNodeAfter( 00235 const XalanNode& node1, 00236 const XalanNode& node2) const; 00237 00238 virtual void 00239 pushContextNodeList(const NodeRefListBase& theList); 00240 00241 virtual void 00242 popContextNodeList(); 00243 00244 virtual const NodeRefListBase& 00245 getContextNodeList() const; 00246 00247 virtual size_type 00248 getContextNodeListLength() const; 00249 00250 virtual size_type 00251 getContextNodeListPosition(const XalanNode& contextNode) const; 00252 00253 virtual bool 00254 elementAvailable(const XalanQName& theQName) const; 00255 00256 virtual bool 00257 elementAvailable( 00258 const XalanDOMString& theName, 00259 const LocatorType* locator) const; 00260 00261 virtual bool 00262 functionAvailable(const XalanQName& theQName) const; 00263 00264 virtual bool 00265 functionAvailable( 00266 const XalanDOMString& theName, 00267 const LocatorType* locator) const; 00268 00269 virtual const XObjectPtr 00270 extFunction( 00271 const XalanDOMString& theNamespace, 00272 const XalanDOMString& functionName, 00273 XalanNode* context, 00274 const XObjectArgVectorType& argVec, 00275 const LocatorType* locator); 00276 00277 virtual XalanDocument* 00278 parseXML( 00279 const XalanDOMString& urlString, 00280 const XalanDOMString& base) const; 00281 00282 virtual MutableNodeRefList* 00283 borrowMutableNodeRefList(); 00284 00285 virtual bool 00286 returnMutableNodeRefList(MutableNodeRefList* theList); 00287 00288 virtual MutableNodeRefList* 00289 createMutableNodeRefList() const; 00290 00291 virtual XalanDOMString& 00292 getCachedString(); 00293 00294 virtual bool 00295 releaseCachedString(XalanDOMString& theString); 00296 00297 virtual void 00298 getNodeSetByKey( 00299 XalanDocument* doc, 00300 const XalanQName& qname, 00301 const XalanDOMString& ref, 00302 MutableNodeRefList& nodelist); 00303 00304 virtual void 00305 getNodeSetByKey( 00306 XalanDocument* doc, 00307 const XalanDOMString& name, 00308 const XalanDOMString& ref, 00309 const LocatorType* locator, 00310 MutableNodeRefList& nodelist); 00311 00312 virtual const XObjectPtr 00313 getVariable( 00314 const XalanQName& name, 00315 const LocatorType* locator = 0); 00316 00317 virtual const PrefixResolver* 00318 getPrefixResolver() const; 00319 00320 virtual void 00321 setPrefixResolver(const PrefixResolver* thePrefixResolver); 00322 00323 virtual const XalanDOMString* 00324 getNamespaceForPrefix(const XalanDOMString& prefix) const; 00325 00326 virtual XalanDOMString 00327 findURIFromDoc(const XalanDocument* owner) const; 00328 00329 virtual const XalanDOMString& 00330 getUnparsedEntityURI( 00331 const XalanDOMString& theName, 00332 const XalanDocument& theDocument) const; 00333 00334 virtual bool 00335 shouldStripSourceNode(const XalanNode& node); 00336 00337 virtual XalanDocument* 00338 getSourceDocument(const XalanDOMString& theURI) const; 00339 00340 virtual void 00341 setSourceDocument( 00342 const XalanDOMString& theURI, 00343 XalanDocument* theDocument); 00344 00345 virtual const XalanDecimalFormatSymbols* 00346 getDecimalFormatSymbols(const XalanQName& qname); 00347 00348 00349 // These interfaces are inherited from ExecutionContext... 00350 00351 virtual void 00352 error( 00353 const XalanDOMString& msg, 00354 const XalanNode* sourceNode = 0, 00355 const LocatorType* locator = 0) const; 00356 00357 virtual void 00358 error( 00359 const char* msg, 00360 const XalanNode* sourceNode = 0, 00361 const LocatorType* locator = 0) const; 00362 00363 virtual void 00364 warn( 00365 const XalanDOMString& msg, 00366 const XalanNode* sourceNode = 0, 00367 const LocatorType* locator = 0) const; 00368 00369 virtual void 00370 warn( 00371 const char* msg, 00372 const XalanNode* sourceNode = 0, 00373 const LocatorType* locator = 0) const; 00374 00375 virtual void 00376 message( 00377 const XalanDOMString& msg, 00378 const XalanNode* sourceNode = 0, 00379 const LocatorType* locator = 0) const; 00380 00381 virtual void 00382 message( 00383 const char* msg, 00384 const XalanNode* sourceNode = 0, 00385 const LocatorType* locator = 0) const; 00386 00387 protected: 00388 00389 typedef XalanObjectCache<MutableNodeRefList, DefaultCacheCreateFunctor<MutableNodeRefList>, DeleteFunctor<MutableNodeRefList>, ClearCacheResetFunctor<MutableNodeRefList> > NodeListCacheType; 00390 00391 enum { eNodeListCacheListSize = 50 }; 00392 00393 struct ContextNodeListPositionCache 00394 { 00395 ContextNodeListPositionCache() : 00396 m_node(0), 00397 m_index(0) 00398 { 00399 } 00400 00401 void 00402 clear() 00403 { 00404 if (m_node != 0) 00405 { 00406 m_node = 0; 00407 } 00408 } 00409 00410 const XalanNode* m_node; 00411 00412 size_type m_index; 00413 }; 00414 00415 XPathEnvSupport* m_xpathEnvSupport; 00416 00417 DOMSupport* m_domSupport; 00418 00419 CurrentNodeStackType m_currentNodeStack; 00420 00421 ContextNodeListStackType m_contextNodeListStack; 00422 00423 const PrefixResolver* m_prefixResolver; 00424 00425 XalanDOMString m_currentPattern; 00426 00427 NodeListCacheType m_nodeListCache; 00428 00429 XalanDOMStringCache m_stringCache; 00430 00431 mutable ContextNodeListPositionCache m_cachedPosition; 00432 00433 mutable XalanQNameByValue m_scratchQName; 00434 00435 static const NodeRefList s_dummyList; 00436 }; 00437 00438 00439 00440 XALAN_CPP_NAMESPACE_END 00441 00442 00443 00444 #endif // XPATHEXECUTIONCONTEXTDEFAULT_HEADER_GUARD_1357924680
Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.
![]() |
Xalan-C++ XSLT Processor Version 1.7 |
|