Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef ZORBA_XQUERY_EXCEPTION_API_H
00018 #define ZORBA_XQUERY_EXCEPTION_API_H
00019
00020 #include <zorba/xquery_stack_trace.h>
00021 #include <zorba/zorba_exception.h>
00022
00023 namespace zorba {
00024
00025 namespace serialization {
00026 class Archiver;
00027 void operator&( Archiver&, ZorbaException*& );
00028 }
00029
00030
00031
00032
00033
00034
00035
00036
00037 class ZORBA_DLL_PUBLIC XQueryException : public ZorbaException {
00038 public:
00039 typedef internal::diagnostic::location::column_type column_type;
00040
00041
00042
00043
00044
00045
00046 XQueryException( XQueryException const &from );
00047
00048
00049
00050
00051 ~XQueryException() throw();
00052
00053
00054
00055
00056
00057
00058
00059 XQueryException& operator=( XQueryException const &from );
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070 void set_source(
00071 char const *uri,
00072 line_type line,
00073 column_type column = 0,
00074 line_type line_end = 0,
00075 column_type column_end = 0 );
00076
00077
00078
00079
00080
00081
00082 bool has_source() const throw() {
00083 return source_loc_;
00084 }
00085
00086
00087
00088
00089
00090
00091 char const* source_uri() const throw() {
00092 return source_loc_.file();
00093 }
00094
00095
00096
00097
00098
00099
00100 line_type source_line() const throw() {
00101 return source_loc_.line();
00102 }
00103
00104
00105
00106
00107
00108
00109 column_type source_column() const throw() {
00110 return source_loc_.column();
00111 }
00112
00113
00114
00115
00116
00117
00118 line_type source_line_end() const throw() {
00119 return source_loc_.line_end();
00120 }
00121
00122
00123
00124
00125
00126
00127 column_type source_column_end() const throw() {
00128 return source_loc_.column_end();
00129 }
00130
00131
00132
00133
00134
00135
00136 XQueryStackTrace& query_trace() throw() {
00137 return query_trace_;
00138 }
00139
00140
00141
00142
00143
00144
00145 XQueryStackTrace const& query_trace() const throw() {
00146 return query_trace_;
00147 }
00148
00149
00150 void polymorphic_throw() const;
00151
00152 protected:
00153
00154 std::unique_ptr<ZorbaException> clone() const;
00155 std::ostream& print( std::ostream &o ) const;
00156
00157 private:
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168 XQueryException( Diagnostic const &diagnostic, char const *raise_file,
00169 line_type raise_line, char const *message );
00170
00171 internal::diagnostic::location source_loc_;
00172 XQueryStackTrace query_trace_;
00173
00174 friend XQueryException make_xquery_exception(
00175 char const*, ZorbaException::line_type, Diagnostic const&,
00176 internal::diagnostic::parameters const&,
00177 internal::diagnostic::location const&
00178 );
00179
00180 friend XQueryException* new_xquery_exception(
00181 char const*, ZorbaException::line_type, Diagnostic const&,
00182 internal::diagnostic::parameters const&,
00183 internal::diagnostic::location const&
00184 );
00185
00186 friend void set_source( ZorbaException&, char const*, line_type, column_type,
00187 line_type, column_type, bool );
00188
00189 friend class UserException;
00190
00191 protected:
00192
00193 XQueryException( serialization::Archiver &ar );
00194 friend void serialization::operator&( serialization::Archiver&,
00195 ZorbaException*& );
00196 };
00197
00198
00199
00200 }
00201 #endif
00202