zorba::XQueryException

#include <zorba/xquery_exception.h>

Inherited from: zorba::ZorbaException

An XQueryException is-a ZorbaException for errors with the user's XQuery. An XQueryException therefore also contains the XQuery source URI, line, and column numbers.

Public Types

internal::diagnostic::location::column_type

column_type

internal::diagnostic::location::line_type

line_type

print_format

The format to print exceptions as to an ostream.

print_trace

Whether to include the XQuery stack trace for the XQueryException that's printed to an ostream.

Friend Classes

friend XQueryException

make_xquery_exception(char const *, ZorbaException::line_type, Diagnostic const &, parameters const &, location const &)

friend XQueryException *

new_xquery_exception(char const *, ZorbaException::line_type, Diagnostic const &, parameters const &, location const &)

friend void

serialization::operator&(serialization::Archiver &, ZorbaException *&)

friend void

set_applied(ZorbaException &, char const *, line_type, column_type, line_type, column_type, bool)

friend void

set_data(ZorbaException &, char const *, line_type, column_type, line_type, column_type, bool)

friend void

set_source(ZorbaException &, char const *, line_type, column_type, line_type, column_type, bool)

friend class

UserException

Public Functions

column_type

applied_column() const

Gets the XQuery source-code "applied at" column number containing the error.

column_type

applied_column_end() const

Gets the XQuery source-code "applied at" end column number containing the error.

line_type

applied_line() const

Gets the XQuery source-code "applied at" line number containing the error.

line_type

applied_line_end() const

Gets the XQuery source-code "applied at" end line number containing the error.

char const *

applied_uri() const

Gets the XQuery source-code "applied at" URI containing the error.

column_type

data_column() const

Gets the data column number containing the error.

column_type

data_column_end() const

Gets the data end column number containing the error.

line_type

data_line() const

Gets the data line number containing the error.

line_type

data_line_end() const

Gets the data end line number containing the error.

char const *

data_uri() const

Gets the data URI containing the error.

Diagnostic const &

diagnostic() const

Gets the diagnostic carried by this exception.

bool

has_applied() const

Checks whether the XQuery "applied at" location has been set.

bool

has_data() const

Checks whether the XQuery data location has been set.

bool

has_source() const

Checks whether the XQuery source-code location has been set.

XQueryException &

operator=(XQueryException const &from)

Assigns this XQueryException from another.

void

polymorphic_throw() const

Throws itself polymorphically; see http://www.parashift.com/c++-faq-lite/exceptions.html#faq-17.16.

XQueryStackTrace &

query_trace()

Gets the XQuery stack trace, if any.

XQueryStackTrace const &

query_trace() const

Gets the XQuery stack trace, if any.

char const *

raise_file() const

Gets the C++ source-code file name whence this exception was raised.

line_type

raise_line() const

Gets the C++ source-code line number whence this exception was raised.

void

set_applied(char const *uri, line_type line, column_type column=0, line_type line_end=0, column_type column_end=0)

Sets the XQuery source-code "applied at" URI name, line, and column numbers.

void

set_data(char const *uri, line_type line, column_type column=0, line_type line_end=0, column_type column_end=0)

Sets the XQuery source-code data URI name, line, and column numbers.

void

set_diagnostic(Diagnostic const &diagnostic)

Sets the diagnostic.

void

set_source(char const *uri, line_type line, column_type column=0, line_type line_end=0, column_type column_end=0)

Sets the XQuery source-code URI name, line, and column numbers.

column_type

source_column() const

Gets the XQuery source-code column number containing the error.

column_type

source_column_end() const

Gets the XQuery source-code end column number containing the error.

line_type

source_line() const

Gets the XQuery source-code line number containing the error.

line_type

source_line_end() const

Gets the XQuery source-code end line number containing the error.

char const *

source_uri() const

Gets the XQuery source-code URI containing the error.

char const *

what() const

XQueryException(XQueryException const &from)

Copy-constructs an XQueryException.

~XQueryException()

Destroys this XQueryException.

Public Static Functions

print_format

get_print_format(std::ostream &o)

Gets the current print_format associated with the given ostream.

bool

get_print_trace(std::ostream &o)

Gets whether XQuery stack traces will be included when XQueryExceptions are printed to the given ostream.

void

set_print_format(std::ostream &o, print_format f)

Sets the print_format of the given ostream.

void

set_print_trace(std::ostream &o, bool print)

Sets whether XQuery stack traces will be included when XQueryExceptions are printed to the given ostream.

Protected Functions

std::unique_ptr< ZorbaException >

clone() const

Clones this exception object.

std::ostream &

print(std::ostream &) const

Prints the exception to the given ostream.

std::ostream &

print_impl(std::ostream &) const

std::ostream &

print_stack_trace(std::ostream &) const

XQueryException(serialization::Archiver &ar)

Protected Static Functions

bool

print_uri(std::ostream &, char const *uri)

Private Functions

XQueryException(Diagnostic const &diagnostic, char const *raise_file, line_type raise_line, char const *message)

Constructs an XQueryException.

Private Static Functions

int

get_ios_trace_index()

Public Types

print_format

 print_format

The format to print exceptions as to an ostream.

print_trace

 print_trace

Whether to include the XQuery stack trace for the XQueryException that's printed to an ostream.

Private Types

parameters

Private Attributes

applied_loc_

location applied_loc_

data_loc_

location data_loc_

query_trace_

XQueryStackTrace query_trace_

source_loc_

location source_loc_

Friend Classes

make_xquery_exception

friend XQueryException make_xquery_exception(char const *, ZorbaException::line_type, Diagnostic const &, parameters const &, location const &)

new_xquery_exception

friend XQueryException * new_xquery_exception(char const *, ZorbaException::line_type, Diagnostic const &, parameters const &, location const &)

serialization::operator&

friend void serialization::operator&(serialization::Archiver &, ZorbaException *&)

set_applied

friend void set_applied(ZorbaException &, char const *, line_type, column_type, line_type, column_type, bool)

set_data

friend void set_data(ZorbaException &, char const *, line_type, column_type, line_type, column_type, bool)

set_source

friend void set_source(ZorbaException &, char const *, line_type, column_type, line_type, column_type, bool)

UserException

friend class UserException

Public Functions

applied_column

column_type applied_column() const

Gets the XQuery source-code "applied at" column number containing the error.

Returns

Returns said column number or 0 if unset.

applied_column_end

column_type applied_column_end() const

Gets the XQuery source-code "applied at" end column number containing the error.

Returns

Returns said column number or 0 if unset.

applied_line

line_type applied_line() const

Gets the XQuery source-code "applied at" line number containing the error.

Returns

Returns said line number or 0 if unset.

applied_line_end

line_type applied_line_end() const

Gets the XQuery source-code "applied at" end line number containing the error.

Returns

Returns said line number or 0 if unset.

applied_uri

char const * applied_uri() const

Gets the XQuery source-code "applied at" URI containing the error.

Returns

Returns said URI or the empty string if unset.

data_column

column_type data_column() const

Gets the data column number containing the error.

Returns

Returns said column number or 0 if unset.

data_column_end

column_type data_column_end() const

Gets the data end column number containing the error.

Returns

Returns said column number or 0 if unset.

data_line

line_type data_line() const

Gets the data line number containing the error.

Returns

Returns said line number or 0 if unset.

data_line_end

line_type data_line_end() const

Gets the data end line number containing the error.

Returns

Returns said line number or 0 if unset.

data_uri

char const * data_uri() const

Gets the data URI containing the error.

Returns

Returns said URI or the empty string if unset.

diagnostic

Diagnostic const & diagnostic() const

Gets the diagnostic carried by this exception.

Returns

Returns said diagnostic.

has_applied

bool has_applied() const

Checks whether the XQuery "applied at" location has been set.

Returns

Returns true only if the "applied at" location has been set.

has_data

bool has_data() const

Checks whether the XQuery data location has been set.

Returns

Returns true only if the data location has been set.

has_source

bool has_source() const

Checks whether the XQuery source-code location has been set.

Returns

Returns true only if said has been set.

operator=

XQueryException & operator=(XQueryException const &from)

Assigns this XQueryException from another.

Parameters

from The XQueryException to assign from.

Returns

Returns *this.

polymorphic_throw

void polymorphic_throw() const

query_trace

XQueryStackTrace & query_trace()

Gets the XQuery stack trace, if any.

Returns

Returns said stack trace.

query_trace

XQueryStackTrace const & query_trace() const

Gets the XQuery stack trace, if any.

Returns

Returns said stack trace.

raise_file

char const * raise_file() const

Gets the C++ source-code file name whence this exception was raised.

Returns

Returns said file name.

raise_line

line_type raise_line() const

Gets the C++ source-code line number whence this exception was raised.

Returns

Returns said line number.

set_applied

void set_applied(char const *uri, line_type line, column_type column=0, line_type line_end=0, column_type column_end=0)

Sets the XQuery source-code "applied at" URI name, line, and column numbers.

Parameters

uri The source-code "applied at" URI name. If either the null pointer or the empty string, is used.
line The source-code "applied at" URI line number.
column The source-code "applied at" URI column number.
line_end The source-code "applied at" URI end line number.
column_end The source-code "applied at" URI end column number.

set_data

void set_data(char const *uri, line_type line, column_type column=0, line_type line_end=0, column_type column_end=0)

Sets the XQuery source-code data URI name, line, and column numbers.

Parameters

uri The source-code data URI name. Must not be null.
line The source-code data URI line number.
column The source-code data URI column number.
line_end The source-code data URI end line number.
column_end The source-code data URI end column number.

set_diagnostic

void set_diagnostic(Diagnostic const &diagnostic)

Sets the diagnostic.

Parameters

diagnostic The diagnostic.

set_source

void set_source(char const *uri, line_type line, column_type column=0, line_type line_end=0, column_type column_end=0)

Sets the XQuery source-code URI name, line, and column numbers.

Parameters

uri The source-code URI name.
line The source-code URI line number.
column The source-code URI column number.
line_end The source-code URI end line number.
column_end The source-code URI end column number.

source_column

column_type source_column() const

Gets the XQuery source-code column number containing the error.

Returns

Returns said column number or 0 if unset.

source_column_end

column_type source_column_end() const

Gets the XQuery source-code end column number containing the error.

Returns

Returns said column number or 0 if unset.

source_line

line_type source_line() const

Gets the XQuery source-code line number containing the error.

Returns

Returns said line number or 0 if unset.

source_line_end

line_type source_line_end() const

Gets the XQuery source-code end line number containing the error.

Returns

Returns said line number or 0 if unset.

source_uri

char const * source_uri() const

Gets the XQuery source-code URI containing the error.

Returns

Returns said URI or the empty string if unset.

what

char const * what() const

XQueryException

 XQueryException(XQueryException const &from)

Copy-constructs an XQueryException.

Parameters

from The XQueryException to copy from.

~XQueryException

 ~XQueryException()

Destroys this XQueryException.

Public Static Functions

get_print_format

print_format get_print_format(std::ostream &o)

Gets the current print_format associated with the given ostream.

Parameters

o The ostream to get the print_format of.

Returns

Returns said print_format.

get_print_trace

bool get_print_trace(std::ostream &o)

Gets whether XQuery stack traces will be included when XQueryExceptions are printed to the given ostream.

Parameters

o The ostream.

Returns

Returns true only if stack traces will be included.

set_print_format

void set_print_format(std::ostream &o, print_format f)

Sets the print_format of the given ostream.

Parameters

o The ostream to set the print_format of.
f The print_format value.

set_print_trace

void set_print_trace(std::ostream &o, bool print)

Sets whether XQuery stack traces will be included when XQueryExceptions are printed to the given ostream.

Parameters

o The ostream to affect.
print If true, stack traces will be included.

Protected Functions

clone

std::unique_ptr< ZorbaException > clone() const

Clones this exception object.

Returns

Returns a clone of this exception.

print

std::ostream & print(std::ostream &) const

Prints the exception to the given ostream.

Parameters

o The ostream to print to.

Returns

Returns o.

print_impl

std::ostream & print_impl(std::ostream &) const

print_stack_trace

std::ostream & print_stack_trace(std::ostream &) const

XQueryException

 XQueryException(serialization::Archiver &ar)

Protected Static Functions

print_uri

bool print_uri(std::ostream &, char const *uri)

Private Functions

XQueryException

 XQueryException(Diagnostic const &diagnostic, char const *raise_file, line_type raise_line, char const *message)

Constructs an XQueryException.

Parameters

diagnostic The diagnostic.
raise_file The C++ source-code file name whence the exception was raised.
raise_line The C++ source-code line number whence the exception was raised.
message The diagnostic message.

Private Static Functions

get_ios_trace_index

int get_ios_trace_index()