mirror of
https://github.com/catchorg/Catch2.git
synced 2025-05-25 14:09:26 +00:00
parent
503d5d0c8e
commit
f3d1f08c3b
62 changed files with 527 additions and 527 deletions
|
@ -10,19 +10,19 @@
|
|||
|
||||
#include <string>
|
||||
#include "catch_interfaces_registry_hub.h"
|
||||
|
||||
|
||||
namespace Catch {
|
||||
|
||||
|
||||
typedef std::string(*exceptionTranslateFunction)();
|
||||
|
||||
struct IExceptionTranslator {
|
||||
virtual ~IExceptionTranslator();
|
||||
virtual std::string translate() const = 0;
|
||||
};
|
||||
|
||||
|
||||
struct IExceptionTranslatorRegistry {
|
||||
virtual ~IExceptionTranslatorRegistry();
|
||||
|
||||
|
||||
virtual std::string translateActiveException() const = 0;
|
||||
};
|
||||
|
||||
|
@ -30,11 +30,11 @@ namespace Catch {
|
|||
template<typename T>
|
||||
class ExceptionTranslator : public IExceptionTranslator {
|
||||
public:
|
||||
|
||||
|
||||
ExceptionTranslator( std::string(*translateFunction)( T& ) )
|
||||
: m_translateFunction( translateFunction )
|
||||
{}
|
||||
|
||||
|
||||
virtual std::string translate() const {
|
||||
try {
|
||||
throw;
|
||||
|
@ -43,11 +43,11 @@ namespace Catch {
|
|||
return m_translateFunction( ex );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
std::string(*m_translateFunction)( T& );
|
||||
};
|
||||
|
||||
|
||||
public:
|
||||
template<typename T>
|
||||
ExceptionTranslatorRegistrar( std::string(*translateFunction)( T& ) ) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue