From 2291d85288b41fdde6586858c9c5de58e9671379 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Fri, 28 Aug 2015 02:18:29 +0100 Subject: Add ScopeExit (was ScopeObject) --- project2/lib/Jamfile.jam | 10 ---------- project2/lib/scopeObject.cpp | 22 ---------------------- project2/lib/scopeObject.h | 20 -------------------- 3 files changed, 52 deletions(-) delete mode 100644 project2/lib/Jamfile.jam delete mode 100644 project2/lib/scopeObject.cpp delete mode 100644 project2/lib/scopeObject.h 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 - : - ../../libmisc - : : - ../../libmisc - . - ; 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 - -class ScopeObject { - public: - typedef boost::function 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 - -- cgit v1.2.3