Moved ObjectStatusLocker template class to Base/Tools.h

This commit is contained in:
Eivind Kvedalen
2017-11-29 23:04:37 +01:00
committed by wmayer
parent b3db1deecb
commit 8b4adfa513
5 changed files with 20 additions and 17 deletions

View File

@@ -146,6 +146,20 @@ private:
Private* d;
};
template<typename Status, class Object>
class BaseExport ObjectStatusLocker
{
public:
ObjectStatusLocker(Status s, Object* o, bool st = true) : status(s), obj(o), state(st)
{ obj->setStatus(status, state); }
~ObjectStatusLocker()
{ obj->setStatus(status, !state); }
private:
Status status;
Object* obj;
bool state;
};
// ----------------------------------------------------------------------------
struct BaseExport Tools