SaxonC 12.9.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
33class SAXONC_EXPORT XdmValue {
34
35public:
40 XdmValue() { initialize(); }
41
46 XdmValue(const XdmValue &other);
47
53 void addXdmItem(XdmItem *val);
54
55 virtual bool operator==(const XdmValue& other) const
56 {
57 return false;
58 /*char result = j_xdmNodeEquals(SaxonProcessor::sxn_environ->thread, (void *)value, (void *)other.value);
59 if((int)result == SXN_EXCEPTION) {
60 throw SaxonApiException();
61 }
62 return result != 0;*/
63 }
64
69 void addXdmItemFromUnderlyingValue(XdmItem *val);
70
76 void addUnderlyingValue(int64_t val);
77
86 XdmValue(int64_t val, bool arrFlag);
87
92 XdmValue(int64_t val);
93
97 virtual ~XdmValue();
98
104 void releaseXdmValue();
105
112 virtual XdmItem *getHead();
113
125 virtual XdmItem *itemAt(int n);
126
131 virtual int size();
132
141 virtual const char *toString(const char *encoding = nullptr);
142
148 if (getenv("SAXONC_DEBUG_FLAG")) {
149 std::cerr << "getRefCount-xdmVal=" << refCount << " ob ref=" << (this)
150 << std::endl;
151 }
152 return refCount;
153 }
154
159 virtual void incrementRefCount();
160
165 virtual void decrementRefCount();
166
171 virtual int64_t getUnderlyingValue();
172
177 virtual XDM_TYPE getType();
178
182 void resetRelinquishedItems();
183
187 void incrementRefCountForRelinquishedValue(int i);
188
189protected:
193 inline void initialize() {
194 jValues = SXN_UNSET;
195 refCount = 0;
196 valueType = nullptr;
197 xdmSize = 0;
198 toStringValue = nullptr;
199 values_cap = 0;
200 values = nullptr;
201 emptyValue = SXN_UNSET;
202 relinquished_values = nullptr;
203 // relinquished_values[0] = 0;
204 }
205
206 char *valueType;
214 int64_t value;
215 int64_t emptyValue;
217private:
218 char *toStringValue;
220 int64_t jValues;
223 int addXdmItemToValue(XdmItem *val);
224};
225
226#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:33
int values_cap
Definition XdmValue.h:210
int64_t value
Definition XdmValue.h:214
int refCount
Definition XdmValue.h:212
char * relinquished_values
Definition XdmValue.h:209
int xdmSize
Definition XdmValue.h:211
int getRefCount()
Get the number of references on this XdmValue - internal use only This method is used for internal me...
Definition XdmValue.h:147
XdmItem ** values
Definition XdmValue.h:208
int64_t emptyValue
Definition XdmValue.h:215
char * valueType
Definition XdmValue.h:206
void initialize()
Initialize this XdmValue with default values.
Definition XdmValue.h:193
XdmValue()
Default constructor.
Definition XdmValue.h:40