SaxonC 12.7.0
Saxon Processor library for C/C++, PHP and Python
Loading...
Searching...
No Matches
XdmValue.h
1
2// Copyright (c) 2022 - 2025 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 "saxonc_export.h"
14#include "saxonc/SaxonCGlue.h"
15#include "saxonc/SaxonCXPath.h"
16#include "saxonc/SaxonProcessor.h"
17#include <deque>
18#include <list>
19#include <string.h>
20#include <typeinfo> //used for testing only
21#include <vector>
22
23class SaxonProcessor;
24class XdmItem;
25class XdmAtomicValue;
26class XdmNode;
27
28typedef enum saxonTypeEnum {
29 enumNode,
30 enumString,
31 enumInteger,
32 enumDouble,
33 enumFloat,
34 enumBool,
35 enumArrXdmValue
36} PRIMITIVE_TYPE;
37
43class SAXONC_EXPORT XdmValue {
44
45public:
50 XdmValue() { initialize(); }
51
56 XdmValue(const XdmValue &other);
57
63 void addXdmItem(XdmItem *val);
64
65 virtual bool operator==(const XdmValue& other) const
66 {
67 std::cerr<<"C++ XdmValue equals operator called !!!!"<<std::endl;
68 return false;
69 /*char result = j_xdmNodeEquals(SaxonProcessor::sxn_environ->thread, (void *)value, (void *)other.value);
70 if((int)result == SXN_EXCEPTION) {
71 throw SaxonApiException();
72 }
73 return result != 0;*/
74 }
75
80 void addXdmItemFromUnderlyingValue(XdmItem *val);
81
87 void addUnderlyingValue(int64_t val);
88
97 XdmValue(int64_t val, bool arrFlag);
98
103 XdmValue(int64_t val);
104
108 virtual ~XdmValue();
109
115 void releaseXdmValue();
116
123 virtual XdmItem *getHead();
124
136 virtual XdmItem *itemAt(int n);
137
142 virtual int size();
143
152 virtual const char *toString(const char *encoding = nullptr);
153
159 if (getenv("SAXONC_DEBUG_FLAG")) {
160 std::cerr << "getRefCount-xdmVal=" << refCount << " ob ref=" << (this)
161 << std::endl;
162 }
163 return refCount;
164 }
165
170 virtual void incrementRefCount();
171
176 virtual void decrementRefCount();
177
182 virtual int64_t getUnderlyingValue();
183
188 virtual XDM_TYPE getType();
189
193 void resetRelinquishedItems();
194
198 void incrementRefCountForRelinquishedValue(int i);
199
200protected:
204 inline void initialize() {
205 jValues = SXN_UNSET;
206 refCount = 0;
207 valueType = nullptr;
208 xdmSize = 0;
209 toStringValue = nullptr;
210 values_cap = 0;
211 values = nullptr;
212 relinquished_values = nullptr;
213 // relinquished_values[0] = 0;
214 }
215
216 char *valueType;
224 int64_t value;
226private:
227 char *toStringValue;
229 int64_t jValues;
232 int addXdmItemToValue(XdmItem *val);
233};
234
235#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...
SAXONC_EXPORT int size(sxnc_environment *environi, sxnc_value val)
Get the number of items in the sequence.
Definition SaxonCXPath.c:228
The SaxonProcessor class acts as a factory for generating XQuery, XPath, Schema and XSLT compilers.
Definition SaxonProcessor.h:117
The class XdmAtomicValue represents an item in an XPath sequence that is an atomic value.
Definition XdmAtomicValue.h:27
The class XdmItem represents an item in a sequence, as defined by the XDM data model.
Definition XdmItem.h:31
This class represents a node in the XDM data model.
Definition XdmNode.h:57
An XdmValue represents a value in the XDM data model.
Definition XdmValue.h:43
int values_cap
Definition XdmValue.h:220
int64_t value
Definition XdmValue.h:224
int refCount
Definition XdmValue.h:222
char * relinquished_values
Definition XdmValue.h:219
int xdmSize
Definition XdmValue.h:221
int getRefCount()
Get the number of references on this XdmValue - internal use only This method is used for internal me...
Definition XdmValue.h:158
XdmItem ** values
Definition XdmValue.h:218
char * valueType
Definition XdmValue.h:216
void initialize()
Initialize this XdmValue with default values.
Definition XdmValue.h:204
XdmValue()
Default constructor.
Definition XdmValue.h:50