diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2015-08-28 02:18:29 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2015-08-28 02:18:29 +0100 |
commit | 2291d85288b41fdde6586858c9c5de58e9671379 (patch) | |
tree | b2ca8c23905f95c185a1dff7aa10e2fca1fb709f | |
parent | Add map utilities (diff) | |
download | project2-2291d85288b41fdde6586858c9c5de58e9671379.tar.bz2 project2-2291d85288b41fdde6586858c9c5de58e9671379.tar.xz project2-2291d85288b41fdde6586858c9c5de58e9671379.zip |
Add ScopeExit (was ScopeObject)
-rw-r--r-- | project2/lib/Jamfile.jam | 10 | ||||
-rw-r--r-- | project2/lib/scopeObject.cpp | 22 | ||||
-rw-r--r-- | project2/lib/scopeObject.h | 20 |
3 files changed, 0 insertions, 52 deletions
diff --git a/project2/lib/Jamfile.jam b/project2/lib/Jamfile.jam deleted file mode 100644 index 0f5d331..0000000 --- a/project2/lib/Jamfile.jam +++ /dev/null @@ -1,10 +0,0 @@ -lib p2lib : - [ glob-tree *.cpp ] - ../../libmisc/buffer.cpp - ../../libmisc/misc.cpp - : - <include>../../libmisc - : : - <include>../../libmisc - <include>. - ; diff --git a/project2/lib/scopeObject.cpp b/project2/lib/scopeObject.cpp deleted file mode 100644 index e2e42da..0000000 --- a/project2/lib/scopeObject.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include "scopeObject.h" - -ScopeObject::ScopeObject(const Event & onexitpre, const Event & onsuccess, const Event & onfailure, const Event & onexitpost) : - onExitPre(onexitpre), - onSuccess(onsuccess), - onFailure(onfailure), - onExitPost(onexitpost) -{ -} - -ScopeObject::~ScopeObject() -{ - if (onExitPre) onExitPre(); - if (std::uncaught_exception()) { - if (onFailure) onFailure(); - } - else { - if (onSuccess) onSuccess(); - } - if (onExitPost) onExitPost(); -} - diff --git a/project2/lib/scopeObject.h b/project2/lib/scopeObject.h deleted file mode 100644 index 6fc323d..0000000 --- a/project2/lib/scopeObject.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef SCOPE_OBJECT_H -#define SCOPE_OBJECT_H - -#include <boost/function.hpp> - -class ScopeObject { - public: - typedef boost::function<void()> Event; - ScopeObject(const Event &, const Event & = Event(), const Event & = Event(), const Event & = Event()); - ~ScopeObject(); - - private: - const Event onExitPre; - const Event onSuccess; - const Event onFailure; - const Event onExitPost; -}; - -#endif - |