The Zorba Item interface. More...
Public Member Functions | |
void | close () |
Free all resources aquired by this Item. More... | |
Iterator | getAtomizationValue () const |
Get the atomization value of the Item. More... | |
Iterator | getAttributes () const |
Get an iterator for the attributes of this (node) Item. More... | |
bool | getBooleanValue () const |
Get the bool value of the boolean Item. More... | |
Iterator | getChildren () const |
Get an iterator for the children of this (node) Item. More... | |
double | getDoubleValue () const |
Get the int value of the Item. More... | |
Item | getEBV () const |
Get the effective boolean value of the Item. More... | |
int | getIntValue () const |
Get the int value of the Item. More... | |
std::string | getLocalName () const |
Get the value of a QName's local name. More... | |
long long | getLongValue () const |
Get the long value of the Item. More... | |
std::string | getNamespace () const |
Get the (optional) value of a QName's namespace. More... | |
std::vector< std::pair < std::string, std::string > > | getNamespaceBindings () |
Get a vector for the namespace bindings of this (element) Item. More... | |
int | getNodeKind () const |
Get the type of this (node) Item. More... | |
bool | getNodeName (Item &aNodeName) const |
Get the name of this (node) Item. More... | |
Item | getParent () const |
Get parent of this (node) Item. More... | |
std::string | getPrefix () const |
Get the (optional) value of a QName's prefix. More... | |
std::string | getStringValue () const |
Get the string value of the Item. More... | |
Item | getType () const |
Get the type of the Item. More... | |
unsigned int | getUnsignedIntValue () const |
bool | isAtomic () const |
Check if the Item is an atomic Item. More... | |
bool | isNaN () const |
Check if the value of the Item is not a number (NaN). More... | |
bool | isNode () const |
Check if the Item is a node Item. More... | |
bool | isNull () const |
Check if the Item is null. More... | |
bool | isPosOrNegInf () const |
Check if the value of the Item is positive or negative infinity. More... | |
Item () | |
Default constructor. More... | |
Item (const Item &aItem) | |
Copy constructor. More... | |
Item (const zorba::Item &aZItem) | |
Constructor that is used to construct Items in the Zorba engine itself. More... | |
std::string | serialize () const |
Serializes the object. More... | |
std::string | serialize (SerializationOptions serOptions) const |
Serializes the object. More... | |
void | serializeToStream (ZorbaIOStream &aStream) const |
Serializes the object. More... | |
void | serializeToStream (ZorbaIOStream &aStream, SerializationOptions serOptions) const |
Serializes the object. More... | |
Static Public Member Functions | |
static Item | createEmptyItem () |
Static constructor. More... | |
Friends | |
class | Collection |
class | CollectionManager |
class | DocumentManager |
class | DynamicContext |
class | ItemFactory |
class | ItemSequence |
class | Iterator |
class | SingletonIterator |
class | StaticCollectionManager |
class | StaticContext |
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.
Item::Item | ( | const zorba::Item & | aZItem) |
void Item::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.
|
static |
Static constructor.
Iterator Item::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.
ZorbaException | if an error occured. |
Iterator Item::getAttributes | ( | ) | const |
bool Item::getBooleanValue | ( | ) | const |
Iterator Item::getChildren | ( | ) | const |
double Item::getDoubleValue | ( | ) | const |
Item 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.
ZorbaException | if an error occured. |
int Item::getIntValue | ( | ) | const |
std::string Item::getLocalName | ( | ) | const |
Get the value of a QName's local name.
Note that this function is only available for Items of type QName.
ZorbaException | if an error occured, e.g. the Item is not a QName. |
long long Item::getLongValue | ( | ) | const |
std::string Item::getNamespace | ( | ) | const |
Get the (optional) value of a QName's namespace.
Note that this function is only available for Items of type QName.
ZorbaException | if an error occured, e.g. the Item is not a QName. |
std::vector< std::pair< std::string, std::string > > Item::getNamespaceBindings | ( | ) |
int Item::getNodeKind | ( | ) | const |
bool Item::getNodeName | ( | Item & | aNodeName) | const |
Item Item::getParent | ( | ) | const |
std::string Item::getPrefix | ( | ) | const |
Get the (optional) value of a QName's prefix.
Note that this function is only available for Items of type QName.
ZorbaException | if an error occured, e.g. the Item is not a QName. |
std::string Item::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.
ZorbaException | if an error occured. |
Item 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.
ZorbaException | if an error occured. |
unsigned int Item::getUnsignedIntValue | ( | ) | const |
bool Item::isAtomic | ( | ) | const |
bool Item::isNaN | ( | ) | const |
bool Item::isNode | ( | ) | const |
bool Item::isNull | ( | ) | const |
bool Item::isPosOrNegInf | ( | ) | const |
std::string Item::serialize | ( | ) | const |
Serializes the object.
Returns a string with the value of the object serialized
ZorbaException | if an error occured. |
std::string Item::serialize | ( | SerializationOptions | serOptions) | const |
void Item::serializeToStream | ( | ZorbaIOStream & | aStream) | const |
Serializes the object.
Put the serialized object into the specified stream.
aStream | The stream to write the value of the Item. |
ZorbaException | if an error occured. |
void Item::serializeToStream | ( | ZorbaIOStream & | aStream, |
SerializationOptions | serOptions | ||
) | const |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |