Xalan-C++ API Reference 1.12.0
XPathEnvSupportDefault.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(XPATHENVSUPPORTDEFAULT_HEADER_GUARD_1357924680)
19#define XPATHENVSUPPORTDEFAULT_HEADER_GUARD_1357924680
20
21
22
23// Base include file. Must be first.
26
27
28
30
31
32
34
35
36
37namespace XALAN_CPP_NAMESPACE {
38
39
40
43
44
45
47{
48public:
49
53
54 /**
55 * Perform initialization of statics -- must be called before any
56 * processing occurs. See class XPathInit.
57 */
58 static void
59 initialize(MemoryManager& theManager);
60
61 /**
62 * Perform termination of statics. See class XPathInit.
63 */
64 static void
66
67
69
70 virtual
72
73 MemoryManager&
75 {
76 return m_memoryManager;
77 }
78
79 virtual void
81
82 virtual void
84 eSource source,
86 const XalanDOMString& msg,
87 const Locator* locator,
88 const XalanNode* sourceNode);
89
90 virtual void
92 eSource source,
94 const XalanDOMString& msg,
95 const XalanNode* sourceNode);
96
97 // Interfaces to install and uninstall external functions globally.
98 // These calls are not thread-safe, and should happen during
99 // processing.
100
101 /**
102 * Install an external function in the global space.
103 *
104 * @param theNamespace The namespace for the functionl
105 * @param functionName The name of the function.
106 * @param function The function to install.
107 */
108 static void
111 const XalanDOMString& functionName,
112 const Function& function);
113
114 /**
115 * Uninstall an external function from the global space.
116 *
117 * @param theNamespace The namespace for the functionl
118 * @param functionName The name of the function.
119 */
120 static void
123 const XalanDOMString& functionName);
124
125 // Interfaces to install and uninstall external functions in this instance.
126
127 /**
128 * Install an external function in the local space.
129 *
130 * @param theNamespace The namespace for the functionl
131 * @param functionName The name of the function.
132 * @param function The function to install.
133 */
134 virtual void
137 const XalanDOMString& functionName,
138 const Function& function);
139
140 /**
141 * Uninstall an external function from the local space.
142 *
143 * @param theNamespace The namespace for the functionl
144 * @param functionName The name of the function.
145 */
146 virtual void
149 const XalanDOMString& functionName);
150
151
152 // These interfaces are inherited from XPathEnvSupport...
153
154 virtual XalanDocument*
156 MemoryManager& theManager,
158 const XalanDOMString& base,
159 ErrorHandler* theErrorHandler = 0);
160
161 virtual XalanDocument*
163
164 virtual void
166 const XalanDOMString& theURI,
168
169 virtual const XalanDOMString&
171
172 virtual bool
175 const XalanDOMString& elementName) const;
176
177 virtual bool
180 const XalanDOMString& functionName) const;
181
182 virtual XObjectPtr
186 const XalanDOMString& functionName,
189 const Locator* locator) const;
190
191 virtual void
193
194 // Delete functor for table cleanup...
196 {
199
201 /**
202 * Delete the value object in a map value pair. The value of the pair must
203 * be of pointer type.
204 *
205 * @param thePair key-value pair
206 */
207 void
209
210 private:
211
212 MemoryManager& m_memoryManager;
213 };
214
215protected:
216
217 /**
218 * Find an external function.
219 *
220 * @param theNamespace The namespace for the function.
221 * @param functionName The name of the function.
222 * @return a pointer to the function if found, or 0 if not found.
223 */
224 const Function*
227 const XalanDOMString& functionName) const;
228
229private:
230
231 // These are not implemented...
233
235 operator=(const XPathEnvSupportDefault&);
236
237 bool
239
240 /**
241 * Update the supplied function table. If the parameter
242 * function is 0, and a function with the supplied
243 * namespace and name exists in the table, it will be
244 * removed. If function is not 0, and a function with
245 * the supplied namespace and name exists in the table,
246 * it will be replaced with the new function. Otherwise,
247 * the function will be added.
248 *
249 * @param theNamespace The namespace for the functionl
250 * @param functionName The name of the function.
251 * @param function The function to install.
252 */
253 static void
254 updateFunctionTable(
257 const XalanDOMString& functionName,
258 const Function* function);
259
260 /**
261 * Find an external function in the supplied table.
262 *
263 * @param theTable The table to search.
264 * @param theNamespace The namespace for the function.
265 * @param functionName The name of the function.
266 * @return a pointer to the function if found, or 0 if not found.
267 */
268 const Function*
269 findFunction(
272 const XalanDOMString& functionName) const;
273
274 // Data members...
275
276 SourceDocsTableType m_sourceDocs;
277
278 NamespaceFunctionTablesType m_externalFunctions;
279
280 MemoryManager& m_memoryManager;
281
282 PrintWriter* m_pw;
283
284 static NamespaceFunctionTablesType s_externalFunctions;
285
286 static const XalanDOMString s_emptyString;
287};
288
289}
290
291
292
293#endif // XPATHENVSUPPORTDEFAULT_HEADER_GUARD_1357924680
#define XALAN_XPATH_EXPORT
#define XALAN_DEFAULT_MEMMGR
#define XALAN_USES_MEMORY_MANAGER(Type)
#define XALAN_CPP_NAMESPACE
Xalan-C++ namespace, including major and minor version.
Class to hold XObjectPtr return types.
Definition XObject.hpp:884
virtual void reset()
Reset the instance.
virtual bool functionAvailable(const XalanDOMString &theNamespace, const XalanDOMString &functionName) const
Determine if a function is available.
static void terminate()
Perform termination of statics.
virtual XalanDocument * parseXML(MemoryManager &theManager, const XalanDOMString &urlString, const XalanDOMString &base, ErrorHandler *theErrorHandler=0)
Provides support for XML parsing service.
static void uninstallExternalFunctionGlobal(const XalanDOMString &theNamespace, const XalanDOMString &functionName)
Uninstall an external function from the global space.
virtual void setSourceDocument(const XalanDOMString &theURI, XalanDocument *theDocument)
Associate a document with a given URI.
virtual XalanDocument * getSourceDocument(const XalanDOMString &theURI) const
Get the source document for the given URI.
XalanMap< XalanDOMString, FunctionTableType > NamespaceFunctionTablesType
virtual void uninstallExternalFunctionLocal(const XalanDOMString &theNamespace, const XalanDOMString &functionName)
Uninstall an external function from the local space.
virtual const XalanDOMString & findURIFromDoc(const XalanDocument *owner) const
Given a DOM Document, tell what URI was used to parse it.
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 XObjectPtr extFunction(XPathExecutionContext &executionContext, const XalanDOMString &theNamespace, const XalanDOMString &functionName, XalanNode *context, const XObjectArgVectorType &argVec, const Locator *locator) const
Handle an extension function.
XalanMap< XalanDOMString, XalanDocument * > SourceDocsTableType
virtual void setPrintWriter(PrintWriter *pw)
virtual void installExternalFunctionLocal(const XalanDOMString &theNamespace, const XalanDOMString &functionName, const Function &function)
Install an external function in the local space.
const Function * findFunction(const XalanDOMString &theNamespace, const XalanDOMString &functionName) const
Find an external function.
static void installExternalFunctionGlobal(const XalanDOMString &theNamespace, const XalanDOMString &functionName, const Function &function)
Install an external function in the global space.
virtual bool elementAvailable(const XalanDOMString &theNamespace, const XalanDOMString &elementName) const
Determine if an external element is available.
XPathEnvSupportDefault(MemoryManager &theManager XALAN_DEFAULT_MEMMGR)
FunctionTableTypeDefinition FunctionTableType
static void initialize(MemoryManager &theManager)
Perform initialization of statics – must be called before any processing occurs.
virtual void problem(eSource source, eClassification classification, const XalanDOMString &msg, const XalanNode *sourceNode)
Function that is called when a problem event occurs.
std::pair< const key_type, data_type > value_type
Definition XalanMap.hpp:201
bool operator==(const XalanVector< Type > &theLHS, const XalanVector< Type > &theRHS)
void operator()(const NamespaceFunctionTablesInnerType::value_type &thePair) const
Delete the value object in a map value pair.