summaryrefslogtreecommitdiff
path: root/project2/common/scopeObject.cpp
blob: b51287ca8ec1b348e2c382b3145cafe87ef030d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include "pch.hpp"
#include "scopeObject.h"
#include "logger.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();
}