X-Git-Url: http://git.tdb.fi/?p=libs%2Ftest.git;a=blobdiff_plain;f=source%2Fexceptioncheck.h;h=b7f9d3a6636d8c4f67320febddbb414e88350cba;hp=82115024a87b796704c6083d527167698f7eab94;hb=9cb2cd7e532e8edfc27a113d5efa735bcaa85d3a;hpb=7867d19e116a19c5f7ade801e8c0a0eebb7196f4 diff --git a/source/exceptioncheck.h b/source/exceptioncheck.h index 8211502..b7f9d3a 100644 --- a/source/exceptioncheck.h +++ b/source/exceptioncheck.h @@ -1,6 +1,8 @@ #ifndef MSP_TEST_EXCEPTIONCHECK_H_ #define MSP_TEST_EXCEPTIONCHECK_H_ +#include + namespace Msp { namespace Test { @@ -8,9 +10,11 @@ class ExceptionCheck { protected: ExceptionCheck() { } - public: + virtual ~ExceptionCheck() { } + virtual bool check(const std::exception &) const = 0; + virtual const std::type_info &get_type_info() const = 0; }; template @@ -19,6 +23,9 @@ class ExceptionTypeCheck: public ExceptionCheck public: virtual bool check(const std::exception &e) const { return dynamic_cast(&e); } + + virtual const std::type_info &get_type_info() const + { return typeid(T); } }; } // namespace Test