SaxonC 12.5
Saxon Processor library for C/C++, PHP and Python
Loading...
Searching...
No Matches
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.
 
 XdmArray (const XdmArray &d)
 Copy constructor.
 
virtual ~XdmArray ()
 Destructor.
 
 XdmArray (int64_t obj)
 
 XdmArray (int64_t obj, int len)
 
int arrayLength ()
 Get the number of members in the array.
 
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 ()
 
const char * getStringValue ()
 Get the string value of the XdmArray item.
 
bool isFunction ()
 
XDM_TYPE getType ()
 
bool isArray ()
 Determine whether the item is an array or some other type of item.
 
const char * toString ()
 
- Public Member Functions inherited from XdmFunctionItem
 XdmFunctionItem ()
 Default constructor for XdmFunctionItem.
 
 XdmFunctionItem (int64_t obj)
 XdmFunctionItem constructor created from a Java object - internal use.
 
 XdmFunctionItem (const XdmFunctionItem &d)
 Copy constructor.
 
virtual ~XdmFunctionItem ()
 Destructor.
 
const char * getName ()
 Get the name of the function as EQName.
 
const char * getStringValue ()
 Get the string value of the XdmArray item.
 
XdmValue ** createXdmValueArray (int len)
 
XdmValuecall (SaxonProcessor *processor, XdmValue **arguments, int argument_length)
 Call the function.
 
bool isAtomic ()
 
XDM_TYPE getType ()
 
bool isFunction ()
 Determine whether the item is a function or some other type of item.
 
- Public Member Functions inherited from XdmItem
 XdmItem ()
 XdmItem default constructor.
 
 XdmItem (int64_t)
 
 XdmItem (const XdmItem &item)
 Copy constructor.
 
virtual ~XdmItem ()
 Destructor.
 
virtual void incrementRefCount ()
 
virtual void decrementRefCount ()
 
virtual bool isNode ()
 
virtual bool isMap ()
 
virtual int64_t getUnderlyingValue ()
 
const char * toString ()
 
virtual XdmItemgetHead ()
 
XdmItemitemAt (int n)
 
int size ()
 
- 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 addXdmItemFromUnderlyingValue (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.
 
void resetRelinquishedItems ()
 
void incrementRefCountForRelinquishedValue (int i)
 

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

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 ( int64_t 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 ( int64_t 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.

◆ getStringValue()

const char * XdmArray::getStringValue ( )
virtual

Get the string value of the XdmArray item.

Get the value of the item as a string. For arrays, there is no string value, so an exception is thrown.

Returns
the string value of the item

Reimplemented from XdmItem.

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