diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2019-08-08 19:40:32 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2019-08-30 10:52:42 +0200 |
commit | 20f69beae48d2efb1fdb5754218a8cdc990ba13e (patch) | |
tree | 0f79f023ee153875ee4028f609ec6f077ef71234 /src/corelib/time/qgregoriancalendar_p.h | |
parent | 108382e236dcdc09a822b89db35cc8bc4509273f (diff) |
Optimize QDate by shortcutting some gregorian calendar methods
Add some static methods to QGregorianCalendar, some of which serve to
implement its methods, that QDate can use to bypass vtables and
exploit fixed truths of the Gregorian calendar in its default
handling.
Change-Id: Iec191cdf4d52945dbd5679e609180cb4fe59b5fd
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/corelib/time/qgregoriancalendar_p.h')
-rw-r--r-- | src/corelib/time/qgregoriancalendar_p.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/corelib/time/qgregoriancalendar_p.h b/src/corelib/time/qgregoriancalendar_p.h index 4e6c42ef76..191f9c127b 100644 --- a/src/corelib/time/qgregoriancalendar_p.h +++ b/src/corelib/time/qgregoriancalendar_p.h @@ -75,6 +75,14 @@ public: QLocale::FormatType format) const override; QString standaloneMonthName(const QLocale &locale, int month, int year, QLocale::FormatType format) const override; + + // Static optimized versions for the benefit of QDate: + static int weekDayOfJulian(qint64 jd); + static bool leapTest(int year); + static int monthLength(int month, int year); + static bool validParts(int year, int month, int day); + static QCalendar::YearMonthDay partsFromJulian(qint64 jd); + static bool julianFromParts(int year, int month, int day, qint64 *jd); }; QT_END_NAMESPACE |