Introduce new macro Q_DISABLE_ASSIGN_MOVE.

This commit is contained in:
Roman Telezhynskyi 2022-10-08 15:22:17 +03:00
parent 05d064af1e
commit 4a89a0892f
4 changed files with 36 additions and 7 deletions

View File

@ -84,10 +84,16 @@
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#define Q_DISABLE_MOVE(Class) \
Class(Class &&) = delete; \
Class(Class &&) = delete; \
Class &operator=(Class &&) = delete;
#define Q_DISABLE_COPY_MOVE(Class) \
Q_DISABLE_COPY(Class) \
Q_DISABLE_COPY(Class) \
Q_DISABLE_MOVE(Class)
#endif
#ifndef Q_DISABLE_ASSIGN_MOVE
#define Q_DISABLE_ASSIGN_MOVE(Class) \
Q_DISABLE_ASSIGN(Class) \
Q_DISABLE_MOVE(Class)
#endif

View File

@ -84,10 +84,16 @@
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#define Q_DISABLE_MOVE(Class) \
Class(Class &&) = delete; \
Class(Class &&) = delete; \
Class &operator=(Class &&) = delete;
#define Q_DISABLE_COPY_MOVE(Class) \
Q_DISABLE_COPY(Class) \
Q_DISABLE_COPY(Class) \
Q_DISABLE_MOVE(Class)
#endif
#ifndef Q_DISABLE_ASSIGN_MOVE
#define Q_DISABLE_ASSIGN_MOVE(Class) \
Q_DISABLE_ASSIGN(Class) \
Q_DISABLE_MOVE(Class)
#endif

View File

@ -43,7 +43,7 @@ void qAsConst(const T &&) Q_DECL_EQ_DELETE;
#ifndef Q_DISABLE_ASSIGN
#define Q_DISABLE_ASSIGN(Class) \
Class &operator=(const Class &) Q_DECL_EQ_DELETE;
Class &operator=(const Class &) = delete;
#endif
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
@ -55,6 +55,12 @@ void qAsConst(const T &&) Q_DECL_EQ_DELETE;
Q_DISABLE_MOVE(Class)
#endif
#ifndef Q_DISABLE_ASSIGN_MOVE
#define Q_DISABLE_ASSIGN_MOVE(Class) \
Q_DISABLE_ASSIGN(Class) \
Q_DISABLE_MOVE(Class)
#endif
#define SUFFIX_APPEND(x, y) x ## y // NOLINT(cppcoreguidelines-macro-usage)
#define HOURS_INT(x) ((x) * 3600000) // NOLINT(cppcoreguidelines-macro-usage)

View File

@ -29,12 +29,23 @@
# define VPROPERTYEXPLORERSHARED_EXPORT Q_DECL_IMPORT
#endif
#ifndef Q_DISABLE_ASSIGN
#define Q_DISABLE_ASSIGN(Class) \
Class &operator=(const Class &) = delete;
#endif
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#define Q_DISABLE_MOVE(Class) \
Class(Class &&) = delete; \
Class(Class &&) = delete; \
Class &operator=(Class &&) = delete;
#define Q_DISABLE_COPY_MOVE(Class) \
Q_DISABLE_COPY(Class) \
Q_DISABLE_COPY(Class) \
Q_DISABLE_MOVE(Class)
#endif
#ifndef Q_DISABLE_ASSIGN_MOVE
#define Q_DISABLE_ASSIGN_MOVE(Class) \
Q_DISABLE_ASSIGN(Class) \
Q_DISABLE_MOVE(Class)
#endif