Refactoring.

Code style.
This commit is contained in:
Roman Telezhynskyi 2023-10-04 16:58:56 +03:00
parent ecf93f8d31
commit 5f60af68ca

View file

@ -34,90 +34,90 @@ constexpr qreal PrintDPI = 96.0;
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0) #if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
// this adds const to non-const objects (like std::as_const) // this adds const to non-const objects (like std::as_const)
template <typename T> template <typename T> Q_DECL_CONSTEXPR typename std::add_const<T>::type &qAsConst(T &t) noexcept
Q_DECL_CONSTEXPR typename std::add_const<T>::type &qAsConst(T &t) noexcept { return t; } {
return t;
}
// prevent rvalue arguments: // prevent rvalue arguments:
template <typename T> template <typename T> void qAsConst(const T &&) Q_DECL_EQ_DELETE;
void qAsConst(const T &&) Q_DECL_EQ_DELETE;
#endif #endif
#ifndef Q_DISABLE_ASSIGN #ifndef Q_DISABLE_ASSIGN
#define Q_DISABLE_ASSIGN(Class) \ #define Q_DISABLE_ASSIGN(Class) Class &operator=(const Class &) = delete;
Class &operator=(const Class &) = delete;
#endif #endif
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0) #if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#define Q_DISABLE_COPY_MOVE(Class) \ #define Q_DISABLE_COPY_MOVE(Class) \
Q_DISABLE_COPY(Class) \ Q_DISABLE_COPY(Class) \
Class(Class &&) = delete; \ Class(Class &&) = delete; \
Class &operator=(Class &&) = delete; Class &operator=(Class &&) = delete;
#endif #endif
#ifndef Q_DISABLE_ASSIGN_MOVE #ifndef Q_DISABLE_ASSIGN_MOVE
#define Q_DISABLE_ASSIGN_MOVE(Class) \ #define Q_DISABLE_ASSIGN_MOVE(Class) \
Q_DISABLE_ASSIGN(Class) \ Q_DISABLE_ASSIGN(Class) \
Class(Class &&) = delete; \ Class(Class &&) = delete; \
Class &operator=(Class &&) = delete; Class &operator=(Class &&) = delete;
#endif #endif
#define SUFFIX_APPEND(x, y) x ## y // NOLINT(cppcoreguidelines-macro-usage) #define SUFFIX_APPEND(x, y) x##y // NOLINT(cppcoreguidelines-macro-usage)
#define HOURS_INT(x) ((x) * 3600000) // NOLINT(cppcoreguidelines-macro-usage) #define HOURS_INT(x) ((x)*3600000) // NOLINT(cppcoreguidelines-macro-usage)
#define MINUTES_INT(x) ((x) * 60000) // NOLINT(cppcoreguidelines-macro-usage) #define MINUTES_INT(x) ((x)*60000) // NOLINT(cppcoreguidelines-macro-usage)
#define SECONDS_INT(x) ((x) * 1000) // NOLINT(cppcoreguidelines-macro-usage) #define SECONDS_INT(x) ((x)*1000) // NOLINT(cppcoreguidelines-macro-usage)
#define MSECONDS_INT(x) (x) // NOLINT(cppcoreguidelines-macro-usage) #define MSECONDS_INT(x) (x) // NOLINT(cppcoreguidelines-macro-usage)
#define MICSECONDS_INT(x) (x) // NOLINT(cppcoreguidelines-macro-usage) #define MICSECONDS_INT(x) (x) // NOLINT(cppcoreguidelines-macro-usage)
#define NANOSECONDS_INT(x) (x) // NOLINT(cppcoreguidelines-macro-usage) #define NANOSECONDS_INT(x) (x) // NOLINT(cppcoreguidelines-macro-usage)
#if (defined(Q_CC_GNU) && Q_CC_GNU < 409) && !defined(Q_CC_CLANG) #if (defined(Q_CC_GNU) && Q_CC_GNU < 409) && !defined(Q_CC_CLANG)
#define HOURS(x) HOURS_INT(x) // NOLINT(cppcoreguidelines-macro-usage) #define HOURS(x) HOURS_INT(x) // NOLINT(cppcoreguidelines-macro-usage)
#define MINUTES(x) MINUTES_INT(x) // NOLINT(cppcoreguidelines-macro-usage) #define MINUTES(x) MINUTES_INT(x) // NOLINT(cppcoreguidelines-macro-usage)
#define SECONDS(x) SECONDS_INT(x) // NOLINT(cppcoreguidelines-macro-usage) #define SECONDS(x) SECONDS_INT(x) // NOLINT(cppcoreguidelines-macro-usage)
#define MSECONDS(x) MSECONDS_INT(x) // NOLINT(cppcoreguidelines-macro-usage) #define MSECONDS(x) MSECONDS_INT(x) // NOLINT(cppcoreguidelines-macro-usage)
#define MICSECONDS(x) MICSECONDS_INT(x) // NOLINT(cppcoreguidelines-macro-usage) #define MICSECONDS(x) MICSECONDS_INT(x) // NOLINT(cppcoreguidelines-macro-usage)
#define NANOSECONDS(x) NANOSECONDS_INT(x) // NOLINT(cppcoreguidelines-macro-usage) #define NANOSECONDS(x) NANOSECONDS_INT(x) // NOLINT(cppcoreguidelines-macro-usage)
#else #else
#if __cplusplus >= 201402L #if __cplusplus >= 201402L
#define HOURS(x) SUFFIX_APPEND(x, h) // NOLINT(cppcoreguidelines-macro-usage) #define HOURS(x) SUFFIX_APPEND(x, h) // NOLINT(cppcoreguidelines-macro-usage)
#define MINUTES(x) SUFFIX_APPEND(x, min) // NOLINT(cppcoreguidelines-macro-usage) #define MINUTES(x) SUFFIX_APPEND(x, min) // NOLINT(cppcoreguidelines-macro-usage)
#define SECONDS(x) SUFFIX_APPEND(x, s) // NOLINT(cppcoreguidelines-macro-usage) #define SECONDS(x) SUFFIX_APPEND(x, s) // NOLINT(cppcoreguidelines-macro-usage)
#define MSECONDS(x) SUFFIX_APPEND(x, ms) // NOLINT(cppcoreguidelines-macro-usage) #define MSECONDS(x) SUFFIX_APPEND(x, ms) // NOLINT(cppcoreguidelines-macro-usage)
#define MICSECONDS(x) SUFFIX_APPEND(x, us) // NOLINT(cppcoreguidelines-macro-usage) #define MICSECONDS(x) SUFFIX_APPEND(x, us) // NOLINT(cppcoreguidelines-macro-usage)
#define NANOSECONDS(x) SUFFIX_APPEND(x, ns) // NOLINT(cppcoreguidelines-macro-usage) #define NANOSECONDS(x) SUFFIX_APPEND(x, ns) // NOLINT(cppcoreguidelines-macro-usage)
#else #else
#define HOURS(x) SUFFIX_APPEND(x, _h) // NOLINT(cppcoreguidelines-macro-usage) #define HOURS(x) SUFFIX_APPEND(x, _h) // NOLINT(cppcoreguidelines-macro-usage)
#define MINUTES(x) SUFFIX_APPEND(x, _min) // NOLINT(cppcoreguidelines-macro-usage) #define MINUTES(x) SUFFIX_APPEND(x, _min) // NOLINT(cppcoreguidelines-macro-usage)
#define SECONDS(x) SUFFIX_APPEND(x, _s) // NOLINT(cppcoreguidelines-macro-usage) #define SECONDS(x) SUFFIX_APPEND(x, _s) // NOLINT(cppcoreguidelines-macro-usage)
#define MSECONDS(x) SUFFIX_APPEND(x, _ms) // NOLINT(cppcoreguidelines-macro-usage) #define MSECONDS(x) SUFFIX_APPEND(x, _ms) // NOLINT(cppcoreguidelines-macro-usage)
#define MICSECONDS(x) SUFFIX_APPEND(x, _us) // NOLINT(cppcoreguidelines-macro-usage) #define MICSECONDS(x) SUFFIX_APPEND(x, _us) // NOLINT(cppcoreguidelines-macro-usage)
#define NANOSECONDS(x) SUFFIX_APPEND(x, _ns) // NOLINT(cppcoreguidelines-macro-usage) #define NANOSECONDS(x) SUFFIX_APPEND(x, _ns) // NOLINT(cppcoreguidelines-macro-usage)
#endif // __cplusplus >= 201402L #endif // __cplusplus >= 201402L
#endif // (defined(Q_CC_GNU) && Q_CC_GNU < 409) && !defined(Q_CC_CLANG) #endif // (defined(Q_CC_GNU) && Q_CC_GNU < 409) && !defined(Q_CC_CLANG)
#if (defined(Q_CC_GNU) && Q_CC_GNU < 409) && !defined(Q_CC_CLANG) #if (defined(Q_CC_GNU) && Q_CC_GNU < 409) && !defined(Q_CC_CLANG)
#define V_HOURS(x) HOURS(x) // NOLINT(cppcoreguidelines-macro-usage) #define V_HOURS(x) HOURS(x) // NOLINT(cppcoreguidelines-macro-usage)
#define V_MINUTES(x) MINUTES(x) // NOLINT(cppcoreguidelines-macro-usage) #define V_MINUTES(x) MINUTES(x) // NOLINT(cppcoreguidelines-macro-usage)
#define V_SECONDS(x) SECONDS(x) // NOLINT(cppcoreguidelines-macro-usage) #define V_SECONDS(x) SECONDS(x) // NOLINT(cppcoreguidelines-macro-usage)
#define V_MSECONDS(x) MSECONDS(x) // NOLINT(cppcoreguidelines-macro-usage) #define V_MSECONDS(x) MSECONDS(x) // NOLINT(cppcoreguidelines-macro-usage)
#define V_MICSECONDS(x) MICSECONDS(x) // NOLINT(cppcoreguidelines-macro-usage) #define V_MICSECONDS(x) MICSECONDS(x) // NOLINT(cppcoreguidelines-macro-usage)
#define V_NANOSECONDS(x) NANOSECONDS(x) // NOLINT(cppcoreguidelines-macro-usage) #define V_NANOSECONDS(x) NANOSECONDS(x) // NOLINT(cppcoreguidelines-macro-usage)
#else #else
#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0) #if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)
#define V_HOURS(x) HOURS(x) // NOLINT(cppcoreguidelines-macro-usage) #define V_HOURS(x) HOURS(x) // NOLINT(cppcoreguidelines-macro-usage)
#define V_MINUTES(x) MINUTES(x) // NOLINT(cppcoreguidelines-macro-usage) #define V_MINUTES(x) MINUTES(x) // NOLINT(cppcoreguidelines-macro-usage)
#define V_SECONDS(x) SECONDS(x) // NOLINT(cppcoreguidelines-macro-usage) #define V_SECONDS(x) SECONDS(x) // NOLINT(cppcoreguidelines-macro-usage)
#define V_MSECONDS(x) MSECONDS(x) // NOLINT(cppcoreguidelines-macro-usage) #define V_MSECONDS(x) MSECONDS(x) // NOLINT(cppcoreguidelines-macro-usage)
#define V_MICSECONDS(x) MICSECONDS(x) // NOLINT(cppcoreguidelines-macro-usage) #define V_MICSECONDS(x) MICSECONDS(x) // NOLINT(cppcoreguidelines-macro-usage)
#define V_NANOSECONDS(x) NANOSECONDS(x) // NOLINT(cppcoreguidelines-macro-usage) #define V_NANOSECONDS(x) NANOSECONDS(x) // NOLINT(cppcoreguidelines-macro-usage)
#else #else
#define V_HOURS(x) HOURS_INT(x) // NOLINT(cppcoreguidelines-macro-usage) #define V_HOURS(x) HOURS_INT(x) // NOLINT(cppcoreguidelines-macro-usage)
#define V_MINUTES(x) MINUTES_INT(x) // NOLINT(cppcoreguidelines-macro-usage) #define V_MINUTES(x) MINUTES_INT(x) // NOLINT(cppcoreguidelines-macro-usage)
#define V_SECONDS(x) SECONDS_INT(x) // NOLINT(cppcoreguidelines-macro-usage) #define V_SECONDS(x) SECONDS_INT(x) // NOLINT(cppcoreguidelines-macro-usage)
#define V_MSECONDS(x) MSECONDS_INT(x) // NOLINT(cppcoreguidelines-macro-usage) #define V_MSECONDS(x) MSECONDS_INT(x) // NOLINT(cppcoreguidelines-macro-usage)
#define V_MICSECONDS(x) MICSECONDS_INT(x) // NOLINT(cppcoreguidelines-macro-usage) #define V_MICSECONDS(x) MICSECONDS_INT(x) // NOLINT(cppcoreguidelines-macro-usage)
#define V_NANOSECONDS(x) NANOSECONDS_INT(x) // NOLINT(cppcoreguidelines-macro-usage) #define V_NANOSECONDS(x) NANOSECONDS_INT(x) // NOLINT(cppcoreguidelines-macro-usage)
#endif // QT_VERSION >= QT_VERSION_CHECK(5, 8, 0) #endif // QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)
#endif // (defined(Q_CC_GNU) && Q_CC_GNU < 409) && !defined(Q_CC_CLANG) #endif // (defined(Q_CC_GNU) && Q_CC_GNU < 409) && !defined(Q_CC_CLANG)
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
using vsizetype = qsizetype; using vsizetype = qsizetype;