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

A ZorbaException is the base class for all Zorba exceptions. More...

#include <zorba/zorba_exception.h>

Inheritance diagram for zorba::ZorbaException:
Inheritance graph
[legend]

Public Types

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...
 

Public Member Functions

Diagnostic const & diagnostic () const throw ()
 Gets the diagnostic carried by this exception. More...
 
ZorbaExceptionoperator= (ZorbaException const &from)
 Assigns this ZorbaException from another. More...
 
virtual void polymorphic_throw () const
 Throws itself polymorphically; see http://www.parashift.com/c++-faq-lite/exceptions.html#faq-17.16. 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_diagnostic (Diagnostic const &diagnostic) throw ()
 Sets the diagnostic. More...
 
char const * what () const throw ()
 
 ZorbaException (ZorbaException const &from)
 Copy-constructs a ZorbaException. More...
 
 ~ZorbaException () throw ()
 Destroys this ZorbaException. 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 void set_print_format (std::ostream &o, print_format f)
 Sets the print_format of the given ostream. More...
 

Protected Member Functions

virtual std::unique_ptr
< ZorbaException
clone () const
 Clones this exception object. More...
 
std::ostream & print (std::ostream &) const
 Prints the exception to the given ostream. More...
 
virtual std::ostream & print_impl (std::ostream &o) const
 
 ZorbaException (Diagnostic const &diagnostic, char const *raise_file, line_type raise_line, char const *message)
 Constructs a ZorbaException. More...
 
 ZorbaException (serialization::Archiver &)
 

Friends

std::unique_ptr< ZorbaExceptionclone (ZorbaException const &)
 
ZorbaException make_zorba_exception (char const *, line_type, Diagnostic const &, internal::diagnostic::parameters const &)
 
ZorbaExceptionnew_zorba_exception (char const *, line_type, Diagnostic const &, internal::diagnostic::parameters const &)
 
std::ostream & operator<< (std::ostream &, ZorbaException const &)
 Emits the given ZorbaException to the given ostream. More...
 
void serialization::operator& (serialization::Archiver &, ZorbaException *&)
 

Detailed Description

A ZorbaException is the base class for all Zorba exceptions.

Examples:
context.cpp, datamanager.cpp, errors.cpp, external_functions.cpp, sax2.cpp, serialization.cpp, and simple.cpp.

Definition at line 42 of file zorba_exception.h.

Member Typedef Documentation

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.

Constructor & Destructor Documentation

zorba::ZorbaException::ZorbaException ( ZorbaException const &  from)

Copy-constructs a ZorbaException.

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

Destroys this ZorbaException.

zorba::ZorbaException::ZorbaException ( Diagnostic const &  diagnostic,
char const *  raise_file,
line_type  raise_line,
char const *  message 
)
protected

Constructs a ZorbaException.

Parameters
diagnosticThe diagnostic.
raise_fileThe C++ source-code file name whence the exception was raised.
raise_lineThe C++ source-code line number whence the exception was raised.
messageThe diagnostic message.
zorba::ZorbaException::ZorbaException ( serialization::Archiver &  )
protected

Member Function Documentation

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

Clones this exception object.

Returns
Returns a clone of this exception.

Reimplemented in zorba::XQueryException, and zorba::UserException.

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

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)
inlinestatic

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.

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

Assigns this ZorbaException from another.

Parameters
fromThe ZorbaException to assign from.
Returns
Returns *this.
virtual void zorba::ZorbaException::polymorphic_throw ( ) const
virtual
std::ostream& zorba::ZorbaException::print ( std::ostream &  ) const
protected

Prints the exception to the given ostream.

Parameters
oThe ostream to print to.
Returns
Returns o.

Referenced by zorba::operator<<().

virtual std::ostream& zorba::ZorbaException::print_impl ( std::ostream &  o) const
protectedvirtual

Reimplemented in zorba::XQueryException.

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

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 ()
inline

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::ZorbaException::set_diagnostic ( Diagnostic const &  diagnostic) throw ()
inline

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 
)
inlinestatic

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<<().

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

Friends And Related Function Documentation

std::unique_ptr<ZorbaException> clone ( ZorbaException const &  )
friend
ZorbaException make_zorba_exception ( char const *  ,
line_type  ,
Diagnostic const &  ,
internal::diagnostic::parameters const &   
)
friend
ZorbaException* new_zorba_exception ( char const *  ,
line_type  ,
Diagnostic const &  ,
internal::diagnostic::parameters const &   
)
friend
std::ostream& operator<< ( std::ostream &  o,
ZorbaException const &  e 
)
friend

Emits the given ZorbaException to the given ostream.

Parameters
oThe ostream to emit to.
eThe ZorbaException to emit.
Returns
Returns o.

Definition at line 209 of file zorba_exception.h.

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

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