SaxonC 12.5
Saxon Processor library for C/C++, PHP and Python
Loading...
Searching...
No Matches
XdmValue.h
1
2// Copyright (c) 2022 - 2023 Saxonica Limited.
3// This Source Code Form is subject to the terms of the Mozilla Public License,
4// v. 2.0. If a copy of the MPL was not distributed with this file, You can
5// obtain one at http://mozilla.org/MPL/2.0/. This Source Code Form is
6// "Incompatible With Secondary Licenses", as defined by the Mozilla Public
7// License, v. 2.0.
9
10#ifndef SAXON_XDMVALUE_H
11#define SAXON_XDMVALUE_H
12
13#include "SaxonCGlue.h"
14#include "SaxonCXPath.h"
15#include "SaxonProcessor.h"
16#include <deque>
17#include <list>
18#include <string.h>
19#include <typeinfo> //used for testing only
20#include <vector>
21
22class SaxonProcessor;
23class XdmItem;
24class XdmAtomicValue;
25class XdmNode;
26
27typedef enum saxonTypeEnum {
28 enumNode,
29 enumString,
30 enumInteger,
31 enumDouble,
32 enumFloat,
33 enumBool,
34 enumArrXdmValue
35} PRIMITIVE_TYPE;
36
42class XdmValue {
43
44public:
46
50
52
56 XdmValue(const XdmValue &other);
57
59
64 XdmValue *addXdmValueWithType(const char *tStr,
65 const char *val); // TODO check and document
66
72 void addXdmItem(XdmItem *val);
73
79
85 void addUnderlyingValue(int64_t val);
86
88
95 XdmValue(int64_t val, bool arrFlag);
96
98
102 XdmValue(int64_t val);
103
105
108 virtual ~XdmValue();
109
113 /*
114 *! @deprecated
115 */
116 void releaseXdmValue();
117
119
124 virtual XdmItem *getHead();
125
127
137 virtual XdmItem *itemAt(int n);
138
143 virtual int size();
144
146
151 virtual const char *toString();
152
154
158 if (getenv("SAXONC_DEBUG_FLAG")) {
159 std::cerr << "getRefCount-xdmVal=" << refCount << " ob ref=" << (this)
160 << std::endl;
161 }
162 return refCount;
163 }
164
167
170 virtual void incrementRefCount();
171
174
177 virtual void decrementRefCount();
178
183 virtual int64_t getUnderlyingValue();
184
188 virtual XDM_TYPE getType();
189
194
199
200protected:
202 inline void initialize() {
203 jValues = SXN_UNSET;
204 refCount = 0;
205 valueType = nullptr;
206 xdmSize = 0;
207 toStringValue = nullptr;
208 values_cap = 0;
209 values = nullptr;
210 relinquished_values = nullptr;
211 // relinquished_values[0] = 0;
212 }
213
214 char *valueType;
223private:
224 char *toStringValue;
226 int64_t jValues;
229 int addXdmItemToValue(XdmItem *val);
230};
231
232#endif
This C header file contains a number of factory functions for running SaxonC C/C++ APIs,...
SaxonCXPath.h provides the C API for XPath processing. This file contains a set of functions to compi...
Definition SaxonProcessor.h:117
Definition XdmAtomicValue.h:26
Definition XdmItem.h:30
Definition XdmNode.h:56
Definition XdmValue.h:42
int values_cap
Definition XdmValue.h:218
virtual int64_t getUnderlyingValue()
Definition XdmValue.cpp:300
void addXdmItemFromUnderlyingValue(XdmItem *val)
Definition XdmValue.cpp:232
void resetRelinquishedItems()
Definition XdmValue.cpp:118
void incrementRefCountForRelinquishedValue(int i)
Definition XdmValue.cpp:270
int refCount
Definition XdmValue.h:220
char * relinquished_values
Definition XdmValue.h:217
int xdmSize
Definition XdmValue.h:219
void addXdmItem(XdmItem *val)
Definition XdmValue.cpp:181
virtual XDM_TYPE getType()
Definition XdmValue.cpp:347
int getRefCount()
Get the number of references on this XdmValue.
Definition XdmValue.h:157
virtual ~XdmValue()
Destructor.
Definition XdmValue.cpp:136
virtual const char * toString()
Create a string representation of the value.
Definition XdmValue.cpp:29
XdmItem ** values
Definition XdmValue.h:216
virtual XdmItem * itemAt(int n)
Get the n'th item in the value, counting from zero.
Definition XdmValue.cpp:336
virtual void incrementRefCount()
Definition XdmValue.cpp:262
XdmValue * addXdmValueWithType(const char *tStr, const char *val)
Add an XdmItem to the sequence.
virtual void decrementRefCount()
Definition XdmValue.cpp:280
virtual XdmItem * getHead()
Get the first item in the sequence.
Definition XdmValue.cpp:290
char * valueType
Definition XdmValue.h:214
void initialize()
initialize this XdmValue with default values
Definition XdmValue.h:202
XdmValue()
A default Constructor.
Definition XdmValue.h:49
void releaseXdmValue()
Definition XdmValue.cpp:326
void addUnderlyingValue(int64_t val)
Definition XdmValue.cpp:238
virtual int size()
Definition XdmValue.cpp:54