Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.11


XPathExecutionContextDefault.hpp
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 #if !defined(XPATHEXECUTIONCONTEXTDEFAULT_HEADER_GUARD_1357924680)
19 #define XPATHEXECUTIONCONTEXTDEFAULT_HEADER_GUARD_1357924680
20 
21 
22 
23 // Base include file. Must be first.
25 
26 
27 
30 
31 
32 
34 
35 
36 
37 // Base class include file.
39 
40 
41 
43 
44 
45 
48 
49 
50 
51 XALAN_CPP_NAMESPACE_BEGIN
52 
53 
54 
55 class DOMSupport;
56 class XPathEnvSupport;
57 class XalanQName;
58 
59 
60 
61 /**
62  * A basic implementation of the class XPathExecutionContext.
63  */
65 {
66 public:
67 
70 
71  /**
72  * Construct an XPathExecutionContextDefault object
73  *
74  * @param theXPathEnvSupport XPathEnvSupport class instance
75  * @param theDOMSupport DOMSupport class instance
76  * @param theXobjectFactory factory class instance for XObjects
77  * @param theCurrentNode current node in the source tree
78  * @param theContextNodeList node list for current context
79  * @param thePrefixResolver pointer to prefix resolver to use
80  */
82  XPathEnvSupport& theXPathEnvSupport,
83  DOMSupport& theDOMSupport,
84  XObjectFactory& theXObjectFactory,
85  XalanNode* theCurrentNode = 0,
86  const NodeRefListBase* theContextNodeList = 0,
87  const PrefixResolver* thePrefixResolver = 0);
88 
89  /**
90  * Construct an XPathExecutionContextDefault object
91  *
92  * @param theXPathEnvSupport XPathEnvSupport class instance
93  * @param theXObjectFactory factory class instance for XObjects
94  * @param theCurrentNode current node in the source tree
95  * @param theContextNodeList node list for current context
96  * @param thePrefixResolver pointer to prefix resolver to use
97  */
98  explicit
100  MemoryManager& theManager,
101  XalanNode* theCurrentNode = 0,
102  const NodeRefListBase* theContextNodeList = 0,
103  const PrefixResolver* thePrefixResolver = 0);
104 
106  create(
107  MemoryManager& theManager,
108  XalanNode* theCurrentNode = 0,
109  const NodeRefListBase* theContextNodeList = 0,
110  const PrefixResolver* thePrefixResolver = 0);
111 
112  virtual
114 
115 
116  /**
117  * Get the XPathEnvSupport instance.
118  *
119  * @return a pointer to the instance.
120  */
123  {
124  return m_xpathEnvSupport;
125  }
126 
127  /**
128  * Set the XPathEnvSupport instance.
129  *
130  * @param theSupport a reference to the instance to use.
131  */
132  void
134  {
135  m_xpathEnvSupport = theSupport;
136  }
137 
138  /**
139  * Set the DOMSupport instance.
140  *
141  * @param theDOMSupport a reference to the instance to use.
142  */
143  void
144  setDOMSupport(DOMSupport* theDOMSupport)
145  {
146  m_domSupport = theDOMSupport;
147  }
148 
149  /**
150  * Set the XObjectFactory instance.
151  *
152  * @param theFactory a reference to the instance to use.
153  */
154  void
155  setXObjectFactory(XObjectFactory* theXObjectFactory)
156  {
157  m_xobjectFactory = theXObjectFactory;
158  }
159 
160  /**
161  * Get a reference to the scratch QNameByValue instance.
162  *
163  * @return A reference to a QNameByValue instance.
164  */
167  {
168  return m_scratchQName;
169  }
170 
171  virtual void doFormatNumber(
172  double number,
173  const XalanDOMString& pattern,
174  const XalanDecimalFormatSymbols* theDFS,
175  XalanDOMString& theResult,
176  const XalanNode* context = 0,
177  const Locator* locator = 0);
178 
179  // These interfaces are inherited from XPathExecutionContext...
180 
181  virtual void
182  reset();
183 
184  virtual XalanNode*
185  getCurrentNode() const;
186 
187  virtual void
188  pushCurrentNode(XalanNode* theCurrentNode);
189 
190  virtual void
191  popCurrentNode();
192 
193  virtual bool
194  isNodeAfter(
195  const XalanNode& node1,
196  const XalanNode& node2) const;
197 
198  virtual void
199  pushContextNodeList(const NodeRefListBase& theList);
200 
201  virtual void
203 
204  virtual const NodeRefListBase&
205  getContextNodeList() const;
206 
207  virtual size_type
208  getContextNodeListLength() const;
209 
210  virtual size_type
211  getContextNodeListPosition(const XalanNode& contextNode) const;
212 
213  virtual bool
214  elementAvailable(const XalanQName& theQName) const;
215 
216  virtual bool
218  const XalanDOMString& theName,
219  const Locator* locator) const;
220 
221  virtual bool
222  functionAvailable(const XalanQName& theQName) const;
223 
224  virtual bool
226  const XalanDOMString& theName,
227  const Locator* locator) const;
228 
229  virtual const XObjectPtr
230  extFunction(
231  const XalanDOMString& theNamespace,
232  const XalanDOMString& functionName,
233  XalanNode* context,
234  const XObjectArgVectorType& argVec,
235  const Locator* locator);
236 
237  virtual XalanDocument*
238  parseXML(
239  MemoryManager& theManager,
240  const XalanDOMString& urlString,
241  const XalanDOMString& base,
242  ErrorHandler* theErrorHandler = 0) const;
243 
244  virtual MutableNodeRefList*
246 
247  virtual bool
249 
250  virtual MutableNodeRefList*
251  createMutableNodeRefList(MemoryManager& theManager) const;
252 
253  virtual XalanDOMString&
254  getCachedString();
255 
256  virtual bool
258 
259  virtual void
261  XalanNode* context,
262  const XalanQName& qname,
263  const XalanDOMString& ref,
264  const Locator* locator,
265  MutableNodeRefList& nodelist);
266 
267  virtual void
269  XalanNode* context,
270  const XalanDOMString& name,
271  const XalanDOMString& ref,
272  const Locator* locator,
273  MutableNodeRefList& nodelist);
274 
275  virtual const XObjectPtr
276  getVariable(
277  const XalanQName& name,
278  const Locator* locator = 0);
279 
280  virtual const PrefixResolver*
281  getPrefixResolver() const;
282 
283  virtual void
284  setPrefixResolver(const PrefixResolver* thePrefixResolver);
285 
286  virtual const XalanDOMString*
287  getNamespaceForPrefix(const XalanDOMString& prefix) const;
288 
289  virtual const XalanDOMString&
290  findURIFromDoc(const XalanDocument* owner) const;
291 
292  virtual const XalanDOMString&
294  const XalanDOMString& theName,
295  const XalanDocument& theDocument) const;
296 
297  virtual XalanDocument*
298  getSourceDocument(const XalanDOMString& theURI) const;
299 
300  virtual void
302  const XalanDOMString& theURI,
303  XalanDocument* theDocument);
304 
305  virtual void formatNumber(
306  double number,
307  const XalanDOMString& pattern,
308  XalanDOMString& theResult,
309  const XalanNode* context = 0,
310  const Locator* locator = 0);
311 
312  virtual void formatNumber(
313  double number,
314  const XalanDOMString& pattern,
315  const XalanDOMString& dfsName,
316  XalanDOMString& theResult,
317  const XalanNode* context = 0,
318  const Locator* locator = 0);
319 
320 
321  // These interfaces are inherited from ExecutionContext...
322 
323  virtual void
324  problem(
325  eSource source,
326  eClassification classification,
327  const XalanDOMString& msg,
328  const Locator* locator,
329  const XalanNode* sourceNode);
330 
331  virtual void
332  problem(
333  eSource source,
334  eClassification classification,
335  const XalanDOMString& msg,
336  const XalanNode* sourceNode);
337 
338  virtual void
339  error(
340  const XalanDOMString& msg,
341  const XalanNode* sourceNode = 0,
342  const Locator* locator = 0) const;
343 
344  virtual void
345  warn(
346  const XalanDOMString& msg,
347  const XalanNode* sourceNode = 0,
348  const Locator* locator = 0) const;
349 
350  virtual void
351  message(
352  const XalanDOMString& msg,
353  const XalanNode* sourceNode = 0,
354  const Locator* locator = 0) const;
355 
356  virtual bool
357  shouldStripSourceNode(const XalanText& node);
358 
359 protected:
360 
361  typedef XalanObjectCache<
366 
367  enum { eNodeListCacheListSize = 50 };
368 
370  {
372  m_node(0),
373  m_index(0)
374  {
375  }
376 
377  void
379  {
380  if (m_node != 0)
381  {
382  m_node = 0;
383  }
384  }
385 
387 
389  };
390 
392 
394 
395  CurrentNodeStackType m_currentNodeStack;
396 
397  ContextNodeListStackType m_contextNodeListStack;
398 
400 
402 
403  NodeListCacheType m_nodeListCache;
404 
406 
408 
410 
411  static const NodeRefList s_dummyList;
412 };
413 
414 
415 
416 XALAN_CPP_NAMESPACE_END
417 
418 
419 
420 #endif // XPATHEXECUTIONCONTEXTDEFAULT_HEADER_GUARD_1357924680
virtual void setPrefixResolver(const PrefixResolver *thePrefixResolver)=0
Change the resolver for namespaces.
virtual void pushContextNodeList(const NodeRefListBase &theList)=0
Push the node list for current context.
virtual MutableNodeRefList * borrowMutableNodeRefList()=0
Borrow a cached MutableNodeRefList instance.
virtual bool shouldStripSourceNode(const XalanText &node)=0
Determine if a text node should be stripped from the source tree, as if it weren&#39;t there...
void setXObjectFactory(XObjectFactory *theXObjectFactory)
Set the XObjectFactory instance.
virtual bool returnMutableNodeRefList(MutableNodeRefList *theList)=0
Return a previously borrowed MutableNodeRefList instance.
Local implementation of MutableNodeRefList.
void setXPathEnvSupport(XPathEnvSupport *theSupport)
Set the XPathEnvSupport instance.
XalanVector< const NodeRefListBase * > ContextNodeListStackType
virtual const XObjectPtr getVariable(const XalanQName &name, const Locator *locator=0)=0
Given a name, locate a variable in the current context, and return a pointer to the object...
virtual const PrefixResolver * getPrefixResolver() const =0
Retrieve the resolver for namespaces.
virtual const NodeRefListBase & getContextNodeList() const =0
Get the node list for current context.
virtual void pushCurrentNode(XalanNode *theCurrentNode)=0
Change the node currently being executed.
virtual void reset()=0
Reset the instance.
virtual void problem(eSource source, eClassification classification, const XalanDOMString &msg, const Locator *locator, const XalanNode *sourceNode)=0
Function that is called when a problem event occurs.
Local implementation of NodeRefList.
Definition: NodeRefList.hpp:43
virtual const XObjectPtr extFunction(const XalanDOMString &theNamespace, const XalanDOMString &functionName, XalanNode *context, const XObjectArgVectorType &argVec, const Locator *locator)=0
Handle an extension function.
virtual bool releaseCachedString(XalanDOMString &theString)=0
Return a cached string.
Class to hold XObjectPtr return types.
Definition: XObject.hpp:883
XalanObjectCache< MutableNodeRefList, DefaultCacheCreateFunctorMemMgr< MutableNodeRefList >, DeleteFunctor< MutableNodeRefList >, ClearCacheResetFunctor< MutableNodeRefList > > NodeListCacheType
A basic implementation of the class XPathExecutionContext.
Local implementation of NodeRefList.
virtual void setSourceDocument(const XalanDOMString &theURI, XalanDocument *theDocument)=0
Associate a document with a given URI.
ContextNodeListPositionCache m_cachedPosition
XPathEnvSupport * getXPathEnvSupport() const
Get the XPathEnvSupport instance.
virtual void popCurrentNode()=0
Reset the node currently being executed.
virtual size_type getContextNodeListLength() const =0
virtual XalanDocument * getSourceDocument(const XalanDOMString &theURI) const =0
Get the document associated with the given URI.
virtual bool isNodeAfter(const XalanNode &node1, const XalanNode &node2) const =0
Determine if a node is after another node, in document order.
virtual void popContextNodeList()=0
Pop the node list for current context.
XALAN_CPP_NAMESPACE_BEGIN typedef size_t size_type
Definition: XalanMap.hpp:46
virtual bool elementAvailable(const XalanQName &theQName) const =0
Determine if an external element is available.
virtual XalanNode * getCurrentNode() const =0
Retrieve the node currently being executed.
This class defines an interface for classes that resolve namespace prefixes to their URIs...
virtual XalanDOMString & getCachedString()=0
Get a cached string for temporary use.
virtual const XalanDOMString & getUnparsedEntityURI(const XalanDOMString &theName, const XalanDocument &theDocument) const =0
The getUnparsedEntityURI function returns the URI of the unparsed entity with the specified name in t...
virtual MutableNodeRefList * createMutableNodeRefList(MemoryManager &theManager) const =0
Create a MutableNodeRefList with the appropriate context.
void setDOMSupport(DOMSupport *theDOMSupport)
Set the DOMSupport instance.
virtual const XalanDOMString & findURIFromDoc(const XalanDocument *owner) const =0
Given a DOM Document, tell what URI was used to parse it.
virtual bool functionAvailable(const XalanQName &theQName) const =0
Determine if a function is available.
NodeRefListBase::size_type size_type
XalanQNameByValue & getScratchQName() const
Get a reference to the scratch QNameByValue instance.
ContextNodeListStackType m_contextNodeListStack
virtual size_type getContextNodeListPosition(const XalanNode &contextNode) const =0
XalanVector< XalanNode * > CurrentNodeStackType
#define XALAN_XPATH_EXPORT
This class handles the creation of XObjects and manages their lifetime.
Class to represent a qualified name.
Definition: XalanQName.hpp:70
virtual void formatNumber(double number, const XalanDOMString &pattern, XalanDOMString &theResult, const XalanNode *context=0, const Locator *locator=0)=0
Formats a number according to the specified pattern.
virtual XalanDocument * parseXML(MemoryManager &theManager, const XalanDOMString &urlString, const XalanDOMString &base, ErrorHandler *theErrorHandler=0) const =0
Provides support for XML parsing service.
virtual void getNodeSetByKey(XalanNode *context, const XalanQName &qname, const XalanDOMString &ref, const Locator *locator, MutableNodeRefList &nodelist)=0
Given a valid element key, return the corresponding node list.
virtual const XalanDOMString * getNamespaceForPrefix(const XalanDOMString &prefix) const =0
Retrieve the URI corresponding to a namespace prefix.

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.11
Copyright © 1999-2012 The Apache Software Foundation.
All Rights Reserved.

Apache Logo