diff options
Diffstat (limited to 'vendor/bandit/bandit/adapters')
-rw-r--r-- | vendor/bandit/bandit/adapters/adapter.h | 12 | ||||
-rw-r--r-- | vendor/bandit/bandit/adapters/adapters.h | 16 | ||||
-rw-r--r-- | vendor/bandit/bandit/adapters/snowhouse.h | 22 |
3 files changed, 50 insertions, 0 deletions
diff --git a/vendor/bandit/bandit/adapters/adapter.h b/vendor/bandit/bandit/adapters/adapter.h new file mode 100644 index 00000000..809212a1 --- /dev/null +++ b/vendor/bandit/bandit/adapters/adapter.h @@ -0,0 +1,12 @@ +#ifndef BANDIT_ADAPTER_H +#define BANDIT_ADAPTER_H + +namespace bandit { namespace adapters { + + struct assertion_adapter + { + virtual void adapt_exceptions(detail::voidfunc_t) = 0; + }; +}} + +#endif diff --git a/vendor/bandit/bandit/adapters/adapters.h b/vendor/bandit/bandit/adapters/adapters.h new file mode 100644 index 00000000..fbfddaea --- /dev/null +++ b/vendor/bandit/bandit/adapters/adapters.h @@ -0,0 +1,16 @@ +#ifndef BANDIT_ADAPTERS_H +#define BANDIT_ADAPTERS_H + +#include <bandit/adapters/adapter.h> +#include <bandit/adapters/snowhouse.h> + +namespace bandit { namespace detail { + + inline bandit::adapters::assertion_adapter& registered_adapter() + { + static bandit::adapters::snowhouse_adapter adapter; + return adapter; + } +}} + +#endif diff --git a/vendor/bandit/bandit/adapters/snowhouse.h b/vendor/bandit/bandit/adapters/snowhouse.h new file mode 100644 index 00000000..f0776662 --- /dev/null +++ b/vendor/bandit/bandit/adapters/snowhouse.h @@ -0,0 +1,22 @@ +#ifndef BANDIT_ADAPTERS_SNOWHOUSE_H +#define BANDIT_ADAPTERS_SNOWHOUSE_H + +namespace bandit { namespace adapters { + + struct snowhouse_adapter : public assertion_adapter + { + void adapt_exceptions(detail::voidfunc_t func) + { + try + { + func(); + } + catch(const snowhouse::AssertionException& ex) + { + throw bandit::detail::assertion_exception(ex.GetMessage(), ex.GetFilename(), ex.GetLineNumber()); + } + } + }; + +}} +#endif |