![]() |
SaxonC 12.7.0
Saxon Processor library for C/C++, PHP and Python
|
A map in the XDM data model. More...
#include <XdmMap.h>
Public Member Functions | |
XdmMap () | |
Default constructor. | |
XdmMap (const XdmMap &d) | |
XdmItem copy constructor. | |
virtual | ~XdmMap () |
Destructor method for XdmMap. | |
XdmMap (int64_t obj) | |
XdmMap constructor to create an object which is a wrapper for a Java XdmMap object - internal use only. | |
XdmMap (std::map< XdmAtomicValue *, XdmValue * > map) | |
Create an XdmMap supplying the entries in the form of a std::map. | |
int | mapSize () |
Get the number of entries in the map. | |
XdmValue * | get (XdmAtomicValue *key) |
Returns the value to which the specified key is mapped, or NULL if this map contains no mapping for the key. | |
XdmValue * | get (const char *key) |
Returns the value to which the specified string-valued key is mapped, or NULL if this map contains no mapping for the key. | |
XdmValue * | get (int key) |
Returns the value to which the specified integer-valued key is mapped or NULL if this map contains no mapping for the key. | |
XdmValue * | get (double key) |
Returns the value to which the specified double-valued key is mapped, or NULL if this map contains no mapping for the key. | |
XdmValue * | get (long key) |
Returns the value to which the specified integer-valued key is mapped or NULL if this map contains no mapping for the key. | |
XdmMap * | put (XdmAtomicValue *key, XdmValue *value) |
Create a new map containing an additional (key, value) pair. | |
XdmMap * | remove (XdmAtomicValue *key) |
Create a new map in which the entry for a given key has been removed. | |
std::set< XdmAtomicValue * > | keySet () |
Get the keys present in the map in the form of an unordered std::set. | |
XdmAtomicValue ** | keys () |
Get the keys present in the map in the form of an unordered pointer array of XdmAtomicValues. | |
bool | isEmpty () |
Check if this map is empty. | |
bool | containsKey (XdmAtomicValue *key) |
Returns true if this map contains a mapping for the specified key. | |
std::list< XdmValue * > | valuesAsList () |
Returns a std::list containing the values found in this map, that is, the value parts of the key-value pairs. | |
XdmValue ** | values () |
Returns a pointer array containing the values found in this map, that is, the value parts of the key-value pairs. | |
bool | isFunction () |
Determine whether the item is a function or some other type of item. | |
bool | isMap () |
Determine whether the item is an XDM map or some other type of item. | |
XDM_TYPE | getType () |
Get the type of this XDM value. | |
const char * | toString (const char *encoding=nullptr) |
Create a string representation of the XDM map. | |
![]() | |
XdmFunctionItem () | |
Default constructor. | |
XdmFunctionItem (int64_t obj) | |
XdmFunctionItem constructor to create an object which is a wrapper for a Java XdmFunctionItem object - internal use only. | |
XdmFunctionItem (const XdmFunctionItem &d) | |
XdmFunctionItem copy constructor. | |
virtual | ~XdmFunctionItem () |
Destructor method for XdmFunctionItem. | |
const char * | getName () |
Get the name of the function as an EQName. | |
virtual int | getArity () |
Get the arity of the function. | |
const char * | getStringValue (const char *encoding=nullptr) |
Get the string value of the XdmFunctionItem. | |
XdmValue * | call (SaxonProcessor *processor, XdmValue **arguments, int argument_length) |
Call the function. | |
bool | isAtomic () |
Determine whether the item is an atomic value or some other type of item. | |
![]() | |
XdmItem () | |
Default constructor. | |
XdmItem (int64_t objRef) | |
XdmItem constructor to create an object which is a wrapper for a Java XdmItem object - internal use only. | |
XdmItem (const XdmItem &item) | |
XdmItem copy constructor. | |
bool | operator== (const XdmItem &other) const |
virtual | ~XdmItem () |
Destructor method for XdmItem. | |
virtual void | incrementRefCount () |
Increment reference count of this XdmItem - internal use only. | |
virtual void | decrementRefCount () |
Decrement reference count of this XdmItem - internal use only. | |
virtual bool | isNode () |
Determine whether the item is a node or some other type of item. | |
virtual bool | isArray () |
Determine whether the item is an XDM array or some other type of item. | |
virtual int64_t | getUnderlyingValue () |
Get the underlying Java XdmValue object - internal use only. | |
virtual XdmItem * | getHead () |
Get the first item in the sequence consisting of just this item. | |
XdmItem * | itemAt (int n) |
Get the n'th item in the sequence consisting of just this item, counting from zero. | |
int | size () |
Get the number of items in the sequence. | |
![]() | |
XdmValue () | |
Default constructor. | |
XdmValue (const XdmValue &other) | |
XdmValue copy constructor. | |
void | addXdmItem (XdmItem *val) |
Add an XdmItem to the sequence. | |
virtual bool | operator== (const XdmValue &other) const |
void | addXdmItemFromUnderlyingValue (XdmItem *val) |
Add an XdmItem to the sequence, when the sequence was returned from SaxonC - internal use only. | |
void | addUnderlyingValue (int64_t val) |
Add Java XdmValue object to the sequence. | |
XdmValue (int64_t val, bool arrFlag) | |
A Constructor for handling XdmArray - internal use only. | |
XdmValue (int64_t val) | |
XdmValue constructor to create an object which is a wrapper for a Java XdmValue object - internal use only. | |
virtual | ~XdmValue () |
Destructor method for XdmValue. | |
void | releaseXdmValue () |
Deprecated: this is deprecated and a no-op, the C++ destructor handles this case. | |
int | getRefCount () |
Get the number of references on this XdmValue - internal use only This method is used for internal memory management. | |
void | resetRelinquishedItems () |
Reset associated reference counts on XdmItems that have been relinquished - internal use only. | |
void | incrementRefCountForRelinquishedValue (int i) |
Increment the ref count for a relinquished item only once - internal use only. | |
Additional Inherited Members | |
![]() | |
static XdmFunctionItem * | getSystemFunction (SaxonProcessor *processor, const char *name, int arity) |
Get a system function. | |
![]() | |
XdmValue * | getXdmValueSubClass (int64_t value) |
![]() | |
void | initialize () |
Initialize this XdmValue with default values. | |
![]() | |
char * | fname |
![]() | |
const char * | stringValue |
const char * | itemToString |
![]() | |
char * | valueType |
XdmItem ** | values |
char * | relinquished_values |
int | values_cap |
int | xdmSize |
int | refCount |
int64_t | value |
A map in the XDM data model.
A map is a list of zero or more entries, each of which is a pair comprising a key (which is an atomic value) and a value (which is an arbitrary value). The map itself is an XDM item.
An XdmMap is immutable.
XdmMap::XdmMap | ( | ) |
Default constructor.
Creates an empty XdmMap
XdmMap::XdmMap | ( | int64_t | obj | ) |
XdmMap::XdmMap | ( | std::map< XdmAtomicValue *, XdmValue * > | map | ) |
Create an XdmMap supplying the entries in the form of a std::map.
The keys and values in the std::map are XDM values
map | - a std::map whose entries are the (key, value) pairs |
bool XdmMap::containsKey | ( | XdmAtomicValue * | key | ) |
Returns true
if this map contains a mapping for the specified key.
More formally, returns true if and only if this map contains a mapping for a key k such that (key==null ? k==null : key.equals(k))
. (There can be at most one such mapping.)
key | - the key whose presence in this map is to be tested |
XdmValue * XdmMap::get | ( | const char * | key | ) |
Returns the value to which the specified string-valued key is mapped, or NULL if this map contains no mapping for the key.
This is a convenience method to save the trouble of converting the String to an XdmAtomicValue
.
key | - the key whose associated value is to be returned. This is treated as an instance of xs:string (which will also match entries whose key is xs:untypedAtomic or xs:anyURI ) |
delete
. XdmValue * XdmMap::get | ( | double | key | ) |
Returns the value to which the specified double-valued key is mapped, or NULL if this map contains no mapping for the key.
This is a convenience method to save the trouble of converting the double to an XdmAtomicValue
.
key | - the key whose associated value is to be returned. This is treated as an instance of xs:double (which will also match entries whose key belongs to another numeric type) |
delete
. XdmValue * XdmMap::get | ( | int | key | ) |
Returns the value to which the specified integer-valued key is mapped or NULL if this map contains no mapping for the key.
This is a convenience method to save the trouble of converting the integer to an XdmAtomicValue
.
key | - the key whose associated value is to be returned. This is treated as an instance of xs:integer (which will also match entries whose key belongs to another numeric type) |
delete
. XdmValue * XdmMap::get | ( | long | key | ) |
Returns the value to which the specified integer-valued key is mapped or NULL if this map contains no mapping for the key.
This is a convenience method to save the trouble of converting the integer to an XdmAtomicValue
.
key | - the key whose associated value is to be returned. This is treated as an instance of xs:integer (which will also match entries whose key belongs to another numeric type) |
delete
. XdmValue * XdmMap::get | ( | XdmAtomicValue * | key | ) |
Returns the value to which the specified key is mapped, or NULL if this map contains no mapping for the key.
key | - the key whose associated value is to be returned. |
delete
.
|
inlinevirtual |
Get the type of this XDM value.
Reimplemented from XdmFunctionItem.
bool XdmMap::isEmpty | ( | ) |
Check if this map is empty.
|
inlinevirtual |
Determine whether the item is a function or some other type of item.
Reimplemented from XdmFunctionItem.
|
inlinevirtual |
Determine whether the item is an XDM map or some other type of item.
Reimplemented from XdmItem.
XdmAtomicValue ** XdmMap::keys | ( | ) |
Get the keys present in the map in the form of an unordered pointer array of XdmAtomicValues.
std::set< XdmAtomicValue * > XdmMap::keySet | ( | ) |
Get the keys present in the map in the form of an unordered std::set.
int XdmMap::mapSize | ( | ) |
Get the number of entries in the map.
size()
method returns 1 (one), because an XDM map is an item.) XdmMap * XdmMap::put | ( | XdmAtomicValue * | key, |
XdmValue * | value ) |
Create a new map containing an additional (key, value) pair.
If there is an existing entry with the same key, it is removed.
key | - the key for the new entry |
value | - the value for the new entry |
delete
. XdmMap * XdmMap::remove | ( | XdmAtomicValue * | key | ) |
Create a new map in which the entry for a given key has been removed.
If there is no entry with the same key, the new map has the same content as the old (it may or may not be the same object)
key | - the key to be removed given as an XdmAtomicValue |
delete
. The original map is unchanged.
|
virtual |
Create a string representation of the XDM map.
This is the result of serializing the map using the adaptive serialization method.
encoding | - the encoding of the string returned. If NULL or omitted defaults to the JVM encoding, which in most cases is UTF-8. |
operator delete
. Reimplemented from XdmItem.
XdmValue ** XdmMap::values | ( | ) |
Returns a pointer array containing the values found in this map, that is, the value parts of the key-value pairs.
delete
. std::list< XdmValue * > XdmMap::valuesAsList | ( | ) |
Returns a std::list containing the values found in this map, that is, the value parts of the key-value pairs.