Saxon/C  1.2.1
Saxon Processor library for C/C++, PHP and Python
XdmValue.h
1 // Copyright (c) 2014 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_XDMVALUE_H
9 #define SAXON_XDMVALUE_H
10 
11 
12 #include <string.h>
13 #include "SaxonProcessor.h"
14 #include <typeinfo> //used for testing only
15 #include <vector>
16 #include <deque>
17 #include <list>
18 #include "SaxonCGlue.h"
19 #include "SaxonCXPath.h"
20 
21 
27 class SaxonProcessor;
28 class XdmItem;
29 class XdmAtomicValue;
30 class XdmNode;
31 
32 
33 typedef enum eXdmType { XDM_VALUE = 1, XDM_ITEM = 2, XDM_NODE = 3, XDM_ATOMIC_VALUE = 4, XDM_FUNCTION_ITEM = 5 } XDM_TYPE;
34 
35 typedef enum saxonTypeEnum
36 {
37  enumNode,
38  enumString,
39  enumInteger,
40  enumDouble,
41  enumFloat,
42  enumBool,
43  enumArrXdmValue
44 } PRIMITIVE_TYPE;
45 
46 class XdmValue {
47 
48 
49 public:
54  xdmSize = 0;
55  refCount = 1;
56  jValues = NULL;
57  valueType = NULL;
58  proc = NULL;
59  }
60 
62  proc = p;
63  jValues = NULL;
64  refCount = 1;
65  valueType = NULL;
66  }
67 
68 
73  XdmValue(const XdmValue &other);
74 
79  //XdmValue(XdmValue * items, int length);
80 
81 
82 
87  //XdmValue(XdmItem *items, int length);
88 
94  XdmValue * addXdmValueWithType(const char * tStr, const char * val);//TODO check and document
95 
101  void addXdmItem(XdmItem *val);
102 
108  void addUnderlyingValue(jobject val);
109 
110 
111 
112 
118  XdmValue(jobject val, bool arrFlag);
119 
124  XdmValue(jobject val);
125 
126 
127  virtual ~XdmValue();
128 
129  void releaseXdmValue();
130 
131 
136  virtual XdmItem * getHead();
137 
146  virtual XdmItem * itemAt(int n);
147 
152  virtual int size();
153 
154 
160  virtual const char * toString();
161 
162  int getRefCount() {
163  return refCount;
164  }
165 
166 
167 
168  virtual void incrementRefCount();
169 
170  virtual void decrementRefCount();
171 
172  void setProcessor(SaxonProcessor *p);
173 
174 
175  /*const char * getErrorMessage(int i);
176  const char * getErrorCode(int i);
177 int exceptionCount();*/
178  const char * checkFailures() { return failure; }
179 
184  virtual jobject getUnderlyingValue();
185 
189  virtual XDM_TYPE getType();
190 
191 protected:
192  SaxonProcessor *proc;
193  char* valueType;
196  std::vector<XdmItem*> values;
197  int xdmSize;
198  int refCount;
199 private:
200  std::string toStringValue;
201  jobjectArray jValues;
202 };
203 
204 #endif
char * valueType
Definition: XdmValue.h:193
Definition: XdmAtomicValue.h:20
virtual const char * toString()
Definition: XdmValue.cpp:21
void addUnderlyingValue(jobject val)
Definition: XdmValue.cpp:161
virtual XdmItem * itemAt(int n)
Definition: XdmValue.cpp:218
Definition: XdmNode.h:21
void addXdmItem(XdmItem *val)
Definition: XdmValue.cpp:152
Definition: XdmValue.h:46
virtual XDM_TYPE getType()
Definition: XdmValue.cpp:228
virtual jobject getUnderlyingValue()
Definition: XdmValue.cpp:193
Definition: SaxonProcessor.h:296
Definition: XdmItem.h:15
XdmValue()
Definition: XdmValue.h:53
int xdmSize
Definition: XdmValue.h:197
virtual int size()
Definition: XdmValue.cpp:60
XdmValue * addXdmValueWithType(const char *tStr, const char *val)
virtual XdmItem * getHead()
Definition: XdmValue.cpp:184