diff options
author | Michael Stahl <mstahl@redhat.com> | 2015-07-08 22:23:43 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2015-07-09 10:18:05 +0200 |
commit | e6a0ef5eeea7b353541d1c45b5b3c8c11344ab41 (patch) | |
tree | 767404e7e800e5f08987b7270a0f076f86953a1e /include/comphelper | |
parent | e8eb49995a9d8baba19b527fbccc7aebcdf259a6 (diff) |
comphelper: remove boost::bind from headers
Change-Id: I40c504d086c8ae1fd825acdafaada283ad9db8d0
Diffstat (limited to 'include/comphelper')
-rw-r--r-- | include/comphelper/flagguard.hxx | 27 | ||||
-rw-r--r-- | include/comphelper/scopeguard.hxx | 1 |
2 files changed, 14 insertions, 14 deletions
diff --git a/include/comphelper/flagguard.hxx b/include/comphelper/flagguard.hxx index 30106c16ee94..7ab88e4d98a1 100644 --- a/include/comphelper/flagguard.hxx +++ b/include/comphelper/flagguard.hxx @@ -26,15 +26,13 @@ namespace comphelper { - - //= FlagRestorationGuard class COMPHELPER_DLLPUBLIC FlagRestorationGuard : public ScopeGuard { public: FlagRestorationGuard( bool& i_flagRef, bool i_temporaryValue, exc_handling i_excHandling = IGNORE_EXCEPTIONS ) - :ScopeGuard( ::boost::bind( RestoreFlag, ::boost::ref( i_flagRef ), !!i_flagRef ), i_excHandling ) + : ScopeGuard(RestoreFlag(i_flagRef), i_excHandling) { i_flagRef = i_temporaryValue; } @@ -42,10 +40,19 @@ namespace comphelper ~FlagRestorationGuard(); private: - static void RestoreFlag( bool& i_flagRef, bool i_originalValue ) + // note: can't store the originalValue in a FlagRestorationGuard member, + // because it will be used from base class dtor + struct RestoreFlag { - i_flagRef = i_originalValue; - } + bool & rFlag; + bool originalValue; + RestoreFlag(bool & i_flagRef) + : rFlag(i_flagRef), originalValue(i_flagRef) {} + void operator()() + { + rFlag = originalValue; + } + }; }; @@ -55,18 +62,12 @@ namespace comphelper { public: explicit FlagGuard( bool& i_flagRef, exc_handling i_excHandling = IGNORE_EXCEPTIONS ) - :ScopeGuard( ::boost::bind( ResetFlag, ::boost::ref( i_flagRef ) ), i_excHandling ) + : ScopeGuard( [&i_flagRef] () { i_flagRef = false; }, i_excHandling) { i_flagRef = true; } ~FlagGuard(); - - private: - static void ResetFlag( bool& i_flagRef ) - { - i_flagRef = false; - } }; diff --git a/include/comphelper/scopeguard.hxx b/include/comphelper/scopeguard.hxx index 4f64d5bf08b6..f120cd7319c5 100644 --- a/include/comphelper/scopeguard.hxx +++ b/include/comphelper/scopeguard.hxx @@ -22,7 +22,6 @@ #include <comphelper/comphelperdllapi.h> #include <boost/function.hpp> -#include <boost/bind.hpp> namespace comphelper { |