errorhandler.hxx
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef PQXX_H_ERRORHANDLER
00020 #define PQXX_H_ERRORHANDLER
00021
00022 #include "pqxx/compiler-public.hxx"
00023 #include "pqxx/compiler-internal-pre.hxx"
00024
00025 #include <functional>
00026
00027
00028 namespace pqxx
00029 {
00030 class connection_base;
00031
00032 namespace internal
00033 {
00034 namespace gate
00035 {
00036 class errorhandler_connection_base;
00037 }
00038 }
00039
00045
00046
00057 class PQXX_LIBEXPORT errorhandler :
00058 public std::unary_function<const char[], bool>
00059 {
00060 public:
00061 explicit errorhandler(connection_base &);
00062 virtual ~errorhandler();
00063
00065
00069 virtual bool operator()(const char msg[]) PQXX_NOEXCEPT =0;
00070
00071 private:
00072 connection_base *m_home;
00073
00074 friend class internal::gate::errorhandler_connection_base;
00075 void unregister() PQXX_NOEXCEPT;
00076
00077
00078 errorhandler() PQXX_DELETED_OP;
00079 errorhandler(const errorhandler &) PQXX_DELETED_OP;
00080 errorhandler &operator=(const errorhandler &) PQXX_DELETED_OP;
00081 };
00082
00083
00085 class quiet_errorhandler : public errorhandler
00086 {
00087 public:
00088 quiet_errorhandler(connection_base &conn) : errorhandler(conn) {}
00089
00090 virtual bool operator()(const char[]) PQXX_NOEXCEPT PQXX_OVERRIDE
00091 { return false; }
00092 };
00093
00098 }
00099
00100 #include "pqxx/compiler-internal-post.hxx"
00101
00102 #endif