Kaydet (Commit) e6a0ef5e authored tarafından Michael Stahl's avatar Michael Stahl

comphelper: remove boost::bind from headers

Change-Id: I40c504d086c8ae1fd825acdafaada283ad9db8d0
üst e8eb4999
...@@ -29,9 +29,11 @@ ...@@ -29,9 +29,11 @@
#include <tools/diagnose_ex.h> #include <tools/diagnose_ex.h>
#include <osl/conditn.hxx> #include <osl/conditn.hxx>
#include <boost/bind.hpp>
#include <boost/function.hpp>
#include <stack> #include <stack>
#include <queue> #include <queue>
#include <boost/function.hpp>
namespace framework namespace framework
{ {
......
...@@ -26,15 +26,13 @@ ...@@ -26,15 +26,13 @@
namespace comphelper namespace comphelper
{ {
//= FlagRestorationGuard //= FlagRestorationGuard
class COMPHELPER_DLLPUBLIC FlagRestorationGuard : public ScopeGuard class COMPHELPER_DLLPUBLIC FlagRestorationGuard : public ScopeGuard
{ {
public: public:
FlagRestorationGuard( bool& i_flagRef, bool i_temporaryValue, exc_handling i_excHandling = IGNORE_EXCEPTIONS ) 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; i_flagRef = i_temporaryValue;
} }
...@@ -42,10 +40,19 @@ namespace comphelper ...@@ -42,10 +40,19 @@ namespace comphelper
~FlagRestorationGuard(); ~FlagRestorationGuard();
private: 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 ...@@ -55,18 +62,12 @@ namespace comphelper
{ {
public: public:
explicit FlagGuard( bool& i_flagRef, exc_handling i_excHandling = IGNORE_EXCEPTIONS ) 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; i_flagRef = true;
} }
~FlagGuard(); ~FlagGuard();
private:
static void ResetFlag( bool& i_flagRef )
{
i_flagRef = false;
}
}; };
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include <comphelper/comphelperdllapi.h> #include <comphelper/comphelperdllapi.h>
#include <boost/function.hpp> #include <boost/function.hpp>
#include <boost/bind.hpp>
namespace comphelper { 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