From ea29ea8095e1fe6e7c1766f87aea33650a1a485d Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Thu, 20 Dec 2018 18:30:37 +0100 Subject: compat/mutex: rename --- compat/copyable-mutex.cpp | 33 --------------------------------- compat/copyable-mutex.hpp | 23 ----------------------- compat/mutex.cpp | 33 +++++++++++++++++++++++++++++++++ compat/mutex.hpp | 23 +++++++++++++++++++++++ spline/spline.hpp | 2 +- 5 files changed, 57 insertions(+), 57 deletions(-) delete mode 100644 compat/copyable-mutex.cpp delete mode 100644 compat/copyable-mutex.hpp create mode 100644 compat/mutex.cpp create mode 100644 compat/mutex.hpp diff --git a/compat/copyable-mutex.cpp b/compat/copyable-mutex.cpp deleted file mode 100644 index 17b5aa34..00000000 --- a/compat/copyable-mutex.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#include "copyable-mutex.hpp" -#include - -mutex& mutex::operator=(const mutex& rhs) -{ - if (rhs->isRecursive() != inner.isRecursive()) - std::abort(); - - return *this; -} - -mutex::mutex(const mutex& datum) : mutex{datum.inner.isRecursive() ? Recursive : NonRecursive} -{ -} - -mutex::mutex(RecursionMode m) : inner{m} -{ -} - -QMutex* mutex::operator&() const -{ - return *this; -} - -mutex::operator QMutex*() const -{ - return &inner; -} - -QMutex* mutex::operator->() const -{ - return *this; -} diff --git a/compat/copyable-mutex.hpp b/compat/copyable-mutex.hpp deleted file mode 100644 index 37e6802b..00000000 --- a/compat/copyable-mutex.hpp +++ /dev/null @@ -1,23 +0,0 @@ -#pragma once - -#include - -#include "export.hpp" - -class OTR_COMPAT_EXPORT mutex -{ - mutable QMutex inner; - -public: - using RecursionMode = QMutex::RecursionMode; - static constexpr inline RecursionMode Recursive = RecursionMode::Recursive; - static constexpr inline RecursionMode NonRecursive = RecursionMode::NonRecursive; - - mutex& operator=(const mutex& datum); - mutex(const mutex& datum); - explicit mutex(RecursionMode m); - - QMutex* operator&() const; - operator QMutex*() const; - QMutex* operator->() const; -}; diff --git a/compat/mutex.cpp b/compat/mutex.cpp new file mode 100644 index 00000000..55789a22 --- /dev/null +++ b/compat/mutex.cpp @@ -0,0 +1,33 @@ +#include "mutex.hpp" +#include + +mutex& mutex::operator=(const mutex& rhs) +{ + if (rhs->isRecursive() != inner.isRecursive()) + std::abort(); + + return *this; +} + +mutex::mutex(const mutex& datum) : mutex{datum.inner.isRecursive() ? Recursive : NonRecursive} +{ +} + +mutex::mutex(RecursionMode m) : inner{m} +{ +} + +QMutex* mutex::operator&() const +{ + return *this; +} + +mutex::operator QMutex*() const +{ + return &inner; +} + +QMutex* mutex::operator->() const +{ + return *this; +} diff --git a/compat/mutex.hpp b/compat/mutex.hpp new file mode 100644 index 00000000..37e6802b --- /dev/null +++ b/compat/mutex.hpp @@ -0,0 +1,23 @@ +#pragma once + +#include + +#include "export.hpp" + +class OTR_COMPAT_EXPORT mutex +{ + mutable QMutex inner; + +public: + using RecursionMode = QMutex::RecursionMode; + static constexpr inline RecursionMode Recursive = RecursionMode::Recursive; + static constexpr inline RecursionMode NonRecursive = RecursionMode::NonRecursive; + + mutex& operator=(const mutex& datum); + mutex(const mutex& datum); + explicit mutex(RecursionMode m); + + QMutex* operator&() const; + operator QMutex*() const; + QMutex* operator->() const; +}; diff --git a/spline/spline.hpp b/spline/spline.hpp index acac2ad7..445378c3 100644 --- a/spline/spline.hpp +++ b/spline/spline.hpp @@ -11,7 +11,7 @@ #include "options/options.hpp" #include "axis-opts.hpp" #include "export.hpp" -#include "compat/copyable-mutex.hpp" +#include "compat/mutex.hpp" #include #include -- cgit v1.2.3