From b15fe980671e028d0849e11878e0edf9a88669a5 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 24 Oct 2017 11:30:35 +0200 Subject: compat/mutex: rename --- compat/copyable-mutex.cpp | 36 ++++++++++++++++++++++++++++++++++++ compat/copyable-mutex.hpp | 27 +++++++++++++++++++++++++++ compat/qcopyable-mutex.cpp | 36 ------------------------------------ compat/qcopyable-mutex.hpp | 27 --------------------------- 4 files changed, 63 insertions(+), 63 deletions(-) create mode 100644 compat/copyable-mutex.cpp create mode 100644 compat/copyable-mutex.hpp delete mode 100644 compat/qcopyable-mutex.cpp delete mode 100644 compat/qcopyable-mutex.hpp (limited to 'compat') diff --git a/compat/copyable-mutex.cpp b/compat/copyable-mutex.cpp new file mode 100644 index 00000000..7c112c5e --- /dev/null +++ b/compat/copyable-mutex.cpp @@ -0,0 +1,36 @@ +#include "copyable-mutex.hpp" + +mutex& mutex::operator=(const mutex& datum) +{ + inner = nullptr; + inner = std::make_unique(datum->isRecursive() + ? QMutex::Recursive + : QMutex::NonRecursive); + return *this; +} + +mutex::mutex(const mutex& datum) +{ + *this = datum; +} + +mutex::mutex(mutex::mode m) : + inner(std::make_unique(static_cast(int(m)))) +{ +} + +QMutex* mutex::operator&() const +{ + return *this; +} + +QMutex* mutex::operator->() const +{ + return *this; +} + +mutex::operator QMutex*() const +{ + return const_cast(inner.get()); +} + diff --git a/compat/copyable-mutex.hpp b/compat/copyable-mutex.hpp new file mode 100644 index 00000000..af82876d --- /dev/null +++ b/compat/copyable-mutex.hpp @@ -0,0 +1,27 @@ +#pragma once + +#include + +#include + +#include "export.hpp" + +class OTR_COMPAT_EXPORT mutex +{ + std::unique_ptr inner; + +public: + enum mode + { + recursive = QMutex::Recursive, + normal = QMutex::NonRecursive, + }; + + mutex& operator=(const mutex& datum); + mutex(const mutex& datum); + mutex(mode m = normal); + + QMutex* operator&() const; + operator QMutex*() const; + QMutex* operator->() const; +}; diff --git a/compat/qcopyable-mutex.cpp b/compat/qcopyable-mutex.cpp deleted file mode 100644 index 71720f17..00000000 --- a/compat/qcopyable-mutex.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include "qcopyable-mutex.hpp" - -mutex& mutex::operator=(const mutex& datum) -{ - inner = nullptr; - inner = std::make_unique(datum->isRecursive() - ? QMutex::Recursive - : QMutex::NonRecursive); - return *this; -} - -mutex::mutex(const mutex& datum) -{ - *this = datum; -} - -mutex::mutex(mutex::mode m) : - inner(std::make_unique(static_cast(int(m)))) -{ -} - -QMutex* mutex::operator&() const -{ - return *this; -} - -QMutex* mutex::operator->() const -{ - return *this; -} - -mutex::operator QMutex*() const -{ - return const_cast(inner.get()); -} - diff --git a/compat/qcopyable-mutex.hpp b/compat/qcopyable-mutex.hpp deleted file mode 100644 index af82876d..00000000 --- a/compat/qcopyable-mutex.hpp +++ /dev/null @@ -1,27 +0,0 @@ -#pragma once - -#include - -#include - -#include "export.hpp" - -class OTR_COMPAT_EXPORT mutex -{ - std::unique_ptr inner; - -public: - enum mode - { - recursive = QMutex::Recursive, - normal = QMutex::NonRecursive, - }; - - mutex& operator=(const mutex& datum); - mutex(const mutex& datum); - mutex(mode m = normal); - - QMutex* operator&() const; - operator QMutex*() const; - QMutex* operator->() const; -}; -- cgit v1.2.3