From 9040b187a1c4fa380f8a12207b9dd6d04b3a10ac Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 12 Aug 2016 18:00:49 +0200 Subject: all: rename modules s#^opentrack-##. and opentrack -> api Adjust usages. --- compat/qcopyable-mutex.hpp | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 compat/qcopyable-mutex.hpp (limited to 'compat/qcopyable-mutex.hpp') diff --git a/compat/qcopyable-mutex.hpp b/compat/qcopyable-mutex.hpp new file mode 100644 index 00000000..57b0030d --- /dev/null +++ b/compat/qcopyable-mutex.hpp @@ -0,0 +1,37 @@ +#pragma once + +#include + +class MyMutex { +private: + QMutex inner; + +public: + QMutex* operator->() { return &inner; } + QMutex* operator->() const { return &const_cast(this)->inner; } + + MyMutex operator=(const MyMutex& datum) + { + auto mode = + datum->isRecursive() + ? QMutex::Recursive + : QMutex::NonRecursive; + + return MyMutex(mode); + } + + MyMutex(const MyMutex& datum) + { + *this = datum; + } + + MyMutex(QMutex::RecursionMode mode = QMutex::NonRecursive) : + inner(mode) + { + } + + QMutex* operator&() const + { + return const_cast(&inner); + } +}; -- cgit v1.2.3