SaxonC 12.5
Saxon Processor library for C/C++, PHP and Python
Loading...
Searching...
No Matches
Public Member Functions | List of all members
XdmMap Class Reference

#include <XdmMap.h>

Inheritance diagram for XdmMap:
XdmFunctionItem XdmItem XdmValue

Public Member Functions

 XdmMap ()
 Default constructor.
 
 XdmMap (const XdmMap &d)
 Copy constructor.
 
virtual ~XdmMap ()
 Destructor.
 
 XdmMap (int64_t obj)
 
 XdmMap (std::map< XdmAtomicValue *, XdmValue * > map)
 
int mapSize ()
 Get the number of entries in the map.
 
XdmValueget (XdmAtomicValue *key)
 
XdmValueget (const char *key)
 
XdmValueget (int key)
 
XdmValueget (double key)
 
XdmValueget (long key)
 
XdmMapput (XdmAtomicValue *key, XdmValue *value)
 Create a new map containing an additional (key, value) pair.
 
XdmMapremove (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 ()
 
bool isEmpty ()
 Returns true if this map contains no key-value mappings.
 
bool containsKey (XdmAtomicValue *key)
 
std::list< XdmValue * > valuesAsList ()
 
XdmValue ** values ()
 
bool isFunction ()
 Determine whether the item is a function or some other type of item.
 
bool isMap ()
 Determine whether the item is a map or some other type of item.
 
XDM_TYPE getType ()
 Get the type of the object.
 
const char * toString ()
 
- Public Member Functions inherited from XdmFunctionItem
 XdmFunctionItem ()
 Default constructor for XdmFunctionItem.
 
 XdmFunctionItem (int64_t obj)
 XdmFunctionItem constructor created from a Java object - internal use.
 
 XdmFunctionItem (const XdmFunctionItem &d)
 Copy constructor.
 
virtual ~XdmFunctionItem ()
 Destructor.
 
const char * getName ()
 Get the name of the function as EQName.
 
virtual int getArity ()
 Get the arity of the function.
 
const char * getStringValue ()
 Get the string value of the XdmArray item.
 
XdmValue ** createXdmValueArray (int len)
 
XdmValuecall (SaxonProcessor *processor, XdmValue **arguments, int argument_length)
 Call the function.
 
bool isAtomic ()
 
- Public Member Functions inherited from XdmItem
 XdmItem ()
 XdmItem default constructor.
 
 XdmItem (int64_t)
 
 XdmItem (const XdmItem &item)
 Copy constructor.
 
virtual ~XdmItem ()
 Destructor.
 
virtual void incrementRefCount ()
 
virtual void decrementRefCount ()
 
virtual bool isNode ()
 
virtual bool isArray ()
 
virtual int64_t getUnderlyingValue ()
 
virtual XdmItemgetHead ()
 
XdmItemitemAt (int n)
 
int size ()
 
- Public Member Functions inherited from XdmValue
 XdmValue ()
 A default Constructor.
 
 XdmValue (const XdmValue &other)
 A copy constructor.
 
XdmValueaddXdmValueWithType (const char *tStr, const char *val)
 Add an XdmItem to the sequence.
 
void addXdmItem (XdmItem *val)
 
void addXdmItemFromUnderlyingValue (XdmItem *val)
 
void addUnderlyingValue (int64_t val)
 
 XdmValue (int64_t val, bool arrFlag)
 A Constructor for handling XdmArray - Internal user only.
 
 XdmValue (int64_t val)
 A Constructor.
 
virtual ~XdmValue ()
 Destructor.
 
void releaseXdmValue ()
 
int getRefCount ()
 Get the number of references on this XdmValue.
 
void resetRelinquishedItems ()
 
void incrementRefCountForRelinquishedValue (int i)
 

Additional Inherited Members

- Static Public Member Functions inherited from XdmFunctionItem
static XdmFunctionItemgetSystemFunction (SaxonProcessor *processor, const char *name, int arity)
 Get a system function.
 
- Protected Member Functions inherited from XdmFunctionItem
XdmValuegetXdmValueSubClass (int64_t value)
 
- Protected Member Functions inherited from XdmValue
void initialize ()
 initialize this XdmValue with default values
 
- Protected Attributes inherited from XdmFunctionItem
char * fname
 
- Protected Attributes inherited from XdmItem
int64_t value
 
const char * stringValue
 
const char * itemToString
 
- Protected Attributes inherited from XdmValue
char * valueType
 
XdmItem ** values
 
char * relinquished_values
 
int values_cap
 
int xdmSize
 
int refCount
 

Detailed Description

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.

Since
11

Constructor & Destructor Documentation

◆ XdmMap() [1/4]

XdmMap::XdmMap ( )

Default constructor.

Create an empty XdmMap

◆ XdmMap() [2/4]

XdmMap::XdmMap ( const XdmMap & d)

Copy constructor.

Copy constructor for XdmMap

◆ ~XdmMap()

virtual XdmMap::~XdmMap ( )
inlinevirtual

Destructor.

Destructor for XdmMap

◆ XdmMap() [3/4]

XdmMap::XdmMap ( int64_t obj)

XdmMap constructor which is a wrapper object from the Java XdmMap object - internal use

Parameters
obj- The internal Java object for the XdmMap is wrapped here in the C++ XdmMap

◆ XdmMap() [4/4]

XdmMap::XdmMap ( std::map< XdmAtomicValue *, XdmValue * > map)

Create an XdmMap supplying the entries in the form of a std::map, where the keys and values in the std::map are XDM values

Parameters
map- a std::map whose entries are the (key, value) pairs

Member Function Documentation

◆ containsKey()

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.)

Parameters
keykey whose presence in this map is to be tested
Returns
true if this map contains a mapping for the specified key

◆ get() [1/5]

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.

Parameters
keythe 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)
Returns
the value to which the specified key is mapped, or NULL if this map contains no mapping for the key

◆ get() [2/5]

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.

Parameters
keythe 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)
Returns
the value to which the specified key is mapped, or NULL if this map contains no mapping for the key

◆ get() [3/5]

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.

Parameters
keythe 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)
Returns
the value to which the specified key is mapped, or NULL if this map contains no mapping for the key

◆ get() [4/5]

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.

Parameters
keythe 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)
Returns
the value to which the specified key is mapped, or NULL if this map contains no mapping for the key

◆ get() [5/5]

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.

Parameters
keythe key whose associated value is to be returned.
Returns
the value to which the specified key is mapped, or NULL if this map contains no mapping for the key
Remarks
if null is returned check getException method on the SaxonProcessor object for errors

◆ getType()

XDM_TYPE XdmMap::getType ( )
inlinevirtual

Get the type of the object.

Reimplemented from XdmFunctionItem.

◆ isEmpty()

bool XdmMap::isEmpty ( )

Returns true if this map contains no key-value mappings.

Returns
true if this map contains no key-value mappings

◆ isFunction()

bool XdmMap::isFunction ( )
inlinevirtual

Determine whether the item is a function or some other type of item.

Returns
true if the item is a Xdm function item, false if it is an atomic value or a function (including maps and arrays)

Reimplemented from XdmFunctionItem.

◆ isMap()

bool XdmMap::isMap ( )
inlinevirtual

Determine whether the item is a map or some other type of item.

Returns
true if the item is a Xdm map item, false if it is some other type

Reimplemented from XdmItem.

◆ keys()

XdmAtomicValue ** XdmMap::keys ( )

Get the keys present in the map in the form of an unordered pointer array of XdmAtomicValue.

Returns
an unordered pointer array of the keys present in this map, in arbitrary order.

◆ keySet()

std::set< XdmAtomicValue * > XdmMap::keySet ( )

Get the keys present in the map in the form of an unordered std::set.

Returns
an unordered std::set of the keys present in this map, in arbitrary order.

◆ mapSize()

int XdmMap::mapSize ( )

Get the number of entries in the map.

Returns
the number of entries in the map. (Note that the size() method returns 1 (one), because an XDM map is an item.)

◆ put()

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

Returns
a new map containing the additional entry. The original map is unchanged.

◆ remove()

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 Java object)

Parameters
key- The key to be removed given as an XdmAtomicValue
Returns
a map without the specified entry. The original map is unchanged.

◆ toString()

const char * XdmMap::toString ( )
virtual

The toString() method returns a simple XML serialization of the node with defaulted serialization parameters.

In the case of an element node, the result will be a well-formed XML document serialized as defined in the W3C XSLT/XQuery serialization specification, using options method="xml", indent="yes", omit-xml-declaration="yes".

In the case of a document node, the result will be a well-formed XML document provided that the document node contains exactly one element child, and no text node children. In other cases it will be a well-formed external general parsed entity.

In the case of an attribute node, the output is a string in the form name="value". The name will use the original namespace prefix.

In the case of a namespace node, the output is a string in the form of a namespace declaration, that is xmlns="uri" or xmlns:pre="uri".

Other nodes, such as text nodes, comments, and processing instructions, are represented as they would appear in lexical XML. Note: this means that in the case of text nodes, special characters such as & and < are output in escaped form. To get the unescaped string value of a text node, use getStringValue() instead.

Returns
a simple XML serialization of the node. Under error conditions the method may return an error message which will always begin with the label "Error: ".

Reimplemented from XdmItem.

◆ values()

XdmValue ** XdmMap::values ( )

Returns a pointer array containing the values found in this map, that is, the value parts of the key-value pairs.

Returns
a pointer array containing the values found in this map. The result may contain duplicates, and the ordering of the collection is unpredictable.

◆ valuesAsList()

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.

Returns
a std::list containing the values found in this map. The result may contain duplicates, and the ordering of the collection is unpredictable.

The documentation for this class was generated from the following files: