Xalan-C++ API Reference 1.12.0
Function.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(FUNCTION_HEADER_GUARD_1357924680)
19#define FUNCTION_HEADER_GUARD_1357924680
20
21
22
23// Base header file. Must be first.
25
27
28
29#include <vector>
30
31
32
35
36
37namespace XERCES_CPP_NAMESPACE
38{
39 class Locator;
40}
41
42
43
44namespace XALAN_CPP_NAMESPACE {
45
46
47
48class XalanNode;
49
50
51
52// Base class for all XPath function classes.
53//
54// These are all inline, even though
55// there are virtual functions, because we expect that they will only be
56// needed by the XPath class.
58{
59public:
60
61 typedef xercesc::Locator LocatorType;
62
63 explicit
65
66 virtual
68
72
73 /**
74 * Execute an XPath function object. The function must return a valid
75 * object. Extension functions should override this version of execute(),
76 * rather than one of the other calls designed for a specific number of
77 * arguments, since the extension function mechanism will call this
78 * version first. Extension functions that accept more than three
79 * arguments _must_ override this version.
80 *
81 * @param executionContext executing context
82 * @param context current context node
83 * @param args vector of pointers to XObject arguments
84 * @param locator Locator instance for the XPath expression that contains the function call
85 * @return pointer to the result XObject
86 */
87 virtual XObjectPtr
91 const XObjectArgVectorType& args,
92 const Locator* locator) const;
93
94 /**
95 * Execute an XPath function object. The function must return a valid
96 * object. Called if function has no parameters.
97 *
98 * @param executionContext executing context
99 * @param context current context node
100 * @param locator Locator instance for the XPath expression that contains the function call
101 * @return pointer to the result XObject
102 */
103 virtual XObjectPtr
107 const Locator* locator) const;
108
109 /**
110 * Execute an XPath function object. The function must return a valid
111 * object. Called if function has one parameter.
112 *
113 * @param executionContext executing context
114 * @param context current context node
115 * @param arg pointer to XObject argument
116 * @param locator Locator instance for the XPath expression that contains the function call
117 * @return pointer to the result XObject
118 */
119 virtual XObjectPtr
123 const XObjectPtr arg,
124 const Locator* locator) const;
125
126 /**
127 * Execute an XPath function object. The function must return a valid
128 * object. Called if function has two parameters.
129 *
130 * @param executionContext executing context
131 * @param context current context node
132 * @param arg1 pointer to XObject argument
133 * @param arg2 pointer to XObject argument
134 * @param locator Locator instance for the XPath expression that contains the function call
135 * @return pointer to the result XObject
136 */
137 virtual XObjectPtr
141 const XObjectPtr arg1,
142 const XObjectPtr arg2,
143 const Locator* locator) const;
144
145 /**
146 * Execute an XPath function object. The function must return a valid
147 * object. Called if function has three parameters.
148 *
149 * @param executionContext executing context
150 * @param context current context node
151 * @param arg1 pointer to XObject arguments
152 * @param arg2 pointer to XObject argument
153 * @param arg3 pointer to XObject argument
154 * @param locator Locator instance for the XPath expression that contains the function call
155 * @return pointer to the result XObject
156 */
157 virtual XObjectPtr
161 const XObjectPtr arg1,
162 const XObjectPtr arg2,
163 const XObjectPtr arg3,
164 const Locator* locator) const;
165
166 /**
167 * Create a copy of the function object.
168 *
169 * @return pointer to the new object
170 */
171 virtual Function*
172 clone(MemoryManager& theManager) const = 0;
173
174protected:
175
176 /**
177 * Get the error message to report when
178 * the function is called with the wrong
179 * number of arguments.
180 *
181 * @param theBuffer The XalanDOMString for the message.
182 * @return The error message
183 */
184 virtual const XalanDOMString&
186
187 /**
188 * Report the error returned from the getError()
189 * call.
190 *
191 * @param executionContext The current XPathExecutionContext
192 * @param context The context node
193 * @param locator The Locator instance for the XPath expression that contains the function call
194 */
195 void
198 const XalanNode* context,
199 const Locator* locator) const;
200
201private:
202
203 // Not implemented...
204 Function&
205 operator=(const Function&);
206
207 bool
208 operator==(const Function&) const;
209};
210
211
212
213}
214
215
216
217#endif // FUNCTION_HEADER_GUARD_1357924680
#define XALAN_XPATH_EXPORT
#define XALAN_CPP_NAMESPACE
Xalan-C++ namespace, including major and minor version.
XPathExecutionContext::XObjectArgVectorType XObjectArgVectorType
Definition Function.hpp:69
virtual ~Function()
XPathExecutionContext::GetCachedNodeList GetCachedNodeList
Definition Function.hpp:71
virtual Function * clone(MemoryManager &theManager) const =0
Create a copy of the function object.
virtual XObjectPtr execute(XPathExecutionContext &executionContext, XalanNode *context, const Locator *locator) const
Execute an XPath function object.
virtual XObjectPtr execute(XPathExecutionContext &executionContext, XalanNode *context, const XObjectPtr arg1, const XObjectPtr arg2, const XObjectPtr arg3, const Locator *locator) const
Execute an XPath function object.
virtual XObjectPtr execute(XPathExecutionContext &executionContext, XalanNode *context, const XObjectPtr arg, const Locator *locator) const
Execute an XPath function object.
XPathExecutionContext::GetCachedString GetCachedString
Definition Function.hpp:70
void generalError(XPathExecutionContext &executionContext, const XalanNode *context, const Locator *locator) const
Report the error returned from the getError() call.
xercesc::Locator LocatorType
Definition Function.hpp:61
virtual XObjectPtr execute(XPathExecutionContext &executionContext, XalanNode *context, const XObjectPtr arg1, const XObjectPtr arg2, const Locator *locator) const
Execute an XPath function object.
virtual const XalanDOMString & getError(XalanDOMString &theBuffer) const =0
Get the error message to report when the function is called with the wrong number of arguments.
virtual XObjectPtr execute(XPathExecutionContext &executionContext, XalanNode *context, const XObjectArgVectorType &args, const Locator *locator) const
Execute an XPath function object.
Class to hold XObjectPtr return types.
Definition XObject.hpp:884
bool operator==(const XalanVector< Type > &theLHS, const XalanVector< Type > &theRHS)