Xalan-C++ API Reference 1.12.0
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
51namespace XALAN_CPP_NAMESPACE {
52
53
54
55class DOMSupport;
56class XPathEnvSupport;
57class XalanQName;
58
59
60
61/**
62 * A basic implementation of the class XPathExecutionContext.
63 */
65{
66public:
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 */
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,
104
107 MemoryManager& theManager,
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
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
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,
176 const XalanNode* context = 0,
177 const Locator* locator = 0);
178
179 // These interfaces are inherited from XPathExecutionContext...
180
181 virtual void
183
184 virtual XalanNode*
186
187 virtual void
189
190 virtual void
192
193 virtual bool
195 const XalanNode& node1,
196 const XalanNode& node2) const;
197
198 virtual void
200
201 virtual void
203
204 virtual const NodeRefListBase&
206
207 virtual size_type
209
210 virtual size_type
212
213 virtual bool
215
216 virtual bool
218 const XalanDOMString& theName,
219 const Locator* locator) const;
220
221 virtual bool
223
224 virtual bool
226 const XalanDOMString& theName,
227 const Locator* locator) const;
228
229 virtual const XObjectPtr
232 const XalanDOMString& functionName,
235 const Locator* locator);
236
237 virtual XalanDocument*
239 MemoryManager& theManager,
241 const XalanDOMString& base,
242 ErrorHandler* theErrorHandler = 0) const;
243
244 virtual MutableNodeRefList*
246
247 virtual bool
249
250 virtual MutableNodeRefList*
252
253 virtual XalanDOMString&
255
256 virtual bool
258
259 virtual void
262 const XalanQName& qname,
263 const XalanDOMString& ref,
264 const Locator* locator,
266
267 virtual void
270 const XalanDOMString& name,
271 const XalanDOMString& ref,
272 const Locator* locator,
274
275 virtual const XObjectPtr
277 const XalanQName& name,
278 const Locator* locator = 0);
279
280 virtual const PrefixResolver*
282
283 virtual void
285
286 virtual const XalanDOMString*
288
289 virtual const XalanDOMString&
291
292 virtual const XalanDOMString&
294 const XalanDOMString& theName,
295 const XalanDocument& theDocument) const;
296
297 virtual XalanDocument*
299
300 virtual void
302 const XalanDOMString& theURI,
304
305 virtual void formatNumber(
306 double number,
307 const XalanDOMString& pattern,
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,
317 const XalanNode* context = 0,
318 const Locator* locator = 0);
319
320
321 // These interfaces are inherited from ExecutionContext...
322
323 virtual void
325 eSource source,
327 const XalanDOMString& msg,
328 const Locator* locator,
329 const XalanNode* sourceNode);
330
331 virtual void
333 eSource source,
335 const XalanDOMString& msg,
336 const XalanNode* sourceNode);
337
338 virtual void
340 const XalanDOMString& msg,
341 const XalanNode* sourceNode = 0,
342 const Locator* locator = 0) const;
343
344 virtual void
346 const XalanDOMString& msg,
347 const XalanNode* sourceNode = 0,
348 const Locator* locator = 0) const;
349
350 virtual void
352 const XalanDOMString& msg,
353 const XalanNode* sourceNode = 0,
354 const Locator* locator = 0) const;
355
356 virtual bool
358
359protected:
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
396
398
400
402
404
406
408
410
412};
413
414
415
416}
417
418
419
420#endif // XPATHEXECUTIONCONTEXTDEFAULT_HEADER_GUARD_1357924680
#define XALAN_XPATH_EXPORT
#define XALAN_CPP_NAMESPACE
Xalan-C++ namespace, including major and minor version.
Local implementation of MutableNodeRefList.
Local implementation of NodeRefList.
Local implementation of NodeRefList.
This class defines an interface for classes that resolve namespace prefixes to their URIs.
This class handles the creation of XObjects and manages their lifetime.
Class to hold XObjectPtr return types.
Definition XObject.hpp:884
A basic implementation of the class XPathExecutionContext.
virtual size_type getContextNodeListLength() const
virtual void formatNumber(double number, const XalanDOMString &pattern, const XalanDOMString &dfsName, XalanDOMString &theResult, const XalanNode *context=0, const Locator *locator=0)
Formats a number according to the specified pattern.
virtual const XObjectPtr getVariable(const XalanQName &name, const Locator *locator=0)
Given a name, locate a variable in the current context, and return a pointer to the object.
XalanQNameByValue & getScratchQName() const
Get a reference to the scratch QNameByValue instance.
XPathExecutionContextDefault(MemoryManager &theManager, XalanNode *theCurrentNode=0, const NodeRefListBase *theContextNodeList=0, const PrefixResolver *thePrefixResolver=0)
Construct an XPathExecutionContextDefault object.
virtual XalanDOMString & getCachedString()
Get a cached string for temporary use.
virtual bool isNodeAfter(const XalanNode &node1, const XalanNode &node2) const
Determine if a node is after another node, in document order.
virtual void doFormatNumber(double number, const XalanDOMString &pattern, const XalanDecimalFormatSymbols *theDFS, XalanDOMString &theResult, const XalanNode *context=0, const Locator *locator=0)
virtual void formatNumber(double number, const XalanDOMString &pattern, XalanDOMString &theResult, const XalanNode *context=0, const Locator *locator=0)
Formats a number according to the specified pattern.
virtual const NodeRefListBase & getContextNodeList() const
Get the node list for current context.
virtual bool shouldStripSourceNode(const XalanText &node)
Determine if a text node should be stripped from the source tree, as if it weren't there.
virtual void getNodeSetByKey(XalanNode *context, const XalanDOMString &name, const XalanDOMString &ref, const Locator *locator, MutableNodeRefList &nodelist)
Given a valid element key, return the corresponding node list.
virtual MutableNodeRefList * borrowMutableNodeRefList()
Borrow a cached MutableNodeRefList instance.
virtual bool elementAvailable(const XalanDOMString &theName, const Locator *locator) const
Determine if an external element is available by resolving a string to a QName.
virtual void getNodeSetByKey(XalanNode *context, const XalanQName &qname, const XalanDOMString &ref, const Locator *locator, MutableNodeRefList &nodelist)
Given a valid element key, return the corresponding node list.
XPathEnvSupport * getXPathEnvSupport() const
Get the XPathEnvSupport instance.
virtual bool returnMutableNodeRefList(MutableNodeRefList *theList)
Return a previously borrowed MutableNodeRefList instance.
XalanVector< const NodeRefListBase * > ContextNodeListStackType
virtual bool functionAvailable(const XalanDOMString &theName, const Locator *locator) const
Determine if a function is available.
virtual void setSourceDocument(const XalanDOMString &theURI, XalanDocument *theDocument)
Associate a document with a given URI.
virtual bool elementAvailable(const XalanQName &theQName) const
Determine if an external element is available.
virtual void problem(eSource source, eClassification classification, const XalanDOMString &msg, const Locator *locator, const XalanNode *sourceNode)
Function that is called when a problem event occurs.
virtual MutableNodeRefList * createMutableNodeRefList(MemoryManager &theManager) const
Create a MutableNodeRefList with the appropriate context.
virtual void popContextNodeList()
Pop the node list for current context.
virtual const PrefixResolver * getPrefixResolver() const
Retrieve the resolver for namespaces.
virtual const XalanDOMString & findURIFromDoc(const XalanDocument *owner) const
Given a DOM Document, tell what URI was used to parse it.
virtual const XalanDOMString & getUnparsedEntityURI(const XalanDOMString &theName, const XalanDocument &theDocument) const
The getUnparsedEntityURI function returns the URI of the unparsed entity with the specified name in t...
XalanObjectCache< MutableNodeRefList, DefaultCacheCreateFunctorMemMgr< MutableNodeRefList >, DeleteFunctor< MutableNodeRefList >, ClearCacheResetFunctor< MutableNodeRefList > > NodeListCacheType
virtual const XObjectPtr extFunction(const XalanDOMString &theNamespace, const XalanDOMString &functionName, XalanNode *context, const XObjectArgVectorType &argVec, const Locator *locator)
Handle an extension function.
virtual void pushCurrentNode(XalanNode *theCurrentNode)
Change the node currently being executed.
void setXObjectFactory(XObjectFactory *theXObjectFactory)
Set the XObjectFactory instance.
virtual void error(const XalanDOMString &msg, const XalanNode *sourceNode=0, const Locator *locator=0) const
virtual void pushContextNodeList(const NodeRefListBase &theList)
Push the node list for current context.
virtual void popCurrentNode()
Reset the node currently being executed.
virtual XalanDocument * getSourceDocument(const XalanDOMString &theURI) const
Get the document associated with the given URI.
virtual size_type getContextNodeListPosition(const XalanNode &contextNode) const
void setXPathEnvSupport(XPathEnvSupport *theSupport)
Set the XPathEnvSupport instance.
virtual void problem(eSource source, eClassification classification, const XalanDOMString &msg, const XalanNode *sourceNode)
Function that is called when a problem event occurs.
virtual void reset()
Reset the instance.
virtual void setPrefixResolver(const PrefixResolver *thePrefixResolver)
Change the resolver for namespaces.
virtual void message(const XalanDOMString &msg, const XalanNode *sourceNode=0, const Locator *locator=0) const
XPathExecutionContextDefault(XPathEnvSupport &theXPathEnvSupport, DOMSupport &theDOMSupport, XObjectFactory &theXObjectFactory, XalanNode *theCurrentNode=0, const NodeRefListBase *theContextNodeList=0, const PrefixResolver *thePrefixResolver=0)
Construct an XPathExecutionContextDefault object.
virtual XalanNode * getCurrentNode() const
Retrieve the node currently being executed.
static XPathExecutionContextDefault * create(MemoryManager &theManager, XalanNode *theCurrentNode=0, const NodeRefListBase *theContextNodeList=0, const PrefixResolver *thePrefixResolver=0)
virtual void warn(const XalanDOMString &msg, const XalanNode *sourceNode=0, const Locator *locator=0) const
virtual bool releaseCachedString(XalanDOMString &theString)
Return a cached string.
virtual bool functionAvailable(const XalanQName &theQName) const
Determine if a function is available.
virtual XalanDocument * parseXML(MemoryManager &theManager, const XalanDOMString &urlString, const XalanDOMString &base, ErrorHandler *theErrorHandler=0) const
Provides support for XML parsing service.
void setDOMSupport(DOMSupport *theDOMSupport)
Set the DOMSupport instance.
virtual const XalanDOMString * getNamespaceForPrefix(const XalanDOMString &prefix) const
Retrieve the URI corresponding to a namespace prefix.
Class to represent a qualified name.