Remove ScopeGuard

pull/1607/head
Turo Lamminen 2017-12-02 17:24:19 +02:00
parent b60d84a8a2
commit 2c3558fdd0
1 changed files with 0 additions and 36 deletions

View File

@ -65,42 +65,6 @@ class IOStream;
#define AI_MAKE_MAGIC(string) ((uint32_t)((string[0] << 24) + \ #define AI_MAKE_MAGIC(string) ((uint32_t)((string[0] << 24) + \
(string[1] << 16) + (string[2] << 8) + string[3])) (string[1] << 16) + (string[2] << 8) + string[3]))
// ---------------------------------------------------------------------------
template <typename T>
struct ScopeGuard
{
explicit ScopeGuard(T* obj) : obj(obj), mdismiss() {}
~ScopeGuard () throw() {
if (!mdismiss) {
delete obj;
}
obj = NULL;
}
T* dismiss() {
mdismiss=true;
return obj;
}
operator T*() {
return obj;
}
T* operator -> () {
return obj;
}
private:
// no copying allowed.
ScopeGuard();
ScopeGuard( const ScopeGuard & );
ScopeGuard &operator = ( const ScopeGuard & );
T* obj;
bool mdismiss;
};
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/** FOR IMPORTER PLUGINS ONLY: The BaseImporter defines a common interface /** FOR IMPORTER PLUGINS ONLY: The BaseImporter defines a common interface