summaryrefslogtreecommitdiff
path: root/comphelper/inc/comphelper
diff options
context:
space:
mode:
authorFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-09-17 08:38:22 +0200
committerFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-09-17 08:38:22 +0200
commitbc8d25b6be559c45155ef00d4f307f4c4f04c4b8 (patch)
tree454220408aa77e5bfc17b75602f244d288cbea21 /comphelper/inc/comphelper
parent699a953e3364060906a2685b1c1a7b434d4abc78 (diff)
dba34a: added FlagGuard, a specialization of ScopeGuard
Diffstat (limited to 'comphelper/inc/comphelper')
-rw-r--r--comphelper/inc/comphelper/scopeguard.hxx16
1 files changed, 16 insertions, 0 deletions
diff --git a/comphelper/inc/comphelper/scopeguard.hxx b/comphelper/inc/comphelper/scopeguard.hxx
index 4841a564ae61..1fdd179404a2 100644
--- a/comphelper/inc/comphelper/scopeguard.hxx
+++ b/comphelper/inc/comphelper/scopeguard.hxx
@@ -33,6 +33,7 @@
#endif
#include "boost/function.hpp"
#include "boost/noncopyable.hpp"
+#include "boost/bind.hpp"
namespace comphelper {
@@ -66,6 +67,21 @@ private:
exc_handling const m_excHandling;
};
+class COMPHELPER_DLLPUBLIC FlagGuard : ScopeGuard
+{
+public:
+ explicit FlagGuard( bool& i_flagRef, exc_handling i_excHandling = IGNORE_EXCEPTIONS )
+ :ScopeGuard( ::boost::bind( ResetFlag, ::boost::ref( i_flagRef ) ), i_excHandling )
+ {
+ }
+
+private:
+ static void ResetFlag( bool& i_flagRef )
+ {
+ i_flagRef = false;
+ }
+};
+
} // namespace comphelper
#endif // ! defined(INCLUDED_COMPHELPER_SCOPEGUARD_HXX)