SaxonC 12.4
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 void addUnderlyingValue(int64_t val);
80
82
89 XdmValue(int64_t val, bool arrFlag);
90
92
96 XdmValue(int64_t val);
97
99
102 virtual ~XdmValue();
103
106 /*
107 *
108 */
109 void releaseXdmValue();
110
112
116 virtual XdmItem *getHead();
117
119
128 virtual XdmItem *itemAt(int n);
129
134 virtual int size();
135
137
142 virtual const char *toString();
143
145
149 if (getenv("SAXONC_DEBUG_FLAG")) {
150 std::cerr << "getRefCount-xdmVal=" << refCount << " ob ref=" << (this)
151 << std::endl;
152 }
153 return refCount;
154 }
155
158
161 virtual void incrementRefCount();
162
165
168 virtual void decrementRefCount();
169
174 virtual int64_t getUnderlyingValue();
175
179 virtual XDM_TYPE getType();
180
181protected:
183 inline void initialize() {
184 jValues = -1;
185 refCount = 0;
186 valueType = nullptr;
187 xdmSize = 0;
188 toStringValue = nullptr;
189 values_cap = 0;
190 values = nullptr;
191 relinquished_values = nullptr;
192 // relinquished_values[0] = 0;
193 }
194
195 char *valueType;
198 char *relinquished_values;
199 int values_cap;
203private:
204 char *toStringValue;
206 int64_t jValues;
208};
209
210#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
virtual int64_t getUnderlyingValue()
Definition XdmValue.cpp:234
int refCount
Definition XdmValue.h:201
int xdmSize
Definition XdmValue.h:200
void addXdmItem(XdmItem *val)
Definition XdmValue.cpp:150
virtual XDM_TYPE getType()
Definition XdmValue.cpp:280
int getRefCount()
Get the number of references on this XdmValue.
Definition XdmValue.h:148
virtual ~XdmValue()
Destructor.
Definition XdmValue.cpp:117
virtual const char * toString()
Create a string representation of the value.
Definition XdmValue.cpp:29
XdmItem ** values
Definition XdmValue.h:197
virtual XdmItem * itemAt(int n)
Get the n'th item in the value, counting from zero.
Definition XdmValue.cpp:269
virtual void incrementRefCount()
Definition XdmValue.cpp:208
XdmValue * addXdmValueWithType(const char *tStr, const char *val)
Add an XdmItem to the sequence.
virtual void decrementRefCount()
Definition XdmValue.cpp:216
virtual XdmItem * getHead()
Get the first item in the sequence.
Definition XdmValue.cpp:225
char * valueType
Definition XdmValue.h:195
void initialize()
initialize this XdmValue with default values
Definition XdmValue.h:183
XdmValue()
A default Constructor.
Definition XdmValue.h:49
void releaseXdmValue()
Definition XdmValue.cpp:259
void addUnderlyingValue(int64_t val)
Definition XdmValue.cpp:190
virtual int size()
Definition XdmValue.cpp:53