akonadi
exception.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef AKONADI_EXCEPTION_H
00021 #define AKONADI_EXCEPTION_H
00022
00023 #include "akonadi_export.h"
00024
00025 #include <QtCore/QByteArray>
00026 #include <exception>
00027
00028 class QString;
00029
00030 namespace Akonadi {
00031
00035 class AKONADI_EXPORT Exception : public std::exception
00036 {
00037 public:
00041 Exception( const char *what ) throw();
00042
00046 Exception( const QByteArray &what ) throw();
00047
00051 Exception( const QString &what ) throw();
00052
00056 Exception( const Exception &other ) throw();
00057
00061 virtual ~Exception() throw();
00062
00066 const char* what() const throw();
00067
00071 virtual QByteArray type() const throw();
00072
00073 private:
00074 class Private;
00075 Private * const d;
00076 };
00077
00078 #define AKONADI_EXCEPTION_MAKE_TRIVIAL_INSTANCE( classname ) \
00079 class classname : public Akonadi::Exception \
00080 { \
00081 public: \
00082 classname ( const char *what ) throw() : Akonadi::Exception( what ) {} \
00083 classname ( const QByteArray &what ) throw() : Akonadi::Exception( what ) {} \
00084 classname ( const QString &what ) throw() : Akonadi::Exception( what ) {} \
00085 QByteArray type() const throw() { return QByteArray( "Akonadi::" #classname ); } \
00086 }
00087
00088 AKONADI_EXCEPTION_MAKE_TRIVIAL_INSTANCE( PayloadException );
00089
00090 #undef AKONADI_EXCEPTION_MAKE_TRIVIAL_INSTANCE
00091
00092 }
00093
00094 #endif