Item

#include </home/jenkins/.jenkins/ubuntu-remote-queue/jenkins-BuildZorbaUbuntu-462/source/zorba/swig/Item.h>

The Zorba Item interface. This class is the Zorba representation of an Item as defined in the XQuery 1.0 and XPath 2.0 Data Model (XDM); see http://www.w3.org/TR/xpath-datamodel/.Instances of the XDM are a sequence, i.e. an ordered collection of zero or more items. In the Zorba API, a sequence is represented by the ItemSequence class.The Item class is the union of all XQuery node and atomic types. The class provides functions to access the information of an Item. Note that not all functions are defined on every Item kind. If a function is called on an Item that does not provide the called function, an ZXQP0024_FUNCTION_NOT_IMPLEMENTED_FOR_ITEMTYPE error is raised.Instances of the Item class are always passed by copy. To check whether a given Item is valid isNull() can be called which returns true if the given Item is not valid and false otherwise. A new atomic Item can be created using the ItemFactory. A new node Item should be created by the result of a query.

Friend Classes

friend class

Collection

friend class

CollectionManager

friend class

DocumentManager

friend class

DynamicContext

friend class

ItemFactory

friend class

ItemSequence

friend class

Iterator

friend class

SingletonIterator

friend class

StaticCollectionManager

friend class

StaticContext

Private Attributes

zorba::Item

theItem

Public Functions

void

close()

Free all resources aquired by this Item.

Iterator

getAtomizationValue() const

Get the atomization value of the Item.

Iterator

getAttributes() const

Get an iterator for the attributes of this (node) Item.

bool

getBooleanValue() const

Get the bool value of the boolean Item.

Iterator

getChildren() const

Get an iterator for the children of this (node) Item.

double

getDoubleValue() const

Get the int value of the Item.

Item

getEBV() const

Get the effective boolean value of the Item.

int

getIntValue() const

Get the int value of the Item.

std::string

getLocalName() const

Get the value of a QName's local name.

long long

getLongValue() const

Get the long value of the Item.

std::string

getNamespace() const

Get the (optional) value of a QName's namespace.

std::vector< std::pair< std::string, std::string > >

getNamespaceBindings()

Get a vector for the namespace bindings of this (element) Item.

int

getNodeKind() const

Get the type of this (node) Item.

bool

getNodeName(Item &aNodeName) const

Get the name of this (node) Item.

Item

getParent() const

Get parent of this (node) Item.

std::string

getPrefix() const

Get the (optional) value of a QName's prefix.

std::string

getStringValue() const

Get the string value of the Item.

Item

getType() const

Get the type of the Item.

unsigned int

getUnsignedIntValue() const

bool

isAtomic() const

Check if the Item is an atomic Item.

bool

isNaN() const

Check if the value of the Item is not a number (NaN).

bool

isNode() const

Check if the Item is a node Item.

bool

isNull() const

Check if the Item is null.

bool

isPosOrNegInf() const

Check if the value of the Item is positive or negative infinity.

Item()

Default constructor.

Item(const Item &aItem)

Copy constructor.

Item(const zorba::Item &aZItem)

Constructor that is used to construct Items in the Zorba engine itself.

std::string

serialize() const

Serializes the object.

std::string

serialize(SerializationOptions serOptions) const

Serializes the object.

void

serializeToStream(ZorbaIOStream &aStream) const

Serializes the object.

void

serializeToStream(ZorbaIOStream &aStream, SerializationOptions serOptions) const

Serializes the object.

Public Static Functions

Item

createEmptyItem()

Static constructor.

Friend Classes

Collection

friend class Collection

CollectionManager

friend class CollectionManager

DocumentManager

friend class DocumentManager

DynamicContext

friend class DynamicContext

ItemFactory

friend class ItemFactory

ItemSequence

friend class ItemSequence

Iterator

friend class Iterator

SingletonIterator

friend class SingletonIterator

StaticCollectionManager

friend class StaticCollectionManager

StaticContext

friend class StaticContext

Private Attributes

theItem

zorba::Item theItem

Public Functions

close

void close()

Free all resources aquired by this Item.

After calling close() on an Item the Item is invalidated, i.e. a subsequent call to isNull() will return true.Note that calling this function is usually not necessary because close() is implicitly called by the destructor. Calling close() is only necessary if the resources aquired by an Item should be released before the Item goes out of scope, i.e. the destructor is called.Also note that this function is available for all types of Items.

getAtomizationValue

Iterator getAtomizationValue() const

Get the atomization value of the Item.

The atomization value is the value that is returned by atomization (see http://www.w3.org/TR/xquery/#id-atomization). Note that this function is available for all types of Items.

Returns

Item the atomization value of the Item.

Parameters

ZorbaException if an error occured.

getAttributes

Iterator getAttributes() const

Get an iterator for the attributes of this (node) Item.

Note that this function is only available for node Items.

Returns

Iterator over the attributes of this node.

Parameters

ZorbaException if an error occured, e.g. the Item is not of type node.

getBooleanValue

bool getBooleanValue() const

Get the bool value of the boolean Item.

Note that this function is only available for Items of type boolean.

Returns

true if the boolean value is true, false otherwise.

Parameters

ZorbaException if an error occured, e.g. the Item is not of type boolean.

getChildren

Iterator getChildren() const

Get an iterator for the children of this (node) Item.

Note that this function is only available for node Items.

Returns

Iterator over the children of this node.

Parameters

ZorbaException if an error occured, e.g. the Item is not of type node.

getDoubleValue

double getDoubleValue() const

Get the int value of the Item.

Returns

Item the int value of the Item.

Parameters

ZorbaException if an error occured.

getEBV

Item getEBV() const

Get the effective boolean value of the Item.

The effective boolean value is the result of applying the fn:boolean function on the Item (see http://www.w3.org/TR/xpath-functions/#func-boolean). Note that this function is available for all types of Items.

Returns

Item the effective boolean value of the Item

Parameters

ZorbaException if an error occured.

getIntValue

int getIntValue() const

Get the int value of the Item.

Returns

Item the int value of the Item.

Parameters

ZorbaException if an error occured.

getLocalName

std::string getLocalName() const

Get the value of a QName's local name.

Note that this function is only available for Items of type QName.

Returns

String the local name of the QName.

Parameters

ZorbaException if an error occured, e.g. the Item is not a QName.

getLongValue

long long getLongValue() const

Get the long value of the Item.

Returns

Item the long value of the Item.

Parameters

ZorbaException if an error occured.

getNamespace

std::string getNamespace() const

Get the (optional) value of a QName's namespace.

Note that this function is only available for Items of type QName.

Returns

String the namespace URI of the QName.

Parameters

ZorbaException if an error occured, e.g. the Item is not a QName.

getNamespaceBindings

std::vector< std::pair< std::string, std::string > > getNamespaceBindings()

Get a vector for the namespace bindings of this (element) Item.

Note that this function is only available for element Items.

Parameters

ZorbaException if an error occured, e.g. the Item is not of type element.

getNodeKind

int getNodeKind() const

Get the type of this (node) Item.

Note that this function is only available for node Items.

Returns

int the kind of this node (the avaialble kinds can be found in the store::StoreConsts class)

Parameters

ZorbaException if an error occured (e.g. the Item is not of type node).

getNodeName

bool getNodeName(Item &aNodeName) const

Get the name of this (node) Item.

Note that this function is only available for node Items.

Returns

bool if the name of the node was retrieved successfully

Parameters

aNodeName the name of the node

Parameters

ZorbaException if an error occured (e.g. the Item is not of type node).

getParent

Item getParent() const

Get parent of this (node) Item.

Note that this function is only available for node Items.

Returns

element or document parent node of this node.

Parameters

ZorbaException if an error occured, e.g. the Item is not of type node.

getPrefix

std::string getPrefix() const

Get the (optional) value of a QName's prefix.

Note that this function is only available for Items of type QName.

Returns

String the prefix of the QName.

Parameters

ZorbaException if an error occured, e.g. the Item is not a QName.

getStringValue

std::string getStringValue() const

Get the string value of the Item.

The string value is the string that is extracted by calling the fn:string function on the Item (see http://www.w3.org/TR/xpath-functions/#func-string). Note that this function is available for all types of Items.

Returns

Item the string value of the Item.

Parameters

ZorbaException if an error occured.

getType

Item getType() const

Get the type of the Item.

See http://www.w3.org/TR/xpath-datamodel/#types. Note that this function is available for all types of Items.

Returns

Item the type of the Item as a QName Item

Parameters

ZorbaException if an error occured.

getUnsignedIntValue

unsigned int getUnsignedIntValue() const

isAtomic

bool isAtomic() const

Check if the Item is an atomic Item.

Note that this function is available for all types of Items.

Returns

true if the Item is an atomic Item, false otherwise.

isNaN

bool isNaN() const

Check if the value of the Item is not a number (NaN).

Note that this function is only available for numeric Items (e.g. Double or Float).

Returns

true if the Item is NaN, false otherwise.

Parameters

ZorbaException if an error occured, e.g. the Item is not a numeric type.

isNode

bool isNode() const

Check if the Item is a node Item.

Note that this function is available for all types of Items.

Returns

true if the Item is of type node, false otherwise.

isNull

bool isNull() const

Check if the Item is null.

If this function returns true, the Item is not valid. Note that this function is available for all types of Items.

Returns

true if the Item is null, false otherwise.

isPosOrNegInf

bool isPosOrNegInf() const

Check if the value of the Item is positive or negative infinity.

Note that this function is only available for numeric Items (e.g. Double or Float).

Returns

true if the Item is +/-INF, false otherwise.

Parameters

ZorbaException if an error occured, e.g. the Item is not a numeric type.

Item

 Item()

Default constructor.

Item

 Item(const Item &aItem)

Copy constructor.

Item

 Item(const zorba::Item &aZItem)

Constructor that is used to construct Items in the Zorba engine itself.

This constructor is for internal use only.

serialize

std::string serialize() const

Serializes the object.

Returns a string with the value of the object serialized

Returns

The string value of the Item.

Parameters

ZorbaException if an error occured.

serialize

std::string serialize(SerializationOptions serOptions) const

Serializes the object.

Returns a string with the value of the object serialized

Parameters

serOptions The serialization options for this Item

Returns

The string value of the Item.

Parameters

ZorbaException if an error occured.

serializeToStream

void serializeToStream(ZorbaIOStream &aStream) const

Serializes the object.

Put the serialized object into the specified stream.

Parameters

aStream The stream to write the value of the Item.

Parameters

ZorbaException if an error occured.

serializeToStream

void serializeToStream(ZorbaIOStream &aStream, SerializationOptions serOptions) const

Serializes the object.

Put the serialized object into the specified stream.

Parameters

aStream The stream to write the value of the Item.
serOptions The serialization options for this Item

Parameters

ZorbaException if an error occured.

Public Static Functions

createEmptyItem

Item createEmptyItem()

Static constructor.