SaxonC 12.8.0
Saxon Processor library for C/C++, PHP and Python
Loading...
Searching...
No Matches
XdmMap.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_XDM_MAP_h
11#define SAXON_XDM_MAP_h
12
13#include "saxonc_export.h"
14#include "saxonc/XdmArray.h"
15#include "saxonc/XdmFunctionItem.h"
16#include <string>
17
18#include <map>
19#include <set>
20#include <stdlib.h>
21#include <string.h>
22
30class SAXONC_EXPORT XdmMap : public XdmFunctionItem {
31
32public:
37 XdmMap();
38
43 XdmMap(const XdmMap &d);
44
48 virtual ~XdmMap() {}
49
54 XdmMap(int64_t obj);
55
61 XdmMap(std::map<XdmAtomicValue *, XdmValue *> map);
62
69 int mapSize();
70
80
94 XdmValue *get(const char *key);
95
109 XdmValue *get(int key);
110
123 XdmValue *get(double key);
124
137 XdmValue *get(long key);
138
149
160
166 std::set<XdmAtomicValue *> keySet();
167
174
175 // std::map<XdmAtomicValue*, XdmValue*> asMap();
176
181 bool isEmpty();
182
193 bool containsKey(XdmAtomicValue *key);
194
202 std::list<XdmValue *> valuesAsList();
203
211 XdmValue **values();
212
217 bool isFunction() { return true; }
218
223 bool isMap() { return true; }
224
229 XDM_TYPE getType() { return XDM_MAP; }
230
238 const char *toString(const char *encoding = nullptr);
239
240};
241
242#endif
The class XdmAtomicValue represents an item in an XPath sequence that is an atomic value.
Definition XdmAtomicValue.h:27
XdmFunctionItem()
Default constructor.
Definition XdmFunctionItem.cpp:13
const char * toString(const char *encoding=nullptr)
Create a string representation of the item.
Definition XdmItem.cpp:71
A map in the XDM data model.
Definition XdmMap.h:30
virtual ~XdmMap()
Destructor method for XdmMap.
Definition XdmMap.h:48
XdmMap * put(XdmAtomicValue *key, XdmValue *value)
Create a new map containing an additional (key, value) pair.
Definition XdmMap.cpp:112
std::set< XdmAtomicValue * > keySet()
Get the keys present in the map in the form of an unordered std::set.
Definition XdmMap.cpp:142
XdmValue * get(XdmAtomicValue *key)
Returns the value to which the specified key is mapped, or NULL if this map contains no mapping for t...
Definition XdmMap.cpp:43
bool isFunction()
Determine whether the item is a function or some other type of item.
Definition XdmMap.h:217
bool isEmpty()
Check if this map is empty.
Definition XdmMap.cpp:186
int mapSize()
Get the number of entries in the map.
Definition XdmMap.cpp:36
XdmMap * remove(XdmAtomicValue *key)
Create a new map in which the entry for a given key has been removed.
Definition XdmMap.cpp:128
std::list< XdmValue * > valuesAsList()
Returns a std::list containing the values found in this map, that is, the value parts of the key-valu...
Definition XdmMap.cpp:205
bool isMap()
Determine whether the item is an XDM map or some other type of item.
Definition XdmMap.h:223
XdmMap()
Default constructor.
Definition XdmMap.cpp:9
XDM_TYPE getType()
Get the type of this XDM value.
Definition XdmMap.h:229
bool containsKey(XdmAtomicValue *key)
Returns true if this map contains a mapping for the specified key.
Definition XdmMap.cpp:195
XdmAtomicValue ** keys()
Get the keys present in the map in the form of an unordered pointer array of XdmAtomicValues.
Definition XdmMap.cpp:162
XdmMap(std::map< XdmAtomicValue *, XdmValue * > map)
Create an XdmMap supplying the entries in the form of a std::map.
int64_t value
Definition XdmValue.h:214
XdmItem ** values
Definition XdmValue.h:208
XdmValue()
Default constructor.
Definition XdmValue.h:40