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

An array in the XDM data model. More...

#include <XdmArray.h>

Inheritance diagram for XdmArray:
XdmFunctionItem XdmItem XdmValue

Public Member Functions

 XdmArray ()
 Default constructor.
 
 XdmArray (const XdmArray &d)
 XdmArray copy constructor.
 
virtual ~XdmArray ()
 Destructor method for XdmArray.
 
 XdmArray (int64_t obj)
 XdmArray constructor to create an object which is a wrapper for a Java XdmArray object - internal use only.
 
 XdmArray (int64_t obj, int len)
 XdmArray constructor to create an object which is a wrapper for a Java XdmArray object - internal use only.
 
int arrayLength ()
 Get the number of members in the array.
 
XdmValueget (int n)
 Get the n'th member in the array, counting from zero.
 
XdmArrayput (int n, XdmValue *value)
 Create a new array in which one member is replaced with a new value.
 
XdmArrayaddMember (XdmValue *value)
 Append a new member to an array.
 
XdmArrayconcat (XdmArray *value)
 Concatenate another array.
 
std::list< XdmValue * > asList ()
 Get the members of the array in the form of a list.
 
XdmValue ** values ()
 Get the members of the XDM array in the form of a C++ array.
 
int getArity ()
 Get the arity of the function.
 
const char * getStringValue (const char *encoding=nullptr)
 Get the string value of the XdmArray item.
 
bool isFunction ()
 Determine whether the item is an XDM function or some other type of item.
 
XDM_TYPE getType ()
 Get the type of this XDM value.
 
bool isArray ()
 Determine whether the item is an XDM array or some other type of item.
 
const char * toString (const char *encoding=nullptr)
 Create a string representation of the XDM array.
 
- Public Member Functions inherited from XdmFunctionItem
 XdmFunctionItem ()
 Default constructor.
 
 XdmFunctionItem (int64_t obj)
 XdmFunctionItem constructor to create an object which is a wrapper for a Java XdmFunctionItem object - internal use only.
 
 XdmFunctionItem (const XdmFunctionItem &d)
 XdmFunctionItem copy constructor.
 
virtual ~XdmFunctionItem ()
 Destructor method for XdmFunctionItem.
 
const char * getName ()
 Get the name of the function as an EQName.
 
const char * getStringValue (const char *encoding=nullptr)
 Get the string value of the XdmFunctionItem.
 
XdmValuecall (SaxonProcessor *processor, XdmValue **arguments, int argument_length)
 Call the function.
 
bool isAtomic ()
 Determine whether the item is an atomic value or some other type of item.
 
XDM_TYPE getType ()
 Get the type of this XDM value.
 
bool isFunction ()
 Determine whether the item is a function or some other type of item.
 
- Public Member Functions inherited from XdmItem
 XdmItem ()
 Default constructor.
 
 XdmItem (int64_t objRef)
 XdmItem constructor to create an object which is a wrapper for a Java XdmItem object - internal use only.
 
 XdmItem (const XdmItem &item)
 XdmItem copy constructor.
 
bool operator== (const XdmItem &other) const
 
virtual ~XdmItem ()
 Destructor method for XdmItem.
 
virtual void incrementRefCount ()
 Increment reference count of this XdmItem - internal use only.
 
virtual void decrementRefCount ()
 Decrement reference count of this XdmItem - internal use only.
 
virtual bool isNode ()
 Determine whether the item is a node or some other type of item.
 
virtual bool isMap ()
 Determine whether the item is an XDM map or some other type of item.
 
virtual int64_t getUnderlyingValue ()
 Get the underlying Java XdmValue object - internal use only.
 
const char * toString (const char *encoding=nullptr)
 Create a string representation of the item.
 
virtual XdmItemgetHead ()
 Get the first item in the sequence consisting of just this item.
 
XdmItemitemAt (int n)
 Get the n'th item in the sequence consisting of just this item, counting from zero.
 
int size ()
 Get the number of items in the sequence.
 
- Public Member Functions inherited from XdmValue
 XdmValue ()
 Default constructor.
 
 XdmValue (const XdmValue &other)
 XdmValue copy constructor.
 
void addXdmItem (XdmItem *val)
 Add an XdmItem to the sequence.
 
virtual bool operator== (const XdmValue &other) const
 
void addXdmItemFromUnderlyingValue (XdmItem *val)
 Add an XdmItem to the sequence, when the sequence was returned from SaxonC - internal use only.
 
void addUnderlyingValue (int64_t val)
 Add Java XdmValue object to the sequence.
 
 XdmValue (int64_t val, bool arrFlag)
 A Constructor for handling XdmArray - internal use only.
 
 XdmValue (int64_t val)
 XdmValue constructor to create an object which is a wrapper for a Java XdmValue object - internal use only.
 
virtual ~XdmValue ()
 Destructor method for XdmValue.
 
void releaseXdmValue ()
 Deprecated: this is deprecated and a no-op, the C++ destructor handles this case.
 
int getRefCount ()
 Get the number of references on this XdmValue - internal use only This method is used for internal memory management.
 
void resetRelinquishedItems ()
 Reset associated reference counts on XdmItems that have been relinquished - internal use only.
 
void incrementRefCountForRelinquishedValue (int i)
 Increment the ref count for a relinquished item only once - internal use only.
 

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
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
 
int64_t value
 

Detailed Description

An array in the XDM data model.

An array is a list of zero or more members, each of which is an arbitrary XDM value. The array itself is an XDM item.

An XdmArray is immutable.

Constructor & Destructor Documentation

◆ XdmArray() [1/4]

XdmArray::XdmArray ( )

Default constructor.

Creates an empty XdmArray

◆ XdmArray() [2/4]

XdmArray::XdmArray ( const XdmArray & d)

XdmArray copy constructor.

Parameters
d- XdmArray

◆ XdmArray() [3/4]

XdmArray::XdmArray ( int64_t obj)

XdmArray constructor to create an object which is a wrapper for a Java XdmArray object - internal use only.

Parameters
obj- internal Java XdmArray object to be wrapped

◆ XdmArray() [4/4]

XdmArray::XdmArray ( int64_t obj,
int len )

XdmArray constructor to create an object which is a wrapper for a Java XdmArray object - internal use only.

Parameters
obj- internal Java XdmArray object to be wrapped
len- The length of the array if known

Member Function Documentation

◆ addMember()

XdmArray * XdmArray::addMember ( XdmValue * value)

Append a new member to an array.

Parameters
value- the new member. The value itself is not stored internally therefore safe for memory deallocation by the caller.
Returns
A new XdmArray, one item longer than the original
Remarks
If the value is lazily evaluated, and evaluation fails then return null

◆ arrayLength()

int XdmArray::arrayLength ( )

Get the number of members in the array.

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

◆ asList()

std::list< XdmValue * > XdmArray::asList ( )

Get the members of the array in the form of a list.

Returns
A std::list of the members of this array.

◆ concat()

XdmArray * XdmArray::concat ( XdmArray * value)

Concatenate another array.

Parameters
value- the other array The value itself is not stored internally therefore safe for memory deallocation by the caller.
Returns
A new XdmArray, containing the members of this array followed by the members of the other array

◆ get()

XdmValue * XdmArray::get ( int n)

Get the n'th member in the array, counting from zero.

Parameters
n- the member that is required, counting the first member in the array as member zero
Returns
The n'th member in the sequence making up the array, counting from zero. The caller is responsible for memory deallocation.
Remarks
If n is less than zero or greater than or equal to the number of members in the array we return null.

◆ getArity()

int XdmArray::getArity ( )
inlinevirtual

Get the arity of the function.

Returns
The arity of the function, that is, the number of arguments in the function's signature (in this case, 1 (one))

Reimplemented from XdmFunctionItem.

◆ getStringValue()

const char * XdmArray::getStringValue ( const char * encoding = nullptr)
virtual

Get the string value of the XdmArray item.

There is no string value for function items, so an exception is always thrown.

Parameters
encoding- the encoding of the string returned. If NULL or omitted defaults to the JVM encoding, which in most cases is UTF-8.
Returns
Nothing is returned; this method always throws an exception because the XdmArray has no associated string value.
Exceptions
SaxonApiException

Reimplemented from XdmItem.

◆ getType()

XDM_TYPE XdmArray::getType ( )
inlinevirtual

Get the type of this XDM value.

Returns
The type of the XdmValue as an XDM_TYPE

Reimplemented from XdmItem.

◆ isArray()

bool XdmArray::isArray ( )
inlinevirtual

Determine whether the item is an XDM array or some other type of item.

Returns
True

Reimplemented from XdmItem.

◆ isFunction()

bool XdmArray::isFunction ( )
inlinevirtual

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

Returns
True; an XDM array is a function item

Reimplemented from XdmItem.

◆ put()

XdmArray * XdmArray::put ( int n,
XdmValue * value )

Create a new array in which one member is replaced with a new value.

Parameters
n- the position of the member that is to be replaced, counting the first member in the array as member zero
value- the new member for the new array. The value itself is not stored internally therefore safe for memory deallocation by the caller.
Returns
A new XdmArray, the same length as the original, with one member replaced by a new value. The caller is responsible for memory deallocation.
Remarks
if n is less than zero or greater than or equal to the number of members in the array then return null

◆ toString()

const char * XdmArray::toString ( const char * encoding = nullptr)
virtual

Create a string representation of the XDM array.

This is the result of serializing the array using the adaptive serialization method.

Returns
A string representation of the XdmArray. The caller is responsible for memory deallocation using operator delete.

Reimplemented from XdmValue.

◆ values()

XdmValue ** XdmArray::values ( )

Get the members of the XDM array in the form of a C++ array.

Returns
An array of the members of this XdmArray. The caller is responsible for memory deallocation.

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