diff options
author | Noel Grandin <noel@peralex.com> | 2016-02-24 09:29:54 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2016-02-24 11:48:39 +0200 |
commit | 2f9d53df89614955215a630beb0966f0c4a663c2 (patch) | |
tree | 31600e6d12542e4c04b2e12e16f5c54c708d7d0f | |
parent | cdf176c9749ed1a0c2faceeae0c73bf735c5b00b (diff) |
remove unused exc_handling enum
Change-Id: I5e2e084114c8b0eedd0f2cd8327d6c6d68742462
-rw-r--r-- | comphelper/source/misc/scopeguard.cxx | 33 | ||||
-rw-r--r-- | include/comphelper/flagguard.hxx | 8 | ||||
-rw-r--r-- | include/comphelper/scopeguard.hxx | 7 |
3 files changed, 17 insertions, 31 deletions
diff --git a/comphelper/source/misc/scopeguard.cxx b/comphelper/source/misc/scopeguard.cxx index f159b293ed3b..6eeb7c8e166c 100644 --- a/comphelper/source/misc/scopeguard.cxx +++ b/comphelper/source/misc/scopeguard.cxx @@ -26,27 +26,18 @@ namespace comphelper { ScopeGuard::~ScopeGuard() { - if (m_func) - { - if (m_excHandling == IGNORE_EXCEPTIONS) - { - try { - m_func(); - } - catch (css::uno::Exception & exc) { - (void) exc; // avoid warning about unused variable - OSL_FAIL( - OUStringToOString( "UNO exception occurred: " + - exc.Message, RTL_TEXTENCODING_UTF8 ).getStr() ); - } - catch (...) { - OSL_FAIL( "unknown exception occurred!" ); - } - } - else - { - m_func(); - } + if (!m_func) + return; + try { + m_func(); + } + catch (css::uno::Exception & exc) { + (void) exc; // avoid warning about unused variable + OSL_FAIL( OUStringToOString( "UNO exception occurred: " + exc.Message, + RTL_TEXTENCODING_UTF8 ).getStr() ); + } + catch (...) { + OSL_FAIL( "unknown exception occurred!" ); } } diff --git a/include/comphelper/flagguard.hxx b/include/comphelper/flagguard.hxx index 7ab88e4d98a1..96e721e7aa79 100644 --- a/include/comphelper/flagguard.hxx +++ b/include/comphelper/flagguard.hxx @@ -31,8 +31,8 @@ namespace comphelper class COMPHELPER_DLLPUBLIC FlagRestorationGuard : public ScopeGuard { public: - FlagRestorationGuard( bool& i_flagRef, bool i_temporaryValue, exc_handling i_excHandling = IGNORE_EXCEPTIONS ) - : ScopeGuard(RestoreFlag(i_flagRef), i_excHandling) + FlagRestorationGuard( bool& i_flagRef, bool i_temporaryValue ) + : ScopeGuard(RestoreFlag(i_flagRef)) { i_flagRef = i_temporaryValue; } @@ -61,8 +61,8 @@ namespace comphelper class COMPHELPER_DLLPUBLIC FlagGuard : public ScopeGuard { public: - explicit FlagGuard( bool& i_flagRef, exc_handling i_excHandling = IGNORE_EXCEPTIONS ) - : ScopeGuard( [&i_flagRef] () { i_flagRef = false; }, i_excHandling) + explicit FlagGuard( bool& i_flagRef ) + : ScopeGuard( [&i_flagRef] () { i_flagRef = false; } ) { i_flagRef = true; } diff --git a/include/comphelper/scopeguard.hxx b/include/comphelper/scopeguard.hxx index 629950ccc151..47b62b5f234e 100644 --- a/include/comphelper/scopeguard.hxx +++ b/include/comphelper/scopeguard.hxx @@ -31,16 +31,12 @@ namespace comphelper { class COMPHELPER_DLLPUBLIC ScopeGuard { public: - enum exc_handling { IGNORE_EXCEPTIONS, ALLOW_EXCEPTIONS }; - /** @param func function object to be executed in dtor @param excHandling switches whether thrown exceptions in dtor will be silently ignored (but OSL_ asserted) */ template <typename func_type> - explicit ScopeGuard( func_type const & func, - exc_handling excHandling = IGNORE_EXCEPTIONS ) - : m_func( func ), m_excHandling( excHandling ) {} + explicit ScopeGuard( func_type const & func ) : m_func( func ) {} ~ScopeGuard(); @@ -55,7 +51,6 @@ private: ScopeGuard& operator=(const ScopeGuard&) = delete; ::std::function<void ()> m_func; - exc_handling const m_excHandling; }; } // namespace comphelper |