From 2c3558fdd04dd0242fae58a0a43a517617448a77 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Sat, 2 Dec 2017 17:24:19 +0200 Subject: [PATCH] Remove ScopeGuard --- code/BaseImporter.h | 36 ------------------------------------ 1 file changed, 36 deletions(-) diff --git a/code/BaseImporter.h b/code/BaseImporter.h index cee54c1ad..b424d2f83 100644 --- a/code/BaseImporter.h +++ b/code/BaseImporter.h @@ -65,42 +65,6 @@ class IOStream; #define AI_MAKE_MAGIC(string) ((uint32_t)((string[0] << 24) + \ (string[1] << 16) + (string[2] << 8) + string[3])) -// --------------------------------------------------------------------------- -template -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