diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2020-11-16 16:48:22 +0100 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2021-02-18 11:21:19 +0100 |
commit | 755c678f0f5062cee4b8e71f6f2ff3958a01715e (patch) | |
tree | af0744765535e6bcebd5a925debcca09ee90f881 /src/corelib/time/qcalendar.h | |
parent | 6fa9f487db1a1947815c9e4125688b9dc4df117f (diff) |
Provide calendar backends with a unique ID
Registration by ID allows for detection of duplicate instantiation of
built-in back-ends, which can be detected and flagged by setting the
ID to ~size_t(0) instead of the enum value for which it sought to be
registered. A new method, calendarId(), is provided to access this;
while the old calendarSystem() becomes non-virtual, as it can be
inferred (when registration was successful) from the ID.
Make registration by name or alias conditional on successful
registration by ID. Previously, failed registration by name precluded
registration by ID, which now becomes the authoritative registration.
This incidentally makes it possible to add a QCalendar constructor
taking the unique ID of a backend, for use in conjunction with custom
calendar implementations.
Change-Id: Ib22925a8ac3ef9439a09ec3855f6231cf9b91c21
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/time/qcalendar.h')
-rw-r--r-- | src/corelib/time/qcalendar.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/corelib/time/qcalendar.h b/src/corelib/time/qcalendar.h index 5eb2e541c8..e6907f6a17 100644 --- a/src/corelib/time/qcalendar.h +++ b/src/corelib/time/qcalendar.h @@ -135,6 +135,7 @@ public: explicit QCalendar(System system); explicit QCalendar(QLatin1String name); explicit QCalendar(QStringView name); + explicit QCalendar(size_t id); // QCalendar is a trivially copyable value type. bool isValid() const { return d != nullptr; } |