include/xapian/error.h
Go to the documentation of this file.00001
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
#ifndef XAPIAN_INCLUDED_ERROR_H
00026
#define XAPIAN_INCLUDED_ERROR_H
00027
00028
#include <string>
00029
00030
namespace Xapian {
00031
00032
class ErrorHandler;
00033
00038 class Error {
00039
friend class ErrorHandler;
00040
private:
00042 std::string msg;
00043
00045 std::string context;
00046
00048 std::string type;
00049
00051
int errno_value;
00052
00054
bool has_been_handled;
00055
00057
void operator=(
const Error ©me);
00058
00059
protected:
00063
Error(
const std::string &msg_,
const std::string &context_,
00064
const std::string &type_,
int errno_value_);
00065
00066
Error(
const Error &o) : msg(o.
msg), context(o.
context), type(o.
type),
00067 errno_value(o.
errno_value), has_been_handled(o.
has_been_handled) {}
00068
00069
public:
00073 std::string
get_msg()
const
00074
{
00075
return msg;
00076 }
00077
00079 std::string
get_type()
const
00080
{
00081
return type;
00082 }
00083
00085 std::string
get_context()
const
00086
{
00087
return context;
00088 }
00089
00091 int get_errno()
const
00092
{
00093
return errno_value;
00094 }
00095
00097 virtual ~Error() { }
00098 };
00099
00101 #define XAPIAN_DEFINE_ERROR_BASECLASS(a, b) \
00102
class a : public b { \
00103
protected: \
00104
\
00105
a(const std::string &msg_, \
00106
const std::string &context_, \
00107
const std::string &type_, \
00108
int errno_value_) : b(msg_, context_, type_, errno_value_) {} \
00109
}
00110
00112 #define XAPIAN_DEFINE_ERROR_CLASS(a, b) \
00113
class a : public b { \
00114
public: \
00115
\
00116
a(const std::string &msg_, \
00117
const std::string &context_ = "", \
00118
int errno_value_ = 0) : b(msg_, context_, #a, errno_value_) {} \
00119
\
00120
a(const std::string &msg_, \
00121
int errno_value_) : b(msg_, "", #a, errno_value_) {} \
00122
protected: \
00123
\
00124
a(const std::string &msg_, \
00125
const std::string &context_, \
00126
const std::string &type_, \
00127
int errno_value_) : b(msg_, context_, type_, errno_value_) {} \
00128
}
00129
00130
#include <xapian/errortypes.h>
00131
00132
#undef XAPIAN_DEFINE_ERROR_BASECLASS
00133
#undef XAPIAN_DEFINE_ERROR_CLASS
00134
00135 }
00136
00137
#endif
Documentation for Xapian (version 0.9.2).
Generated on 15 Jul 2005 by
Doxygen 1.3.8.