SaxonC  11.6
Saxon Processor library for C/C++, PHP and Python
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. More...
 
 XdmMap (const XdmMap &d)
 Copy constructor. More...
 
virtual ~XdmMap ()
 Destructor. More...
 
 XdmMap (jobject obj)
 XdmMap constructor which is a wrapper object from the Java XdmMap object - internal use. More...
 
 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. More...
 
int mapSize ()
 Get the number of entries in the map. More...
 
XdmValueget (XdmAtomicValue *key)
 Returns the value to which the specified key is mapped, or NULL if this map contains no mapping for the key. More...
 
XdmValueget (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. More...
 
XdmValueget (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. More...
 
XdmValueget (double key)
 
XdmValueget (long key)
 
XdmMapput (XdmAtomicValue *key, XdmValue *value)
 Create a new map containing an additional (key, value) pair. More...
 
XdmMapremove (XdmAtomicValue *key)
 Create a new map in which the entry for a given key has been removed. More...
 
std::set< XdmAtomicValue * > keySet ()
 Get the keys present in the map in the form of an unordered std::set. More...
 
XdmAtomicValue ** keys ()
 Get the keys present in the map in the form of an unordered pointer array of XdmAtomicValue. More...
 
bool isEmpty ()
 Returns true if this map contains no key-value mappings. More...
 
bool containsKey (XdmAtomicValue *key)
 Returns true if this map contains a mapping for the specified key. More...
 
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. More...
 
XdmValue ** values ()
 Returns a pointer array containing the values found in this map, that is, the value parts of the key-value pairs. More...
 
bool isFunction ()
 Determine whether the item is a function or some other type of item. More...
 
bool isMap ()
 Determine whether the item is a map or some other type of item. More...
 
XDM_TYPE getType ()
 Get the type of the object.
 
const char * toString ()
 The toString() method returns a simple XML serialization of the node with defaulted serialization parameters. More...
 
- Public Member Functions inherited from XdmFunctionItem
 XdmFunctionItem ()
 Default constructor for XdmFunctionItem. More...
 
 XdmFunctionItem (jobject obj)
 XdmFunctionItem constructor created from a Java object - internal use. More...
 
 XdmFunctionItem (const XdmFunctionItem &d)
 Copy constructor. More...
 
virtual ~XdmFunctionItem ()
 Destructor. More...
 
const char * getName ()
 Get the name of the function as EQName. More...
 
virtual int getArity ()
 Get the arity of the function. More...
 
XdmValue ** createXdmValueArray (int len)
 
XdmValuecall (SaxonProcessor *processor, XdmValue **arguments, int argument_length)
 Call the function. More...
 
bool isAtomic ()
 
- Public Member Functions inherited from XdmItem
 XdmItem ()
 XdmItem default constructor. More...
 
 XdmItem (jobject)
 XdmItem constructor created as a wrapper around an existing Saxon Java object. More...
 
 XdmItem (const XdmItem &item)
 Copy constructor. More...
 
virtual ~XdmItem ()
 Destructor. More...
 
virtual void incrementRefCount ()
 Increment reference count of this XdmItem - Memory management - Internal use only. More...
 
virtual void decrementRefCount ()
 Decrement reference count of this XdmItem - Memory management - Internal use only. More...
 
virtual bool isNode ()
 
virtual bool isArray ()
 
virtual jobject getUnderlyingValue ()
 
virtual const char * getStringValue ()
 
virtual XdmItemgetHead ()
 
XdmItemitemAt (int n)
 
int size ()
 
- Public Member Functions inherited from XdmValue
 XdmValue ()
 A default Constructor. More...
 
 XdmValue (const XdmValue &other)
 A copy constructor. More...
 
XdmValueaddXdmValueWithType (const char *tStr, const char *val)
 Add an XdmItem to the sequence. More...
 
void addXdmItem (XdmItem *val)
 
void addUnderlyingValue (jobject val)
 
 XdmValue (jobject val, bool arrFlag)
 A Constructor for handling XdmArray - Internal user only. More...
 
 XdmValue (jobject val)
 A Constructor. More...
 
virtual ~XdmValue ()
 Destructor. More...
 
void releaseXdmValue ()
 Delete the XdmValue object and clean up all items in the sequence. Release the underlying JNI object.
 
int getRefCount ()
 Get the number of references on this XdmValue. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from XdmFunctionItem
static XdmFunctionItemgetSystemFunction (SaxonProcessor *processor, const char *name, int arity)
 Get a system function. More...
 
- Protected Member Functions inherited from XdmValue
void initialize ()
 initialize this XdmValue with default values
 
- Protected Attributes inherited from XdmFunctionItem
std::string fname
 
- Protected Attributes inherited from XdmItem
jobject value
 
std::string stringValue
 
- Protected Attributes inherited from XdmValue
char * valueType
 
std::vector< XdmItem * > values
 
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 ( jobject  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

◆ 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: