zorba::DynamicContext#include <zorba/dynamic_context.h> Instances of the class DynamicContext contain the information that is available at the time the query is executed. The class contains the information that is defined in the XQuery specification (see http://www.w3.org/TR/xquery/#eval_context).A dynamic context always belongs to a particular query and, hence, can be retrieved by calling getDynamicContext on a compiled query (see XQuery::getDynamicContext()).Public Functions
Protected Functions
Public FunctionsaddExternalFunctionParambool addExternalFunctionParam(const String &aName, void *aValue)=0 Add a name-value pair to this context. The value can be accessed in the evaluate method of external functions (see ContextualExternalFunction). Parameters
Returnsreturns true if an entry with the same name did not already exist, false otherwise.addExternalFunctionParameterbool addExternalFunctionParameter(const String &aName, ExternalFunctionParameter *aParam) const =0 Add a name-value pair to this context. The value can be accessed in the evaluate method of external functions (see ContextualExternalFunction). Parameters
Returnstrue if an entry with the same name did not exist already, false otherwise.getCalendartime::calendar::type getCalendar() const =0 Gets the current calendar.
Returnsthe current calendar.getContextItembool getContextItem(Item &aItem) const =0 Returns the current value of the context item.
Parameters
Returnstrue if the variable has been retrieved successfully, false otherwise.Parameters
getContextPositionbool getContextPosition(Item &aItem) const =0 Returns the current value of the context item position.
Parameters
Returnstrue if the variable has been retrieved successfully, false otherwise.Parameters
getContextSizebool getContextSize(Item &aItem) const =0 Returns the current value of the context item size.
Parameters
Returnstrue if the variable has been retrieved successfully, false otherwise.Parameters
getCurrentDateTimeItem getCurrentDateTime() const =0 Retrieve the dateTime Item used at the time the query is executed (see setCurrentDateTime()).
getDefaultCollectionItem getDefaultCollection() const =0 Return the value of the default collection that is used when calling the fn:collection function without a parameter.
ReturnsItem the default collection that is set in this dynamic context.Parameters
getExternalFunctionParambool getExternalFunctionParam(const String &aName, void *&aValue) const =0 Get the value of a pair that was registered using the addExternalFunctionParam method. This can be used in the evaluate method of external functions (see ContextualExternalFunction). Parameters
Returnstrue if an entry with the given name was found, false otherwise.getExternalFunctionParameterExternalFunctionParameter * getExternalFunctionParameter(const String &aName) const =0 Get the value of a pair that was registered using the addExternalFunctionParam method. This can be used in the evaluate method of external functions (see ContextualExternalFunction). Parameters
Returnsthe ExternalFunctionParameter* that was added using addExternalFunctionParameter, or 0 if no entry with the given name was found.getImplicitTimezoneint getImplicitTimezone() const =0 Retrieve the implicit timezone used in comparisons or arithmetic operations of date, time, or dateTime values.
Returnsthe implicit timezone as the number of seconds east of the prime medidian. Note that 0 is returned if an error occured and an DiagnosticHandler is used.Parameters
getLocalevoid getLocale(locale::iso639_1::type *aLang, locale::iso3166_1::type *aCountry) const =0 Gets the locale.
Parameters
getVariablebool getVariable(const String &aNamespace, const String &aLocalname, Item &aItem, Iterator_t &aIterator) const =0 Returns the current value of an external variable. Exactly one of the two return values (aItem or aIterator) will be non-null; that is, have isNull() == false.The named external variable may be located in the main query or in any modules imported directly or indirectly by the query. Parameters
Returnstrue if the variable has been retrieved successfully, false otherwise.Parameters
isBoundContextItembool isBoundContextItem() const =0 Returns true if a context item has been bound to the Dynamic Context.
isBoundExternalVariablebool isBoundExternalVariable(const String &aNamespace, const String &aLocalname) const =0 Returns true if the variable is bound to a value.
Parameters
setCalendarvoid setCalendar(time::calendar::type aCalendar)=0 Sets the calendar.
Parameters
setContextItembool setContextItem(const Item &aItem)=0 setContextPositionbool setContextPosition(const Item &aItem)=0 setContextSizebool setContextSize(const Item &aItem)=0 setCurrentDateTimebool setCurrentDateTime(const Item &aDateTimeItem)=0 Defines the value of the current date time that can be accessed by the fn:current-dateTime() function at the time the query is executed. If the current date time has not been set explicitly the value of the date and time is used at the time the query is created or cloned, respectively. Parameters
Returnstrue if the variable has been set successfully, false otherwise.setDefaultCollectionbool setDefaultCollection(const Item &aCollectionUri)=0 Defines the value of the default collection that is used when calling the fn:collection function without a parameter.
Parameters
Returnstrue if the default collection has been set successfully, false otherwise.Parameters
setImplicitTimezonebool setImplicitTimezone(int aTimezone)=0 Defines the variable of the implicit timezone to be used when a date, time, or dateTime value that does not have a timezone is used in a comparison or arithmetic operation.
Parameters
Returnstrue if the implicit timezone has been set successfully, false otherwise.Parameters
setLocalevoid setLocale(locale::iso639_1::type aLang, locale::iso3166_1::type aCountry)=0 Sets the locale.
Parameters
setVariablebool setVariable(const String &aQName, const Item &aItem)=0 Defines the external variable identified by aQName and assigns it the value of aItem. aQName may be in one of two forms: A lexical QName (eg. "ns:foo"), or a James Clark-style universal name (eg. "{nsuri}:foo"). If it is a universal name, then this method will find the named external variable in the main query or in any modules imported directly or indirectly by the query. If it is a lexical QName, then it is only possible to resolve the prefix in the the context of the main query, hence only external variables in the main query or those in directly-imported modules may be bound. Parameters
Returnstrue if the variable has been set, false otherwise.Parameters
setVariablebool setVariable(const String &inNamespace, const String &inLocalname, const Item &inValue)=0 Defines the external variable identified by an expanded QName and assigns it the value of aItem. The named external variable may be located in the main query or in any modules imported directly or indirectly by the query. Parameters
Returnstrue if the variable has been set successfully, false otherwise.Parameters
setVariablebool setVariable(const String &aQName, const Iterator_t &aIterator)=0 Defines the external variable identified by aQName and assigns it the sequence that is returned by evaluating aIterator. aQName may be in one of two forms: A lexical QName (eg. "ns:foo"), or a James Clark-style universal name (eg. "{nsuri}:foo"). If it is a universal name, then this method will find the named external variable in the main query or in any modules imported directly or indirectly by the query. If it is a lexical QName, then it is only possible to resolve the prefix in the the context of the main query, hence only external variables in the main query or those in directly-imported modules may be bound. Parameters
Returnstrue if the variable has been set successfully, false otherwise.Parameters
setVariablebool setVariable(const String &aNamespace, const String &aLocalname, const Iterator_t &aIterator)=0 Defines the external variable identified by an expanded QName and assigns it the sequence that is returned by evaluating aIterator. The named external variable may be located in the main query or in any modules imported directly or indirectly by the query. Parameters
Returnstrue if the variable has been set successfully, false otherwise.Parameters
Protected Functions~DynamicContext ~DynamicContext() Destructor.
|