SaxonC
11.6
Saxon Processor library for C/C++, PHP and Python
|
#include <XdmMap.h>
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... | |
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. More... | |
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. More... | |
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. More... | |
XdmValue * | get (double key) |
XdmValue * | get (long key) |
XdmMap * | put (XdmAtomicValue *key, XdmValue *value) |
Create a new map containing an additional (key, value) pair. More... | |
XdmMap * | remove (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) |
XdmValue * | call (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 XdmItem * | getHead () |
XdmItem * | itemAt (int n) |
int | size () |
Public Member Functions inherited from XdmValue | |
XdmValue () | |
A default Constructor. More... | |
XdmValue (const XdmValue &other) | |
A copy constructor. More... | |
XdmValue * | addXdmValueWithType (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 XdmFunctionItem * | getSystemFunction (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 |
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.
Create an empty XdmMap
|
inlinevirtual |
Destructor.
Destructor for XdmMap
XdmMap::XdmMap | ( | jobject | obj | ) |
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.
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 | key whose presence in this map is to be tested |
true
if this map contains a mapping for the specified key 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 ) |
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) |
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) |
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) |
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. |
bool XdmMap::isEmpty | ( | ) |
Returns true if this map contains no key-value mappings.
|
inlinevirtual |
Determine whether the item is a function or some other type of item.
Reimplemented from XdmFunctionItem.
|
inlinevirtual |
Determine whether the item is a 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 XdmAtomicValue.
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
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)
key | - The key to be removed given as an XdmAtomicValue |
|
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.
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.
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.