SaxonC  11.6
Saxon Processor library for C/C++, PHP and Python
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. 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 isAtomic ()
 
virtual bool isNode ()
 
virtual bool isFunction ()
 
virtual bool isMap ()
 
virtual bool isArray ()
 
virtual jobject getUnderlyingValue ()
 
virtual const char * getStringValue ()
 
const char * toString ()
 Create a string representation of the value. More...
 
virtual XdmItemgetHead ()
 
XdmItemitemAt (int n)
 
int size ()
 
virtual XDM_TYPE getType ()
 
- 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...
 

Protected Attributes

jobject value
 
std::string stringValue
 
- Protected Attributes inherited from XdmValue
char * valueType
 
std::vector< XdmItem * > values
 
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 or a node.

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 ( jobject  obj)
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
obj- 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 XdmNode, and XdmAtomicValue.

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

Returns
the result of converting the item to a string.
Deprecated:
the SaxonProcessor argument. It has been removed from release version 1.2.1

Reimplemented in XdmNode, and XdmAtomicValue.

◆ getType()

XDM_TYPE XdmItem::getType ( )
virtual

Get the type of the object

Reimplemented from XdmValue.

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

◆ getUnderlyingValue()

jobject 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 XdmNode, XdmFunctionItem, and XdmAtomicValue.

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

◆ 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

Create a string representation of the value.

The is the result of serializing the value using the adaptive serialization method.

Returns
a string representation of the value

Reimplemented from XdmValue.

Reimplemented in XdmNode, and XdmMap.

Member Data Documentation

◆ stringValue

std::string XdmItem::stringValue
protected

Cached. String representation of the XdmValue, if available

◆ value

jobject XdmItem::value
protected

The Java XdmItem object as a JNI jobject


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