Kaydet (Commit) 2f9d53df authored tarafından Noel Grandin's avatar Noel Grandin

remove unused exc_handling enum

Change-Id: I5e2e084114c8b0eedd0f2cd8327d6c6d68742462
üst cdf176c9
......@@ -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!" );
}
}
......
......@@ -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;
}
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment