diff options
author | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2021-11-08 14:46:56 +0100 |
---|---|---|
committer | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2021-11-08 14:46:56 +0100 |
commit | 061de37889b0fa4bf8baae1f11693950297418c5 (patch) | |
tree | 3be3504190d8b1b82e82d84acb6c1d8041b1308f | |
parent | 316069f3c342b64598a40d9d7fd6e015ec0c91dd (diff) | |
download | libquotient-061de37889b0fa4bf8baae1f11693950297418c5.tar.gz libquotient-061de37889b0fa4bf8baae1f11693950297418c5.zip |
Q_DISABLE_MOVE/COPY_MOVE; QT_IGNORE_DEPRECATIONS
DISABLE_MOVE is no more; instead, the library provides Q_DISABLE_MOVE
(and also Q_DISABLE_COPY_MOVE while at it) for Qt pre-5.13 that don't
have it yet. Same for QT_IGNORE_DEPRECATIONS - it only arrived in 5.15
but all the building pieces existed prior so libQuotient has it
regardless of the Qt version used for building.
-rw-r--r-- | lib/connection.cpp | 2 | ||||
-rw-r--r-- | lib/events/event.h | 3 | ||||
-rw-r--r-- | lib/util.h | 28 |
3 files changed, 25 insertions, 8 deletions
diff --git a/lib/connection.cpp b/lib/connection.cpp index 2ad10694..75966731 100644 --- a/lib/connection.cpp +++ b/lib/connection.cpp @@ -77,8 +77,6 @@ public: explicit Private(std::unique_ptr<ConnectionData>&& connection) : data(move(connection)) {} - Q_DISABLE_COPY(Private) - DISABLE_MOVE(Private) Connection* q = nullptr; std::unique_ptr<ConnectionData> data; diff --git a/lib/events/event.h b/lib/events/event.h index f8f8311d..78853ced 100644 --- a/lib/events/event.h +++ b/lib/events/event.h @@ -76,8 +76,7 @@ public: private: EventTypeRegistry() = default; - Q_DISABLE_COPY(EventTypeRegistry) - DISABLE_MOVE(EventTypeRegistry) + Q_DISABLE_COPY_MOVE(EventTypeRegistry) static EventTypeRegistry& get() { @@ -12,10 +12,30 @@ #include <unordered_map> #include <optional> -// Along the lines of Q_DISABLE_COPY - the upstream version comes in Qt 5.13 -#define DISABLE_MOVE(_ClassName) \ - _ClassName(_ClassName&&) Q_DECL_EQ_DELETE; \ - _ClassName& operator=(_ClassName&&) Q_DECL_EQ_DELETE; +#ifndef Q_DISABLE_MOVE +// Q_DISABLE_MOVE was introduced in Q_VERSION_CHECK(5,13,0) +# define Q_DISABLE_MOVE(_ClassName) \ + _ClassName(_ClassName&&) Q_DECL_EQ_DELETE; \ + _ClassName& operator=(_ClassName&&) Q_DECL_EQ_DELETE; +#endif + +#ifndef Q_DISABLE_COPY_MOVE +#define Q_DISABLE_COPY_MOVE(Class) \ + Q_DISABLE_COPY(Class) \ + Q_DISABLE_MOVE(Class) +#endif + +#define DISABLE_MOVE(_ClassName) \ +static_assert(false, "Use Q_DISABLE_MOVE instead; Quotient enables it across all used versions of Qt"); + +#ifndef QT_IGNORE_DEPRECATIONS +// QT_IGNORE_DEPRECATIONS was introduced in Q_VERSION_CHECK(5,15,0) +# define QT_IGNORE_DEPRECATIONS(statement) \ + QT_WARNING_PUSH \ + QT_WARNING_DISABLE_DEPRECATED \ + statement \ + QT_WARNING_POP +#endif namespace Quotient { /// An equivalent of std::hash for QTypes to enable std::unordered_map<QType, ...> |