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

#include <XdmItem.h>

Inheritance diagram for XdmItem:
XdmValue XdmAtomicValue XdmFunctionItem XdmNode XdmArray XdmMap

Public Member Functions

 XdmItem ()
 XdmItem default constructor.
 
 XdmItem (int64_t)
 
 XdmItem (const XdmItem &item)
 Copy constructor.
 
virtual ~XdmItem ()
 Destructor.
 
virtual void incrementRefCount ()
 
virtual void decrementRefCount ()
 
virtual bool isAtomic ()
 
virtual bool isNode ()
 
virtual bool isFunction ()
 
virtual bool isMap ()
 
virtual bool isArray ()
 
virtual int64_t getUnderlyingValue ()
 
virtual const char * getStringValue ()
 Get the string value of the item.
 
const char * toString ()
 
virtual XdmItemgetHead ()
 
XdmItemitemAt (int n)
 
int size ()
 
virtual XDM_TYPE getType ()
 
- 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 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.
 

Protected Attributes

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
 

Additional Inherited Members

- Protected Member Functions inherited from XdmValue
void initialize ()
 initialize this XdmValue with default values
 

Detailed Description

The class XdmItem represents an item in a sequence, as defined by the XDM data model. An item is either an atomic value, a node, or a function item.

An item is a member of a sequence, but it can also be considered as a sequence (of length one) in its own right. XdmItem is a subtype of XdmValue because every Item in the XDM data model is also a value.

It cannot be assumed that every sequence of length one will be represented by an XdmItem. It is quite possible for an XdmValue that is not an XdmItem to hold a singleton sequence.

Saxon provides two concrete subclasses of XdmItem, namely XdmNode and XdmAtomicValue. Users must not attempt to create additional subclasses.

Constructor & Destructor Documentation

◆ XdmItem() [1/3]

XdmItem::XdmItem ( )

XdmItem default constructor.

Create an empty XdmItem

◆ XdmItem() [2/3]

XdmItem::XdmItem ( int64_t  objRef)
explicit

XdmItem constructor created as a wrapper around an existing Saxon Java object XdmItem constructor created from a JNI Java object. This is for internal use only

Parameters
objRef- The internal Java object for the XdmItem is wrapped here in the C++ XdmItem class

◆ XdmItem() [3/3]

XdmItem::XdmItem ( const XdmItem item)

Copy constructor.

Copy constructor for XdmItem

◆ ~XdmItem()

XdmItem::~XdmItem ( )
virtual

Destructor.

Destructor for XdmItem

Member Function Documentation

◆ decrementRefCount()

void XdmItem::decrementRefCount ( )
virtual

Decrement reference count of this XdmItem - Memory management - Internal use only this method is used for internal memory management.

Reimplemented from XdmValue.

◆ getHead()

XdmItem * XdmItem::getHead ( )
virtual

Get the first item in the sequence

Returns
XdmItem or nullptr if sequence is empty

Reimplemented from XdmValue.

Reimplemented in XdmAtomicValue, and XdmNode.

◆ getStringValue()

const char * XdmItem::getStringValue ( )
virtual

Get the string value of the item.

For a node, this gets the string value of the node. For an atomic value, it has the same effect as casting the value to a string. In all cases the result is the same as applying the XPath string() function.

For atomic values, the result is the same as the result of calling toString. This is not the case for nodes, where toString returns an XML serialization of the node. The caller should deallocate memory using delete.

Returns
the result of converting the item to a string.

Reimplemented in XdmArray, XdmAtomicValue, XdmFunctionItem, and XdmNode.

◆ getType()

XDM_TYPE XdmItem::getType ( )
virtual

Get the type of the object

Reimplemented from XdmValue.

Reimplemented in XdmArray, XdmAtomicValue, XdmFunctionItem, XdmMap, and XdmNode.

◆ getUnderlyingValue()

int64_t XdmItem::getUnderlyingValue ( )
virtual

Get Java XdmValue object.

Returns
jobject - The Java object of the XdmValue in its JNI representation

Reimplemented from XdmValue.

Reimplemented in XdmNode.

◆ incrementRefCount()

void XdmItem::incrementRefCount ( )
virtual

Increment reference count of this XdmItem - Memory management - Internal use only this method is used for internal memory management.

Reimplemented from XdmValue.

◆ isArray()

bool XdmItem::isArray ( )
virtual

Determine whether the item is an Array or some other type of item

Returns
true if the item is a Xdm Array item, false if it is some other value

Reimplemented in XdmArray.

◆ isAtomic()

bool XdmItem::isAtomic ( )
virtual

Determine whether the item is an atomic value or some other type of item

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

Reimplemented in XdmAtomicValue, XdmFunctionItem, and XdmNode.

◆ isFunction()

bool XdmItem::isFunction ( )
virtual

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 in XdmArray, XdmFunctionItem, and XdmMap.

◆ isMap()

bool XdmItem::isMap ( )
virtual

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 value

Reimplemented in XdmMap.

◆ isNode()

bool XdmItem::isNode ( )
virtual

Determine whether the item is a node or some other type of item

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

Reimplemented in XdmNode.

◆ itemAt()

XdmItem * XdmItem::itemAt ( int  n)
virtual

Get the n'th item in the value, counting from zero.

Parameters
nthe item that is required, counting the first item in the sequence as item zero
Returns
the n'th item in the sequence making up the value, counting from zero return nullptr if n is less than zero or greater than or equal to the number of items in the value return nullptr if the value is lazily evaluated and the delayed evaluation fails with a dynamic error.

Reimplemented from XdmValue.

◆ size()

int XdmItem::size ( )
virtual

Get the number of items in the sequence

Returns
the number of items in the value. For an item (including a map or array) this is always 1 (one).

Reimplemented from XdmValue.

◆ toString()

const char * XdmItem::toString ( )
virtual

The toString() method returns a simple XML serialization of the node with defaulted serialization parameters. The caller should deallocate memory using delete

Reimplemented from XdmValue.

Reimplemented in XdmMap, and XdmNode.

Member Data Documentation

◆ itemToString

const char* XdmItem::itemToString
protected

Cached. String representation of the XdmValue, if available

◆ stringValue

const char* XdmItem::stringValue
protected

Cached. String representation of the XdmValue, if available

◆ value

int64_t XdmItem::value
protected

The Java XdmItem reference in Graalvm


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