tahoma2d/toonz/sources/include/toonzqt/trepetitionguard.h

31 lines
540 B
C
Raw Normal View History

2016-05-17 03:04:11 +12:00
#pragma once
2016-03-19 06:57:51 +13:00
#ifndef TREPETITION_GUARD
#define TREPETITION_GUARD
#include "tcommon.h"
#undef DVAPI
#undef DVVAR
#ifdef TOONZQT_EXPORTS
#define DVAPI DV_EXPORT_API
#define DVVAR DV_EXPORT_VAR
#else
#define DVAPI DV_IMPORT_API
#define DVVAR DV_IMPORT_VAR
#endif
2016-06-15 18:43:10 +12:00
class DVAPI TRepetitionGuard {
static int m_counter;
bool m_counterCheck;
2016-03-19 06:57:51 +13:00
public:
2016-06-15 18:43:10 +12:00
TRepetitionGuard() : m_counterCheck(m_counter == 0) { ++m_counter; }
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
~TRepetitionGuard() { --m_counter; }
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
bool hasLock() { return m_counterCheck; }
2016-03-19 06:57:51 +13:00
};
2016-06-15 18:43:10 +12:00
#endif // TREPETITION_GUARD