Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Friends | List of all members
zorba::XQueryException Class Reference

An XQueryException is-a ZorbaException for errors with the user's XQuery. More...

#include <zorba/xquery_exception.h>

Inheritance diagram for zorba::XQueryException:
Inheritance graph
[legend]
Collaboration diagram for zorba::XQueryException:
Collaboration graph
[legend]

Public Types

typedef
internal::diagnostic::location::column_type 
column_type
 
typedef
internal::diagnostic::location::line_type 
line_type
 
enum  print_format { format_text = 0, format_xml = 1, format_xml_indented = 3 }
 The format to print exceptions as to an ostream. More...
 
enum  print_trace { trace, no_trace }
 Whether to include the XQuery stack trace for the XQueryException that's printed to an ostream. More...
 

Public Member Functions

column_type applied_column () const throw ()
 Gets the XQuery source-code "applied at" column number containing the error. More...
 
column_type applied_column_end () const throw ()
 Gets the XQuery source-code "applied at" end column number containing the error. More...
 
line_type applied_line () const throw ()
 Gets the XQuery source-code "applied at" line number containing the error. More...
 
line_type applied_line_end () const throw ()
 Gets the XQuery source-code "applied at" end line number containing the error. More...
 
char const * applied_uri () const throw ()
 Gets the XQuery source-code "applied at" URI containing the error. More...
 
column_type data_column () const throw ()
 Gets the data column number containing the error. More...
 
column_type data_column_end () const throw ()
 Gets the data end column number containing the error. More...
 
line_type data_line () const throw ()
 Gets the data line number containing the error. More...
 
line_type data_line_end () const throw ()
 Gets the data end line number containing the error. More...
 
char const * data_uri () const throw ()
 Gets the data URI containing the error. More...
 
Diagnostic const & diagnostic () const throw ()
 Gets the diagnostic carried by this exception. More...
 
bool has_applied () const throw ()
 Checks whether the XQuery "applied at" location has been set. More...
 
bool has_data () const throw ()
 Checks whether the XQuery data location has been set. More...
 
bool has_source () const throw ()
 Checks whether the XQuery source-code location has been set. More...
 
XQueryExceptionoperator= (XQueryException const &from)
 Assigns this XQueryException from another. More...
 
void polymorphic_throw () const
 Throws itself polymorphically; see http://www.parashift.com/c++-faq-lite/exceptions.html#faq-17.16. More...
 
XQueryStackTracequery_trace () throw ()
 Gets the XQuery stack trace, if any. More...
 
XQueryStackTrace const & query_trace () const throw ()
 Gets the XQuery stack trace, if any. More...
 
char const * raise_file () const throw ()
 Gets the C++ source-code file name whence this exception was raised. More...
 
line_type raise_line () const throw ()
 Gets the C++ source-code line number whence this exception was raised. More...
 
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. More...
 
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. More...
 
void set_diagnostic (Diagnostic const &diagnostic) throw ()
 Sets the diagnostic. More...
 
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. More...
 
column_type source_column () const throw ()
 Gets the XQuery source-code column number containing the error. More...
 
column_type source_column_end () const throw ()
 Gets the XQuery source-code end column number containing the error. More...
 
line_type source_line () const throw ()
 Gets the XQuery source-code line number containing the error. More...
 
line_type source_line_end () const throw ()
 Gets the XQuery source-code end line number containing the error. More...
 
char const * source_uri () const throw ()
 Gets the XQuery source-code URI containing the error. More...
 
char const * what () const throw ()
 
 XQueryException (XQueryException const &from)
 Copy-constructs an XQueryException. More...
 
 ~XQueryException () throw ()
 Destroys this XQueryException. More...
 

Static Public Member Functions

static print_format get_print_format (std::ostream &o)
 Gets the current print_format associated with the given ostream. More...
 
static bool get_print_trace (std::ostream &o)
 Gets whether XQuery stack traces will be included when XQueryExceptions are printed to the given ostream. More...
 
static void set_print_format (std::ostream &o, print_format f)
 Sets the print_format of the given ostream. More...
 
static 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. More...
 

Protected Member Functions

std::unique_ptr< ZorbaExceptionclone () const
 Clones this exception object. More...
 
std::ostream & print (std::ostream &) const
 Prints the exception to the given ostream. More...
 
std::ostream & print_impl (std::ostream &) const
 
std::ostream & print_stack_trace (std::ostream &) const
 
 XQueryException (serialization::Archiver &ar)
 

Static Protected Member Functions

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

Friends

XQueryException make_xquery_exception (char const *, ZorbaException::line_type, Diagnostic const &, parameters const &, location const &)
 
XQueryExceptionnew_xquery_exception (char const *, ZorbaException::line_type, Diagnostic const &, parameters const &, location const &)
 
void serialization::operator& (serialization::Archiver &, ZorbaException *&)
 
void set_applied (ZorbaException &, char const *, line_type, column_type, line_type, column_type, bool)
 
void set_data (ZorbaException &, char const *, line_type, column_type, line_type, column_type, bool)
 
void set_source (ZorbaException &, char const *, line_type, column_type, line_type, column_type, bool)
 
class UserException
 

Detailed Description

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.

Examples:
context.cpp, and errors.cpp.

Definition at line 37 of file xquery_exception.h.

Member Typedef Documentation

Definition at line 39 of file xquery_exception.h.

Definition at line 44 of file zorba_exception.h.

Member Enumeration Documentation

The format to print exceptions as to an ostream.

Enumerator
format_text 

plain text

format_xml 

XML without unnecessary whitespace.

format_xml_indented 

XML with newlines and indentation.

Definition at line 49 of file zorba_exception.h.

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

Enumerator
trace 
no_trace 

Definition at line 45 of file xquery_exception.h.

Constructor & Destructor Documentation

zorba::XQueryException::XQueryException ( XQueryException const &  from)

Copy-constructs an XQueryException.

Parameters
fromThe XQueryException to copy from.
zorba::XQueryException::~XQueryException ( ) throw ()

Destroys this XQueryException.

zorba::XQueryException::XQueryException ( serialization::Archiver &  ar)
protected

Member Function Documentation

column_type zorba::XQueryException::applied_column ( ) const throw ()
inline

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

Returns
Returns said column number or 0 if unset.

Definition at line 264 of file xquery_exception.h.

column_type zorba::XQueryException::applied_column_end ( ) const throw ()
inline

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

Returns
Returns said column number or 0 if unset.

Definition at line 284 of file xquery_exception.h.

line_type zorba::XQueryException::applied_line ( ) const throw ()
inline

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

Returns
Returns said line number or 0 if unset.

Definition at line 254 of file xquery_exception.h.

line_type zorba::XQueryException::applied_line_end ( ) const throw ()
inline

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

Returns
Returns said line number or 0 if unset.

Definition at line 274 of file xquery_exception.h.

char const* zorba::XQueryException::applied_uri ( ) const throw ()
inline

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

Returns
Returns said URI or the empty string if unset.

Definition at line 245 of file xquery_exception.h.

std::unique_ptr<ZorbaException> zorba::XQueryException::clone ( ) const
protectedvirtual

Clones this exception object.

Returns
Returns a clone of this exception.

Reimplemented from zorba::ZorbaException.

column_type zorba::XQueryException::data_column ( ) const throw ()
inline

Gets the data column number containing the error.

Returns
Returns said column number or 0 if unset.

Definition at line 190 of file xquery_exception.h.

column_type zorba::XQueryException::data_column_end ( ) const throw ()
inline

Gets the data end column number containing the error.

Returns
Returns said column number or 0 if unset.

Definition at line 208 of file xquery_exception.h.

line_type zorba::XQueryException::data_line ( ) const throw ()
inline

Gets the data line number containing the error.

Returns
Returns said line number or 0 if unset.

Definition at line 181 of file xquery_exception.h.

line_type zorba::XQueryException::data_line_end ( ) const throw ()
inline

Gets the data end line number containing the error.

Returns
Returns said line number or 0 if unset.

Definition at line 199 of file xquery_exception.h.

char const* zorba::XQueryException::data_uri ( ) const throw ()
inline

Gets the data URI containing the error.

Returns
Returns said URI or the empty string if unset.

Definition at line 172 of file xquery_exception.h.

Diagnostic const& zorba::ZorbaException::diagnostic ( ) const throw ()
inlineinherited

Gets the diagnostic carried by this exception.

Returns
Returns said diagnostic.
Examples:
errors.cpp, external_functions.cpp, and simple.cpp.

Definition at line 80 of file zorba_exception.h.

static print_format zorba::ZorbaException::get_print_format ( std::ostream &  o)
inlinestaticinherited

Gets the current print_format associated with the given ostream.

Parameters
oThe ostream to get the print_format of.
Returns
Returns said print_format.

Definition at line 90 of file zorba_exception.h.

static bool zorba::XQueryException::get_print_trace ( std::ostream &  o)
inlinestatic

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

Parameters
oThe ostream.
Returns
Returns true only if stack traces will be included.

Definition at line 297 of file xquery_exception.h.

bool zorba::XQueryException::has_applied ( ) const throw ()
inline

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

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

Definition at line 219 of file xquery_exception.h.

bool zorba::XQueryException::has_data ( ) const throw ()
inline

Checks whether the XQuery data location has been set.

Returns
Returns true only if the data location has been set.

Definition at line 148 of file xquery_exception.h.

bool zorba::XQueryException::has_source ( ) const throw ()
inline

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

Returns
Returns true only if said has been set.

Definition at line 77 of file xquery_exception.h.

XQueryException& zorba::XQueryException::operator= ( XQueryException const &  from)

Assigns this XQueryException from another.

Parameters
fromThe XQueryException to assign from.
Returns
Returns *this.
void zorba::XQueryException::polymorphic_throw ( ) const
virtual

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

Reimplemented from zorba::ZorbaException.

std::ostream& zorba::ZorbaException::print ( std::ostream &  ) const
protectedinherited

Prints the exception to the given ostream.

Parameters
oThe ostream to print to.
Returns
Returns o.

Referenced by zorba::operator<<().

std::ostream& zorba::XQueryException::print_impl ( std::ostream &  ) const
protectedvirtual

Reimplemented from zorba::ZorbaException.

std::ostream& zorba::XQueryException::print_stack_trace ( std::ostream &  ) const
protected
static bool zorba::XQueryException::print_uri ( std::ostream &  ,
char const *  uri 
)
staticprotected
XQueryStackTrace& zorba::XQueryException::query_trace ( ) throw ()
inline

Gets the XQuery stack trace, if any.

Returns
Returns said stack trace.

Definition at line 306 of file xquery_exception.h.

XQueryStackTrace const& zorba::XQueryException::query_trace ( ) const throw ()
inline

Gets the XQuery stack trace, if any.

Returns
Returns said stack trace.

Definition at line 315 of file xquery_exception.h.

char const* zorba::ZorbaException::raise_file ( ) const throw ()
inlineinherited

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

Returns
Returns said file name.

Definition at line 114 of file zorba_exception.h.

line_type zorba::ZorbaException::raise_line ( ) const throw ()
inlineinherited

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

Returns
Returns said line number.

Definition at line 123 of file zorba_exception.h.

void zorba::XQueryException::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
uriThe source-code "applied at" URI name. If either the null pointer or the empty string, source_uri() is used.
lineThe source-code "applied at" URI line number.
columnThe source-code "applied at" URI column number.
line_endThe source-code "applied at" URI end line number.
column_endThe source-code "applied at" URI end column number.
void zorba::XQueryException::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
uriThe source-code data URI name. Must not be null.
lineThe source-code data URI line number.
columnThe source-code data URI column number.
line_endThe source-code data URI end line number.
column_endThe source-code data URI end column number.
void zorba::ZorbaException::set_diagnostic ( Diagnostic const &  diagnostic) throw ()
inlineinherited

Sets the diagnostic.

Parameters
diagnosticThe diagnostic.

Definition at line 105 of file zorba_exception.h.

static void zorba::ZorbaException::set_print_format ( std::ostream &  o,
print_format  f 
)
inlinestaticinherited

Sets the print_format of the given ostream.

Parameters
oThe ostream to set the print_format of.
fThe print_format value.

Definition at line 133 of file zorba_exception.h.

Referenced by zorba::operator<<().

static void zorba::XQueryException::set_print_trace ( std::ostream &  o,
bool  print 
)
inlinestatic

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

Parameters
oThe ostream to affect.
printIf true, stack traces will be included.

Definition at line 326 of file xquery_exception.h.

Referenced by zorba::operator<<().

void zorba::XQueryException::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
uriThe source-code URI name.
lineThe source-code URI line number.
columnThe source-code URI column number.
line_endThe source-code URI end line number.
column_endThe source-code URI end column number.
column_type zorba::XQueryException::source_column ( ) const throw ()
inline

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

Returns
Returns said column number or 0 if unset.

Definition at line 119 of file xquery_exception.h.

column_type zorba::XQueryException::source_column_end ( ) const throw ()
inline

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

Returns
Returns said column number or 0 if unset.

Definition at line 137 of file xquery_exception.h.

line_type zorba::XQueryException::source_line ( ) const throw ()
inline

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

Returns
Returns said line number or 0 if unset.

Definition at line 110 of file xquery_exception.h.

line_type zorba::XQueryException::source_line_end ( ) const throw ()
inline

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

Returns
Returns said line number or 0 if unset.

Definition at line 128 of file xquery_exception.h.

char const* zorba::XQueryException::source_uri ( ) const throw ()
inline

Gets the XQuery source-code URI containing the error.

Returns
Returns said URI or the empty string if unset.

Definition at line 101 of file xquery_exception.h.

char const* zorba::ZorbaException::what ( ) const throw ()
inherited
Examples:
simple.cpp.

Friends And Related Function Documentation

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
friend class UserException
friend

Definition at line 386 of file xquery_exception.h.


The documentation for this class was generated from the following file: