SaxonC  11.6
Saxon Processor library for C/C++, PHP and Python
XdmFunctionItem.h
1 // Copyright (c) 2022 Saxonica Limited.
3 // This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4 // If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 // This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0.
7 
8 #ifndef SAXON_XDMFUNCTIONITEM_h
9 #define SAXON_XDMFUNCTIONITEM_h
10 
11 
12 #include "XdmItem.h"
13 #include "XdmAtomicValue.h"
14 #include "XdmNode.h"
15 #include <string>
16 
17 #include <stdlib.h>
18 #include <string.h>
19 
23 class XdmFunctionItem : public XdmItem {
24 
25 public:
26 
28 
32 
34 
38  XdmFunctionItem(jobject obj);
39 
41 
45 
46 
48 
51  virtual ~XdmFunctionItem(){
52  if(!fname.empty()) {
53  fname.clear();
54  }
55  }
56 
57 
59 
66  const char* getName();
67 
69 
74  virtual int getArity();
75 
77 
87  static XdmFunctionItem * getSystemFunction(SaxonProcessor * processor, const char * name, int arity);
88 
89 
90 
95  return (new XdmValue*[len]);
96  }
97 
98 
100 
110  XdmValue * call(SaxonProcessor * processor, XdmValue ** arguments, int argument_length);
111 
116  bool isAtomic(){
117  return false;
118  }
119 
123  XDM_TYPE getType() {
124  return XDM_FUNCTION_ITEM;
125  }
126 
128 
132  bool isFunction(){
133  return true;
134  }
135 
136 protected:
137  std::string fname;
139 private:
140 
141 
142  int arity;
144 };
145 
146 
147 
148 
149 #endif
The SaxonProcessor class acts as a factory for generating XQuery, XPath, Schema and XSLT compilers.
Definition: SaxonProcessor.h:119
Definition: XdmFunctionItem.h:23
XdmFunctionItem()
Default constructor for XdmFunctionItem.
Definition: XdmFunctionItem.cpp:10
XDM_TYPE getType()
Definition: XdmFunctionItem.h:123
std::string fname
Definition: XdmFunctionItem.h:137
virtual ~XdmFunctionItem()
Destructor.
Definition: XdmFunctionItem.h:51
bool isFunction()
Determine whether the item is a function or some other type of item.
Definition: XdmFunctionItem.h:132
XdmValue * call(SaxonProcessor *processor, XdmValue **arguments, int argument_length)
Call the function.
Definition: XdmFunctionItem.cpp:105
XdmValue ** createXdmValueArray(int len)
Definition: XdmFunctionItem.h:94
static XdmFunctionItem * getSystemFunction(SaxonProcessor *processor, const char *name, int arity)
Get a system function.
Definition: XdmFunctionItem.cpp:71
bool isAtomic()
Definition: XdmFunctionItem.h:116
const char * getName()
Get the name of the function as EQName.
Definition: XdmFunctionItem.cpp:23
virtual int getArity()
Get the arity of the function.
Definition: XdmFunctionItem.cpp:50
Definition: XdmItem.h:29
Definition: XdmValue.h:50