zorba::Item#include <zorba/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
Private Attributes
Public Functions
Friend ClassesUnmarshallerfriend class Unmarshaller
zorba::serialization::operator&friend void zorba::serialization::operator&(zorba::serialization::Archiver &ar, Item &obj)
Private Attributesm_itemstore::Item * m_item
Public Functionsclosevoid 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. getArraySizeuint64_t getArraySize() const getArrayValueItem getArrayValue(uint32_t aIndex) const getAtomizationValueIterator_t 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. Parameters
getAttributesIterator_t getAttributes() const Get an iterator for the attributes of this (node) Item. Note that this function is only available for node Items. The file simple.cpp contains some basic examples that demonstrate the use of this function. ReturnsIterator over the attributes of this node.Parameters
getBase64BinaryValueconst char * getBase64BinaryValue(size_t &s) const Returns the value and size of the given base64Binary item. The value is a string which is base64 encoded if isEncoded() returns true. Otherwise, it is the original unencoded binary data.If the given item is streamable (i.e. isStreamable() returns true), the stream returned by getStream() should to be used to retrieve the value. Otherwise, the contents of the stream will be materialized in main memory. getBooleanValuebool getBooleanValue() const getChildrenIterator_t getChildren() const Get an iterator for the children of this (node) Item. Note that this function is only available for node Items. The file simple.cpp contains some basic examples that demonstrate the use of this function. ReturnsIterator over the children of this node.Parameters
getCollectionNameItem getCollectionName() const Returns the name of the collection this node is stored in.
ReturnsThe name of the collection or 0 if the given item is not a node or not stored in a collection.getDoubleValuedouble getDoubleValue() const getEBVItem 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. Parameters
getHexBinaryValueconst char * getHexBinaryValue(size_t &s) const Returns the value and size of the given hexBinary item. The value is a string which is hexBinary encoded if isEncoded() returns true. Otherwise, it is the original unencoded binary data.If the given item is streamable (i.e. isStreamable() returns true), the stream returned by getStream() should to be used to retrieve the value. Otherwise, the contents of the stream will be materialized in main memory. getIntValueint32_t getIntValue() const getJSONItemKindstore::StoreConsts::JSONItemKind getJSONItemKind() const Get the kind of this (JSON) Item. Note that this function is only available for JSON Items, that is, Items which return true from isJSONItem(). Returnsthe kind of this JSON itemParameters
getLocalNameString getLocalName() const getLongValueint64_t getLongValue() const getNamespaceString getNamespace() const getNamespaceBindingsvoid getNamespaceBindings(NsBindings &aBindings, store::StoreConsts::NsScoping scope=store::StoreConsts::ALL_BINDINGS) const Get an iterator for the namespace bindings of this (element) Item. Note that this function is only available for element Items. The file simple.cpp contains some basic examples that demonstrate the use of this function. Parameters
Parameters
getNodeKindint getNodeKind() const Get the type of this (node) Item. Note that this function is only available for node Items. Returnsint the kind of this node (the avaialble kinds can be found in the store::StoreConsts class)Parameters
getNodeNamebool getNodeName(Item &aNodeName) const Get the name of this (node) Item. Note that this function is only available for node Items. The file simple.cpp contains some basic examples that demonstrate the use of this function. Returnsbool if the name of the node was retrieved successfullyParameters
getObjectKeysIterator_t getObjectKeys() const Get the keys of a JSON Object. Note that this function is only available for JSON Objects. ReturnsIterator_t an iterator on the keys of the object.Parameters
getObjectValueItem getObjectValue(String aName) const getParentItem getParent() const getPrefixString getPrefix() const getStreamstd::istream & getStream() Gets an istream for the item's content.
Returnsthe stream.Parameters
getStringValueString 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. Parameters
getTypeItem 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. Parameters
getTypeCodestore::SchemaTypeCode getTypeCode() const
Returnsthe type of this item based on the enum values in store_const.hgetUnsignedIntValueuint32_t getUnsignedIntValue() const isAtomicbool isAtomic() const isEncodedbool isEncoded() const Returns true if the contents of a binary item is already encoded.
Returnstrue if the content is already encoded, false otherwiseisJSONItembool isJSONItem() const isNaNbool isNaN() const isNodebool isNode() const isNullbool isNull() const isPosOrNegInfbool isPosOrNegInf() const isSeekablebool isSeekable() const Checks whether the item's streamable content is arbitrarily (forward anb backward) seekable.
Returnstrue only if it is.isStreamablebool isStreamable() const Checks whether the item's content is streamable.
Returnstrue only if it is.Item Item() Default constructor.
Item Item(const Item &other) Copy constructor.
Item Item(const store::Item *item) Constructor that is used to construct Items in the Zorba engine itself. This constructor is for internal use only. mem_sizesize_t mem_size() const Gets the total amount of memory this Item and all its child Items are using.
Returnssaid total amount of memory.operator=const Item & operator=(const store::Item *rhs) Assingment operator that is used in the Zorba engine itself. This operator is for internal use only. operator==bool operator==(const Item &rhs)
~Item ~Item() Destructor.
|