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 <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
Giuseppe D'Angelo 2021-05-02 02:50:57 +02:00
parent 37e3b988c2
commit aaaa5c6d82

View File

@ -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