From aaaa5c6d82f8427ad927e140dd5441ad12921dc6 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Sun, 2 May 2021 02:50:57 +0200 Subject: [PATCH] QDateTime: code tidies Move the ValidityMask / DaylightMask enumerators in the right enumeration. This allows to use them in a type-safe way through the StatusFlags flag type. Also, define the flag operators for StatusFlags. Change-Id: Icdba7c3f49f18ffb4aff9921d8012ddc3f7cbed7 Reviewed-by: Thiago Macieira Reviewed-by: Edward Welbourne --- src/corelib/time/qdatetime_p.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/corelib/time/qdatetime_p.h b/src/corelib/time/qdatetime_p.h index 8f9773ba72..3c3238fbaf 100644 --- a/src/corelib/time/qdatetime_p.h +++ b/src/corelib/time/qdatetime_p.h @@ -101,14 +101,14 @@ public: TimeSpecMask = 0x30, SetToStandardTime = 0x40, - SetToDaylightTime = 0x80 + SetToDaylightTime = 0x80, + ValidityMask = ValidDate | ValidTime | ValidDateTime, + DaylightMask = SetToStandardTime | SetToDaylightTime, }; Q_DECLARE_FLAGS(StatusFlags, StatusFlag) enum { TimeSpecShift = 4, - ValidityMask = ValidDate | ValidTime | ValidDateTime, - DaylightMask = SetToStandardTime | SetToDaylightTime }; static QDateTime::Data create(QDate toDate, QTime toTime, Qt::TimeSpec toSpec, @@ -139,6 +139,8 @@ public: #endif // timezone }; +Q_DECLARE_OPERATORS_FOR_FLAGS(QDateTimePrivate::StatusFlags) + QT_END_NAMESPACE #endif // QDATETIME_P_H