zorba

Copyright 2006-2013 The FLWOR Foundation. This header includes utility functions for certain timing-related operations, namely getting current wall-clock time and current CPU-used time values in a platform-dependent fashion, and computing deltas for both types.Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.Types: cputime - type representing CPU time utilized thus far by this process walltime - type representing wall-clock time since some platform-dependent epochFunction signatures: void get_current_cputime(cputime& t) - returns current CPU timedouble get_cputime_elapsed(const cputime& t0, const cputime& t1) - calculates elapsed CPU time (in ms) between two cputimesvoid get_current_walltime(walltime& t) - returns current wall-clock timedouble get_walltime_elapsed(const walltime& t0, const walltime& t1) - calculates elapsed wall-clock time (in ms) between two walltimes TODO These functions should probably be defined in a .cpp file somewhere rather than here in time.h; as it is they will be compiled into every .o that uses them. So far, though, this is only zorbacmd and the implementation of fn:doc(), so it's not too bad.

Enumerations

boundary_space_mode_t

Boundary-space policy as defined in http://www.w3.org/TR/xquery/#static_context.

construction_mode_t

Construction mode as defined in http://www.w3.org/TR/xquery/#static_context.

index_container_kind_t

Container kind of an index as defined in the XQuery Data Definition Facility.

index_maintenance_mode_t

Maintenance mode of an index as defined in the XQuery Data Definition Facility.

inherit_mode_t

Inherit part of the Copy-namespace mode as defined in http://www.w3.org/TR/xquery/#static_context.

jsoniq_version_t

The JSONiq version.

order_empty_mode_t

Default order for empty sequences as defined in http://www.w3.org/TR/xquery/#static_context.

ordering_mode_t

Ordering mode as defined in http://www.w3.org/TR/xquery/#static_context.

preserve_mode_t

Preserve part of the Copy-namespace mode as defined in http://www.w3.org/TR/xquery/#static_context.

validation_mode_t

Revalidation mode as defined in http://www.w3.org/TR/xquery-update-10/#id-revalidation-declaration Note: when DTD validation is needed the use of validate_lax_dtd is required.

xpath1_0compatib_mode_t

XPath 1.0 compatibility mode as defined in http://www.w3.org/TR/xquery/#static_context.

xquery_version_t

The XQuery version, taken from the version declaration, an XQuery 3.0 feature.

Functions

bool

operator!=(uuid const &u1, uuid const &u2)

Compares two UUIDs for inequality.

bool

operator!=(Diagnostic const &d1, Diagnostic const &d2)

Compares two diagnostics for inequality.

bool

operator!=(String const &s1, String const &s2)

bool

operator!=(String const &s1, std::string const &s2)

bool

operator!=(String const &s1, String::const_pointer s2)

bool

operator!=(std::string const &s1, String const &s2)

bool

operator!=(String::const_pointer s1, String const &s2)

ZORBA_DLL_PUBLIC String

operator+(String const &s1, String const &s2)

ZORBA_DLL_PUBLIC String

operator+(String const &s1, std::string const &s2)

ZORBA_DLL_PUBLIC String

operator+(String const &s1, String::const_pointer s2)

ZORBA_DLL_PUBLIC String

operator+(std::string const &s1, String const &s2)

ZORBA_DLL_PUBLIC String

operator+(String::const_pointer s1, String const &s2)

bool

operator<(uuid const &u1, uuid const &u2)

Compares two UUIDs for less-than.

ZORBA_DLL_PUBLIC bool

operator<(String const &s1, String const &s2)

ZORBA_DLL_PUBLIC bool

operator<(String const &s1, std::string const &s2)

ZORBA_DLL_PUBLIC bool

operator<(String const &s1, String::const_pointer s2)

ZORBA_DLL_PUBLIC bool

operator<(std::string const &s1, String const &s2)

ZORBA_DLL_PUBLIC bool

operator<(String::const_pointer s1, String const &s2)

ZORBA_DLL_PUBLIC std::ostream &

operator<<(std::ostream &os, const QueryLocation &aQuery)

ZORBA_DLL_PUBLIC std::ostream &

operator<<(std::ostream &os, const QueryLocation *aQuery)

ZORBA_DLL_PUBLIC std::ostream &

operator<<(std::ostream &os, const Version &aVersion)

Write the result of calling aVersiongetVersion() to the given output stream.

std::ostream &

operator<<(std::ostream &o, ZorbaException const &e)

Emits the given ZorbaException to the given ostream.

std::ostream &

operator<<(std::ostream &o, ZorbaException::print_format f)

Sets the format for the next ZorbaException that's printed.

ZORBA_DLL_PUBLIC std::ostream &

operator<<(std::ostream &os, uuid const &u)

Emits the given UUID to the given ostream in canonical UUID format.

std::ostream &

operator<<(std::ostream &o, XQueryException::print_trace t)

Sets whether to include the XQuery stack trace for the next XQueryException that's printed.

ZORBA_DLL_PUBLIC std::ostream &

operator<<(std::ostream &os, const XQuery_t &aQuery)

ZORBA_DLL_PUBLIC std::ostream &

operator<<(std::ostream &os, XQuery *aQuery)

ZORBA_DLL_PUBLIC std::ostream &

operator<<(std::ostream &o, String const &s)

bool

operator<=(uuid const &u1, uuid const &u2)

Compares two UUIDs for less-than-or-equal-to.

ZORBA_DLL_PUBLIC bool

operator<=(String const &s1, String const &s2)

ZORBA_DLL_PUBLIC bool

operator<=(String const &s1, std::string const &s2)

ZORBA_DLL_PUBLIC bool

operator<=(String const &s1, String::const_pointer s2)

ZORBA_DLL_PUBLIC bool

operator<=(std::string const &s1, String const &s2)

ZORBA_DLL_PUBLIC bool

operator<=(String::const_pointer s1, String const &s2)

bool

operator==(uuid const &u1, uuid const &u2)

Compares two UUIDs for equality.

bool

operator==(Diagnostic const &d1, Diagnostic const &d2)

Compares two diagnostics for equality.

ZORBA_DLL_PUBLIC bool

operator==(String const &s1, String const &s2)

ZORBA_DLL_PUBLIC bool

operator==(String const &s1, std::string const &s2)

ZORBA_DLL_PUBLIC bool

operator==(String const &s1, String::const_pointer s2)

bool

operator==(std::string const &s1, String const &s2)

bool

operator==(String::const_pointer s1, String const &s2)

bool

operator>(uuid const &u1, uuid const &u2)

Compares two UUIDs for greater-than.

bool

operator>(String const &s1, String const &s2)

bool

operator>(String const &s1, std::string const &s2)

bool

operator>(String const &s1, String::const_pointer s2)

bool

operator>(std::string const &s1, String const &s2)

bool

operator>(String::const_pointer s1, String const &s2)

bool

operator>=(uuid const &u1, uuid const &u2)

Compares two UUIDs for greater-than-or-equal-to.

bool

operator>=(String const &s1, String const &s2)

bool

operator>=(String const &s1, std::string const &s2)

bool

operator>=(String const &s1, String::const_pointer s2)

bool

operator>=(std::string const &s1, String const &s2)

bool

operator>=(String::const_pointer s1, String const &s2)

ZORBA_DLL_PUBLIC std::streamsize

read_without_whitespace(std::istream &is, char *buf, std::streamsize n)

Reads from the given istream until n non-whitespace characters are read or until EOF is encountered.

ZORBA_DLL_PUBLIC bool

skip_utf8_bom(std::istream &is)

Skips the UTF-8 byte order mark (BOM), if any.

void

swap(uuid &u1, uuid &u2)

Swaps two UUIDs' data.

Enumerations

boundary_space_mode_t

 boundary_space_mode_t

Boundary-space policy as defined in http://www.w3.org/TR/xquery/#static_context.

construction_mode_t

 construction_mode_t

Construction mode as defined in http://www.w3.org/TR/xquery/#static_context.

index_container_kind_t

 index_container_kind_t

Container kind of an index as defined in the XQuery Data Definition Facility.

index_maintenance_mode_t

 index_maintenance_mode_t

Maintenance mode of an index as defined in the XQuery Data Definition Facility.

inherit_mode_t

 inherit_mode_t

Inherit part of the Copy-namespace mode as defined in http://www.w3.org/TR/xquery/#static_context.

jsoniq_version_t

 jsoniq_version_t

The JSONiq version.

order_empty_mode_t

 order_empty_mode_t

Default order for empty sequences as defined in http://www.w3.org/TR/xquery/#static_context.

ordering_mode_t

 ordering_mode_t

Ordering mode as defined in http://www.w3.org/TR/xquery/#static_context.

preserve_mode_t

 preserve_mode_t

Preserve part of the Copy-namespace mode as defined in http://www.w3.org/TR/xquery/#static_context.

validation_mode_t

 validation_mode_t

Revalidation mode as defined in http://www.w3.org/TR/xquery-update-10/#id-revalidation-declaration Note: when DTD validation is needed the use of validate_lax_dtd is required.

xpath1_0compatib_mode_t

 xpath1_0compatib_mode_t

XPath 1.0 compatibility mode as defined in http://www.w3.org/TR/xquery/#static_context.

xquery_version_t

 xquery_version_t

The XQuery version, taken from the version declaration, an XQuery 3.0 feature.

Type Definitions

Annotation_t

SmartPtr< Annotation > Annotation_t

Collection_t

SmartPtr< Collection > Collection_t

Error

Diagnostic Error

Function_t

SmartPtr< Function > Function_t

itemHandler

Zorba_SerializerOptions_t *(* itemHandler)(void *aUserData)

ItemSequence_t

SmartPtr< ItemSequence > ItemSequence_t

Iterator_t

SmartPtr< Iterator > Iterator_t

JSONiqErrorCode

ModuleInfo_t

SmartPtr< ModuleInfo > ModuleInfo_t

NsBindings

std::vector< std::pair< String, String > > NsBindings

QueryLocation_t

SmartPtr< QueryLocation > QueryLocation_t

Serializer_t

SmartPtr< Serializer > Serializer_t

StaticContext_t

SmartPtr< StaticContext > StaticContext_t

Warning

Diagnostic Warning

XmlDataManager_t

SmartPtr< XmlDataManager > XmlDataManager_t

XQuery_t

SmartPtr< XQuery > XQuery_t

XQueryErrorCode

XQueryWarning

XQueryException XQueryWarning

Re-use an XQueryException as an XQueryWarning to:

  • leverage all the localization and printing code
  • allow warnings to be treated as exceptions and thrown

ZorbaCSVErrorCode

ZorbaDateTimeErrorCode

ZorbaErrorCode

ZorbaURIErrorCode

ZorbaWarningCode

Functions

operator!=

bool operator!=(uuid const &u1, uuid const &u2)

Compares two UUIDs for inequality.

Parameters

u1 The first UUID.
u2 The second UUID.

Returns

Returns true only if the two UUIDs are not equal.

operator!=

bool operator!=(Diagnostic const &d1, Diagnostic const &d2)

Compares two diagnostics for inequality.

Parameters

d1 The first diagnostic.
d2 The second diagnostic.

Returns

Returns true only if the diagnostics' QNames are not equal.

operator!=

bool operator!=(String const &s1, String const &s2)

operator!=

bool operator!=(String const &s1, std::string const &s2)

operator!=

bool operator!=(String const &s1, String::const_pointer s2)

operator!=

bool operator!=(std::string const &s1, String const &s2)

operator!=

bool operator!=(String::const_pointer s1, String const &s2)

operator+

ZORBA_DLL_PUBLIC String operator+(String const &s1, String const &s2)

operator+

ZORBA_DLL_PUBLIC String operator+(String const &s1, std::string const &s2)

operator+

ZORBA_DLL_PUBLIC String operator+(String const &s1, String::const_pointer s2)

operator+

ZORBA_DLL_PUBLIC String operator+(std::string const &s1, String const &s2)

operator+

ZORBA_DLL_PUBLIC String operator+(String::const_pointer s1, String const &s2)

operator<

bool operator<(uuid const &u1, uuid const &u2)

Compares two UUIDs for less-than.

Parameters

u1 The first UUID.
u2 The second UUID.

Returns

Returns true only if the first UUID is less than the second.

operator<

ZORBA_DLL_PUBLIC bool operator<(String const &s1, String const &s2)

operator<

ZORBA_DLL_PUBLIC bool operator<(String const &s1, std::string const &s2)

operator<

ZORBA_DLL_PUBLIC bool operator<(String const &s1, String::const_pointer s2)

operator<

ZORBA_DLL_PUBLIC bool operator<(std::string const &s1, String const &s2)

operator<

ZORBA_DLL_PUBLIC bool operator<(String::const_pointer s1, String const &s2)

operator<<

ZORBA_DLL_PUBLIC std::ostream & operator<<(std::ostream &os, const QueryLocation &aQuery)

operator<<

ZORBA_DLL_PUBLIC std::ostream & operator<<(std::ostream &os, const QueryLocation *aQuery)

operator<<

ZORBA_DLL_PUBLIC std::ostream & operator<<(std::ostream &os, const Version &aVersion)

Write the result of calling aVersiongetVersion() to the given output stream.

operator<<

std::ostream & operator<<(std::ostream &o, ZorbaException const &e)

Emits the given ZorbaException to the given ostream.

Parameters

o The ostream to emit to.
e The ZorbaException to emit.

Returns

Returns o.

operator<<

std::ostream & operator<<(std::ostream &o, ZorbaException::print_format f)

Sets the format for the next ZorbaException that's printed.

Parameters

o The ostream to affect.
f The print_format to use.

Returns

Returns o.

operator<<

ZORBA_DLL_PUBLIC std::ostream & operator<<(std::ostream &os, uuid const &u)

Emits the given UUID to the given ostream in canonical UUID format.

Parameters

os The ostream to emit to.
u The UUID to emit.

Returns

Returns os.

operator<<

std::ostream & operator<<(std::ostream &o, XQueryException::print_trace t)

Sets whether to include the XQuery stack trace for the next XQueryException that's printed.

Parameters

o The ostream to affect.
t The print_trace value.

Returns

Returns o.

operator<<

ZORBA_DLL_PUBLIC std::ostream & operator<<(std::ostream &os, const XQuery_t &aQuery)

operator<<

ZORBA_DLL_PUBLIC std::ostream & operator<<(std::ostream &os, XQuery *aQuery)

operator<<

ZORBA_DLL_PUBLIC std::ostream & operator<<(std::ostream &o, String const &s)

operator<=

bool operator<=(uuid const &u1, uuid const &u2)

Compares two UUIDs for less-than-or-equal-to.

Parameters

u1 The first UUID.
u2 The second UUID.

Returns

Returns true only if the first UUID is less than or equal to the second.

operator<=

ZORBA_DLL_PUBLIC bool operator<=(String const &s1, String const &s2)

operator<=

ZORBA_DLL_PUBLIC bool operator<=(String const &s1, std::string const &s2)

operator<=

ZORBA_DLL_PUBLIC bool operator<=(String const &s1, String::const_pointer s2)

operator<=

ZORBA_DLL_PUBLIC bool operator<=(std::string const &s1, String const &s2)

operator<=

ZORBA_DLL_PUBLIC bool operator<=(String::const_pointer s1, String const &s2)

operator==

bool operator==(uuid const &u1, uuid const &u2)

Compares two UUIDs for equality.

Parameters

u1 The first UUID.
u2 The second UUID.

Returns

Returns true only if the two UUIDs are equal.

operator==

bool operator==(Diagnostic const &d1, Diagnostic const &d2)

Compares two diagnostics for equality.

Parameters

d1 The first diagnostic.
d2 The second diagnostic.

Returns

Returns true only if the diagnostics' QNames are equal.

operator==

ZORBA_DLL_PUBLIC bool operator==(String const &s1, String const &s2)

operator==

ZORBA_DLL_PUBLIC bool operator==(String const &s1, std::string const &s2)

operator==

ZORBA_DLL_PUBLIC bool operator==(String const &s1, String::const_pointer s2)

operator==

bool operator==(std::string const &s1, String const &s2)

operator==

bool operator==(String::const_pointer s1, String const &s2)

operator>

bool operator>(uuid const &u1, uuid const &u2)

Compares two UUIDs for greater-than.

Parameters

u1 The first UUID.
u2 The second UUID.

Returns

Returns true only if the first UUID is greater than the second.

operator>

bool operator>(String const &s1, String const &s2)

operator>

bool operator>(String const &s1, std::string const &s2)

operator>

bool operator>(String const &s1, String::const_pointer s2)

operator>

bool operator>(std::string const &s1, String const &s2)

operator>

bool operator>(String::const_pointer s1, String const &s2)

operator>=

bool operator>=(uuid const &u1, uuid const &u2)

Compares two UUIDs for greater-than-or-equal-to.

Parameters

u1 The first UUID.
u2 The second UUID.

Returns

Returns true only if the first UUID is greater than or equal to the second.

operator>=

bool operator>=(String const &s1, String const &s2)

operator>=

bool operator>=(String const &s1, std::string const &s2)

operator>=

bool operator>=(String const &s1, String::const_pointer s2)

operator>=

bool operator>=(std::string const &s1, String const &s2)

operator>=

bool operator>=(String::const_pointer s1, String const &s2)

read_without_whitespace

ZORBA_DLL_PUBLIC std::streamsize read_without_whitespace(std::istream &is, char *buf, std::streamsize n)

Reads from the given istream until n non-whitespace characters are read or until EOF is encountered.

Parameters

is The istream to read from.
buf A pointer to the start of a buffer to read into.
n The number of non-whitespace characters to read.

Returns

Returns the number of non-whitespace characters read.

skip_utf8_bom

ZORBA_DLL_PUBLIC bool skip_utf8_bom(std::istream &is)

Skips the UTF-8 byte order mark (BOM), if any.

Parameters

is The istream to read.

Returns

Returns true only if a BOM was present and skipped.

swap

void swap(uuid &u1, uuid &u2)

Swaps two UUIDs' data.

Parameters

u1 The first UUID.
u2 The second UUID.