| 1801 | |
| 1802 | template <typename T> |
| 1803 | class ExceptionTranslator : public IExceptionTranslator //!OCLINT destructor of virtual class |
| 1804 | { |
| 1805 | public: |
| 1806 | explicit ExceptionTranslator(String (*translateFunction)(T)) |
| 1807 | : m_translateFunction(translateFunction) {} |
| 1808 | |
| 1809 | bool translate(String& res) const override { |
| 1810 | #ifndef DOCTEST_CONFIG_NO_EXCEPTIONS |
| 1811 | try { |
| 1812 | throw; // lgtm [cpp/rethrow-no-exception] |
| 1813 | // cppcheck-suppress catchExceptionByValue |
| 1814 | } catch(const T& ex) { |
| 1815 | res = m_translateFunction(ex); //!OCLINT parameter reassignment |
| 1816 | return true; |
| 1817 | } catch(...) {} //!OCLINT - empty catch statement |
| 1818 | #endif // DOCTEST_CONFIG_NO_EXCEPTIONS |
| 1819 | static_cast<void>(res); // to silence -Wunused-parameter |
| 1820 | return false; |
| 1821 | } |
| 1822 | |
| 1823 | private: |
| 1824 | String (*m_translateFunction)(T); |
| 1825 | }; |
| 1826 | |
| 1827 | DOCTEST_INTERFACE void registerExceptionTranslatorImpl(const IExceptionTranslator* et); |
| 1828 |
nothing calls this directly
no outgoing calls
no test coverage detected