SaxonC  11.4
Saxon Processor library for C/C++, PHP and Python
Public Member Functions | List of all members
XdmArray Class Reference

#include <XdmArray.h>

Inheritance diagram for XdmArray:
XdmFunctionItem XdmItem XdmValue

Public Member Functions

 XdmArray ()
 XdmArray default constructor. More...
 
 XdmArray (const XdmArray &d)
 Copy constructor. More...
 
virtual ~XdmArray ()
 Destructor. More...
 
 XdmArray (jobject obj)
 XdmArray constructor which is used a wrapper class for the Java XdmArray object - internal use. More...
 
 XdmArray (jobject obj, int len)
 XdmArray constructor which is used a wrapper class for the Java XdmArray object - internal use. More...
 
int arrayLength ()
 Get the number of members in the array. More...
 
XdmValueget (int n)
 
XdmArrayput (int n, XdmValue *value)
 
XdmArrayaddMember (XdmValue *value)
 
XdmArrayconcat (XdmArray *value)
 
std::list< XdmValue * > asList ()
 
XdmValue ** createXdmValueArray (int len)
 
XdmValue ** values ()
 
int getArity ()
 
bool isFunction ()
 
XDM_TYPE getType ()
 
bool isArray ()
 Determine whether the item is an array or some other type of item. More...
 
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...
 
XdmValue ** createXdmValueArray (int len)
 
XdmValuecall (SaxonProcessor *processor, XdmValue **arguments, int argument_length)
 Call the function. More...
 
bool isAtomic ()
 
XDM_TYPE getType ()
 
bool isFunction ()
 Determine whether the item is a function or some other type of item. More...
 
- 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 isMap ()
 
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 ()
 
- 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

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 ( )

XdmArray default constructor.

Create an empty XdmArray

◆ XdmArray() [2/4]

XdmArray::XdmArray ( const XdmArray d)

Copy constructor.

Copy constructor for XdmArray

◆ ~XdmArray()

virtual XdmArray::~XdmArray ( )
inlinevirtual

Destructor.

Destructor for XdmArray

◆ XdmArray() [3/4]

XdmArray::XdmArray ( jobject  obj)

XdmArray constructor which is used a wrapper class for the Java XdmArray object - internal use.

Parameters
obj- The internal Java object for the XdmArray is wrapped here in the C++ XdmArray

◆ XdmArray() [4/4]

XdmArray::XdmArray ( jobject  obj,
int  len 
)

XdmArray constructor which is used a wrapper class for the Java XdmArray object - internal use.

Parameters
obj- The internal Java object for the XdmArray is wrapped here in the C++ XdmArray
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
Returns
a new array, 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
Returns
a new array, containing the members of this array followed by the members of the other array

◆ createXdmValueArray()

XdmValue** XdmArray::createXdmValueArray ( int  len)
inline

Utility method for working with SaxonC on Python Create an array of xdmValue objects

Parameters
len- the length of the array to create
Returns
an empty array of XdmValue of length len

◆ get()

XdmValue * XdmArray::get ( int  n)

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

Parameters
nthe 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
Remarks
if n is less than zero or greater than or equal to the number of members in the array we return null. User should clear any exception thrown

◆ 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

Reimplemented from XdmFunctionItem.

◆ getType()

XDM_TYPE XdmArray::getType ( )
inlinevirtual

Get the type of the object

Reimplemented from XdmItem.

◆ isArray()

bool XdmArray::isArray ( )
inlinevirtual

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 type

Reimplemented from XdmItem.

◆ isFunction()

bool XdmArray::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 XdmItem.

◆ put()

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

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

Parameters
nthe position of the member that is to be replaced, counting the first member in the array as member zero
value- is the new member for the the new array
Returns
a new array, the same length as the original, with one member replaced by a new value
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 ( )
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 XdmValue.

◆ values()

XdmValue ** XdmArray::values ( )

Get the members of the array in the form of an array

Returns
an array of the members of this XdmArray.

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