SaxonC 12.8.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 std::cerr<<"C++ XdmValue equals operator called !!!!"<<std::endl;
58 return false;
59 /*char result = j_xdmNodeEquals(SaxonProcessor::sxn_environ->thread, (void *)value, (void *)other.value);
60 if((int)result == SXN_EXCEPTION) {
61 throw SaxonApiException();
62 }
63 return result != 0;*/
64 }
65
70 void addXdmItemFromUnderlyingValue(XdmItem *val);
71
77 void addUnderlyingValue(int64_t val);
78
87 XdmValue(int64_t val, bool arrFlag);
88
93 XdmValue(int64_t val);
94
98 virtual ~XdmValue();
99
105 void releaseXdmValue();
106
113 virtual XdmItem *getHead();
114
126 virtual XdmItem *itemAt(int n);
127
132 virtual int size();
133
142 virtual const char *toString(const char *encoding = nullptr);
143
149 if (getenv("SAXONC_DEBUG_FLAG")) {
150 std::cerr << "getRefCount-xdmVal=" << refCount << " ob ref=" << (this)
151 << std::endl;
152 }
153 return refCount;
154 }
155
160 virtual void incrementRefCount();
161
166 virtual void decrementRefCount();
167
172 virtual int64_t getUnderlyingValue();
173
178 virtual XDM_TYPE getType();
179
183 void resetRelinquishedItems();
184
188 void incrementRefCountForRelinquishedValue(int i);
189
190protected:
194 inline void initialize() {
195 jValues = SXN_UNSET;
196 refCount = 0;
197 valueType = nullptr;
198 xdmSize = 0;
199 toStringValue = nullptr;
200 values_cap = 0;
201 values = nullptr;
202 relinquished_values = nullptr;
203 // relinquished_values[0] = 0;
204 }
205
206 char *valueType;
214 int64_t value;
216private:
217 char *toStringValue;
219 int64_t jValues;
222 int addXdmItemToValue(XdmItem *val);
223};
224
225#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:148
XdmItem ** values
Definition XdmValue.h:208
char * valueType
Definition XdmValue.h:206
void initialize()
Initialize this XdmValue with default values.
Definition XdmValue.h:194
XdmValue()
Default constructor.
Definition XdmValue.h:40