SaxonC  11.6
Saxon Processor library for C/C++, PHP and Python
XdmArray.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_XDM_ARRAY_h
9 #define SAXON_XDM_ARRAY_h
10 
11 
12 #include "XdmFunctionItem.h"
13 #include <string>
14 
15 #include <stdlib.h>
16 #include <string.h>
17 #include <set>
18 
25 class XdmArray : public XdmFunctionItem {
26 
27 public:
28 
30 
33  XdmArray();
34 
36 
39  XdmArray(const XdmArray &d);
40 
42 
45  virtual ~XdmArray(){
46  fname.clear();
47 
48  }
49 
51 
54  XdmArray(jobject obj);
55 
56 
57 
59 
63  XdmArray(jobject obj, int len);
64 
65 
67 
72  int arrayLength();
73 
82  XdmValue* get(int n);
83 
95  XdmArray* put(int n, XdmValue * value);
96 
104 
113 
118  std::list<XdmValue *> asList();
119 
127  return (new XdmValue*[len]);
128  }
129 
130 
135  XdmValue** values();
136 
142  int getArity(){return 1;}
143 
149  bool isFunction(){
150  return true;
151  }
152 
156  XDM_TYPE getType() {
157  return XDM_ARRAY;
158  }
159 
161 
165  bool isArray(){
166  return true;
167  }
168 
170 
192  const char * toString();
193 
194 
195 
196 private:
197  int arrayLen;
198 
199 
200 
201 };
202 
203 
204 
205 
206 #endif
Definition: XdmArray.h:25
virtual ~XdmArray()
Destructor.
Definition: XdmArray.h:45
XdmArray * addMember(XdmValue *value)
Definition: XdmArray.cpp:130
std::list< XdmValue * > asList()
Definition: XdmArray.cpp:180
bool isFunction()
Definition: XdmArray.h:149
XdmArray * concat(XdmArray *value)
Definition: XdmArray.cpp:154
XdmArray * put(int n, XdmValue *value)
Definition: XdmArray.cpp:101
XdmArray()
XdmArray default constructor.
Definition: XdmArray.cpp:5
int arrayLength()
Get the number of members in the array.
Definition: XdmArray.cpp:21
bool isArray()
Determine whether the item is an array or some other type of item.
Definition: XdmArray.h:165
XDM_TYPE getType()
Definition: XdmArray.h:156
XdmValue ** values()
Definition: XdmArray.cpp:225
XdmValue * get(int n)
Definition: XdmArray.cpp:49
int getArity()
Definition: XdmArray.h:142
const char * toString()
The toString() method returns a simple XML serialization of the node with defaulted serialization par...
Definition: XdmArray.cpp:80
XdmValue ** createXdmValueArray(int len)
Definition: XdmArray.h:126
Definition: XdmFunctionItem.h:23
std::string fname
Definition: XdmFunctionItem.h:137
jobject value
Definition: XdmItem.h:163
Definition: XdmValue.h:50