summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2015-08-28 02:18:29 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2015-08-28 02:18:29 +0100
commit2291d85288b41fdde6586858c9c5de58e9671379 (patch)
treeb2ca8c23905f95c185a1dff7aa10e2fca1fb709f
parentAdd map utilities (diff)
downloadproject2-2291d85288b41fdde6586858c9c5de58e9671379.tar.bz2
project2-2291d85288b41fdde6586858c9c5de58e9671379.tar.xz
project2-2291d85288b41fdde6586858c9c5de58e9671379.zip
Add ScopeExit (was ScopeObject)
-rw-r--r--project2/lib/Jamfile.jam10
-rw-r--r--project2/lib/scopeObject.cpp22
-rw-r--r--project2/lib/scopeObject.h20
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
-