Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qcalendar.cpp
Go to the documentation of this file.
1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3#include "qcalendar.h"
6#ifndef QT_BOOTSTRAPPED
7#include "qjuliancalendar_p.h"
9#endif
10#if QT_CONFIG(jalalicalendar)
11#include "qjalalicalendar_p.h"
12#endif
13#if QT_CONFIG(islamiccivilcalendar)
15#endif
16
17#include <private/qflatmap_p.h>
18#include "qatomic.h"
19#include "qdatetime.h"
20#include "qcalendarmath_p.h"
21#include <qhash.h>
22#include <qreadwritelock.h>
23
24#include <vector>
25
27
29{
30 struct is_transparent {};
32 {
33 return QAnyStringView::compare(lhs, rhs, Qt::CaseInsensitive) < 0;
34 }
35};
36
37namespace QtPrivate {
38
39/*
40 \internal
41 Handles calendar backend registration.
42*/
44{
45 Q_DISABLE_COPY_MOVE(QCalendarRegistry); // This is a singleton.
46
47 static constexpr qsizetype ExpectedNumberOfBackends = qsizetype(QCalendar::System::Last) + 1;
48
49 /*
50 Lock protecting the registry from concurrent modification.
51 */
52 QReadWriteLock lock;
53
54 /*
55 Vector containing all registered backends.
56
57 The indices 0 to \c QCalendar::System::Last inclusive are allocated
58 for system backends and always present (but may be null).
59 */
60 std::vector<QCalendarBackend *> byId;
61
62 /*
63 Backends registered by name.
64
65 Each backend may be registered with several names associated with it.
66 The names are case-insensitive.
67 */
72 std::vector<QCalendarBackend *>
73 > byName;
74
75 /*
76 Pointer to the Gregorian backend for faster lockless access to it.
77
78 This pointer may be null if the Gregorian backend is not yet registered.
79 This pointer may only be set once and only when write lock is held on
80 the registry.
81 */
82 QAtomicPointer<const QCalendarBackend> gregorianCalendar = nullptr;
83
84 enum : int {
85 Unpopulated, // The standard backends may not yet be created
86 Populated, // All standard backends were created
87 IsBeingDestroyed, // The registry and the backends are being destroyed
88 };
89
90 /*
91 Fast way to check whether the standard calendars were populated.
92
93 The status should only be changed while the write lock is held.
94 */
95 QAtomicInt status = Unpopulated;
96
97 void ensurePopulated();
98 QCalendarBackend *registerSystemBackendLockHeld(QCalendar::System system);
99 void registerBackendLockHeld(QCalendarBackend *backend, const QStringList &names,
100 QCalendar::System system);
101
102public:
104 {
105 byId.resize(ExpectedNumberOfBackends);
106 byName.reserve(ExpectedNumberOfBackends * 2); // assume one alias on average
107 }
108
110
111 bool isBeingDestroyed() const { return status.loadRelaxed() == IsBeingDestroyed; }
112
114
116
117 /*
118 Returns backend for Gregorian calendar.
119
120 The backend is returned without locking the registry if possible.
121 */
123 {
124 const QCalendarBackend *backend = gregorianCalendar.loadAcquire();
125 if (Q_LIKELY(backend != nullptr))
126 return backend;
128 }
129
130 /*
131 Returns \a true if the argument matches the registered Gregorian backend.
132
133 \a backend should not be \nullptr.
134 */
135 bool isGregorian(const QCalendarBackend *backend) const
136 {
137 return backend == gregorianCalendar.loadRelaxed();
138 }
139
141 const QCalendarBackend *fromIndex(size_t index);
143
145};
146
147/*
148 Destroy the registry.
149
150 This destroys all registered backends. This destructor should only be called
151 in a single-threaded context at program exit.
152*/
154{
155 QWriteLocker locker(&lock);
156
157 status.storeRelaxed(IsBeingDestroyed);
158
159 qDeleteAll(byId);
160}
161
162/*
163 Registers a custom backend.
164
165 A new unique ID is allocated for the \a backend. The registry takes
166 ownership of the \a backend.
167
168 The \a names of the backend are also registered. Already registered
169 names are not updated.
170
171 The \a backend should not be already registered.
172
173 The \a backend should be fully initialized. It becomes available
174 to other threads before this function returns.
175*/
177{
178 Q_ASSERT(!backend->calendarId().isValid());
179
180 ensurePopulated();
181
182 QWriteLocker locker(&lock);
183 registerBackendLockHeld(backend, names, QCalendar::System::User);
184}
185
186/*
187 Ensures all system calendars have been instantiated.
188
189 This arranges for each system backend to be registered. The method only
190 does anything on its first call, which ensures that name-based lookups can
191 always find all the calendars available via the \c QCalendar::System other
192 than \c QCalendar::System::User.
193*/
194void QCalendarRegistry::ensurePopulated()
195{
196 if (Q_LIKELY(status.loadAcquire() != Unpopulated))
197 return;
198
199 QWriteLocker locker(&lock);
200 if (status.loadAcquire() != Unpopulated)
201 return;
202
203 for (int i = 0; i <= int(QCalendar::System::Last); ++i) {
204 if (byId[i] == nullptr)
205 registerSystemBackendLockHeld(QCalendar::System(i));
206 }
207
208#if defined(QT_FORCE_ASSERTS) || !defined(QT_NO_DEBUG)
209 auto oldValue = status.fetchAndStoreRelease(Populated);
210 Q_ASSERT(oldValue == Unpopulated);
211#else
212 status.storeRelease(Populated);
213#endif
214}
215
216/*
217 Helper functions for system backend registration.
218
219 This function must be called with write lock held on the registry.
220
221 \sa registerSystemBackend
222*/
223QCalendarBackend *QCalendarRegistry::registerSystemBackendLockHeld(QCalendar::System system)
224{
226
227 QCalendarBackend *backend = nullptr;
229
230 switch (system) {
232 backend = new QGregorianCalendar;
234 break;
235#ifndef QT_BOOTSTRAPPED
237 backend = new QJulianCalendar;
239 break;
241 backend = new QMilankovicCalendar;
243 break;
244#endif
245#if QT_CONFIG(jalalicalendar)
246 case QCalendar::System::Jalali:
247 backend = new QJalaliCalendar;
249 break;
250#endif
251#if QT_CONFIG(islamiccivilcalendar)
252 case QCalendar::System::IslamicCivil:
253 backend = new QIslamicCivilCalendar;
255 break;
256#else // When highest-numbered system isn't enabled, ensure we have a case for Last:
258#endif
260 Q_UNREACHABLE();
261 }
262 if (!backend)
263 return nullptr;
264
265 registerBackendLockHeld(backend, names, system);
266 Q_ASSERT(backend == byId[size_t(system)]);
267
268 return backend;
269}
270
271/*
272 Helper function for backend registration.
273
274 This function must be called with write lock held on the registry.
275
276 \sa registerBackend
277*/
278void QCalendarRegistry::registerBackendLockHeld(QCalendarBackend *backend, const QStringList &names,
279 QCalendar::System system)
280{
281 Q_ASSERT(!backend->calendarId().isValid());
282
283 auto index = size_t(system);
284
285 // Note: it is important to update the calendar ID before making
286 // the calendar available for queries.
287 if (system == QCalendar::System::User) {
288 backend->setIndex(byId.size());
289 byId.push_back(backend);
290 } else if (byId[index] == nullptr) {
291 backend->setIndex(index);
292 if (system == QCalendar::System::Gregorian) {
293#if defined(QT_FORCE_ASSERTS) || !defined(QT_NO_DEBUG)
294 auto oldValue = gregorianCalendar.fetchAndStoreRelease(backend);
295 Q_ASSERT(oldValue == nullptr);
296#else
297 gregorianCalendar.storeRelease(backend);
298#endif
299 }
300
301 Q_ASSERT(byId.size() > index);
302 Q_ASSERT(byId[index] == nullptr);
303 byId[index] = backend;
304 }
305
306 // Register any names.
307 for (const auto &name : names) {
308 auto [it, inserted] = byName.try_emplace(name, backend);
309 if (!inserted) {
311 qWarning("Cannot register name %ls (already in use) for %ls",
313 }
314 }
315}
316
317/*
318 Returns a list of names of the available calendar systems.
319
320 Any QCalendarBackend sub-class must be registered before being exposed to Date
321 and Time APIs.
322
323 \sa fromName()
324*/
326{
327 ensurePopulated();
328
329 QReadLocker locker(&lock);
330 return byName.keys();
331}
332
333/*
334 Returns a pointer to a named calendar backend.
335
336 If the given \a name is present in availableCalendars(), the backend
337 matching it is returned. Otherwise, \nullptr is returned. Matching of
338 names ignores case.
339
340 \sa availableCalendars(), fromEnum(), fromIndex()
341*/
343{
344 ensurePopulated();
345
346 QReadLocker locker(&lock);
347 return byName.value(name, nullptr);
348}
349
350/*
351 Returns a pointer to a calendar backend, specified by index.
352
353 If a calendar with ID \a index is known to the calendar registry, the backend
354 with this ID is returned. Otherwise, \nullptr is returned.
355
356 \sa fromEnum(), calendarId()
357*/
359{
360 {
361 QReadLocker locker(&lock);
362
363 if (index >= byId.size())
364 return nullptr;
365
366 if (auto backend = byId[index])
367 return backend;
368 }
369
370 if (index <= size_t(QCalendar::System::Last))
372
373 return nullptr;
374}
375
376/*
377 Returns a pointer to a calendar backend, specified by \a system.
378
379 This will instantiate the indicated calendar (which will enable fromName()
380 to return it subsequently), but only for the Qt-supported calendars for
381 which (where relevant) the appropriate feature has been enabled.
382
383 \a system should be a member of \a QCalendar::System other than
384 \a QCalendar::System::User.
385
386 \sa fromName(), fromId()
387*/
389{
391 auto index = size_t(system);
392
393 {
394 QReadLocker locker(&lock);
395 Q_ASSERT(byId.size() > index);
396 if (auto backend = byId[index])
397 return backend;
398 }
399
400 QWriteLocker locker(&lock);
401
402 // Check if the backend was registered after releasing the read lock above.
403 if (auto backend = byId[index])
404 return backend;
405
406 return registerSystemBackendLockHeld(system);
407}
408
409/*
410 Returns a list of names \a backend was registered with.
411*/
413{
414 QStringList l;
415 l.reserve(byName.size()); // too large, but never really large, so ok
416
418 // Clang complains about the reference still causing a copy. The reference is idiomatic, but
419 // runs afoul of QFlatMap's iterators which return a pair of references instead of a reference
420 // to pair. Suppress the warning, because `const auto [key, value]` would look wrong.
421 QT_WARNING_DISABLE_CLANG("-Wrange-loop-analysis")
422 for (const auto &[key, value] : byName) {
423 if (value == backend)
424 l.push_back(key);
425 }
427
428 return l;
429}
430
431} // namespace QtPrivate
432
434
518{
519 Q_ASSERT(!m_id.isValid() || calendarRegistry.isDestroyed()
520 || calendarRegistry->isBeingDestroyed());
521}
522
538{
539 if (Q_UNLIKELY(calendarRegistry.isDestroyed()))
540 return {};
541
542 return calendarRegistry->backendNames(this);
543}
544
551void QCalendarBackend::setIndex(size_t index)
552{
553 Q_ASSERT(!m_id.isValid());
554 m_id.id = index;
555}
556
580{
581 Q_ASSERT(!m_id.isValid());
582
583 if (Q_LIKELY(!calendarRegistry.isDestroyed()))
584 calendarRegistry->registerCustomBackend(this, names);
585
586 return m_id;
587}
588
590{
591 if (Q_UNLIKELY(calendarRegistry.isDestroyed()))
592 return false;
593
594 return calendarRegistry->isGregorian(this);
595}
596
614{
615 return m_id.isInEnum() ? QCalendar::System(m_id.index()) : QCalendar::System::User;
616}
617
618/*
619 Create local variable d containing the backend associated with a QCalendar
620 instance unless the calendar registry is destroyed together with all backends,
621 then return nullptr.
622
623 This assumes that the registry is only destroyed in single threaded context.
624*/
625#define SAFE_D() const auto d = Q_UNLIKELY(calendarRegistry.isDestroyed()) ? nullptr : d_ptr
626
635{
636 SAFE_D();
637 return d ? d->name() : QString();
638}
639
640// date queries
659// properties of the calendar
660
718{
719 return monthsInYear(year) ? isLeapYear(year) ? 366 : 365 : 0;
720}
721
731{
732 return year > 0 || (year < 0 ? isProleptic() : hasYearZero()) ? 12 : 0;
733}
734
748bool QCalendarBackend::isDateValid(int year, int month, int day) const
749{
750 return day > 0 && day <= daysInMonth(month, year);
751}
752
764{
765 return true;
766}
767
776{
777 return false;
778}
779
794{
795 return 31;
796}
797
806{
807 return 29;
808}
809
818{
819 return 12;
820}
821
822// Julian day number calculations
823
866{
867 return QRoundingDown::qMod<7>(jd) + 1;
868}
869
870// Month and week-day name look-ups (implemented in qlocale.cpp):
971// End of methods implemented in qlocale.cpp
972
981{
982 if (Q_UNLIKELY(calendarRegistry.isDestroyed()))
983 return {};
984
985 return calendarRegistry->availableCalendars();
986}
987
998const QCalendarBackend *QCalendarBackend::fromName(QAnyStringView name)
999{
1000 if (Q_UNLIKELY(calendarRegistry.isDestroyed()))
1001 return nullptr;
1002
1003 return calendarRegistry->fromName(name);
1004}
1005
1015const QCalendarBackend *QCalendarBackend::fromId(QCalendar::SystemId id)
1016{
1017 if (Q_UNLIKELY(calendarRegistry.isDestroyed() || !id.isValid()))
1018 return nullptr;
1019
1020 return calendarRegistry->fromIndex(id.index());
1021}
1022
1033const QCalendarBackend *QCalendarBackend::fromEnum(QCalendar::System system)
1034{
1035 if (Q_UNLIKELY(calendarRegistry.isDestroyed() || system == QCalendar::System::User))
1036 return nullptr;
1037
1038 return calendarRegistry->fromEnum(system);
1039}
1040
1047const QCalendarBackend *QCalendarBackend::gregorian()
1048{
1049 if (Q_UNLIKELY(calendarRegistry.isDestroyed()))
1050 return nullptr;
1051
1052 return calendarRegistry->gregorian();
1053}
1054
1156 : d_ptr(QCalendarBackend::gregorian())
1157{
1158 Q_ASSERT(!d_ptr || d_ptr->calendarId().isValid());
1159}
1160
1162{
1163 // If system is valid, we should get a valid d for that system.
1164 Q_ASSERT(!d_ptr || (uint(system) > uint(QCalendar::System::Last))
1165 || (d_ptr->calendarId().index() == size_t(system)));
1166}
1167
1180 : d_ptr(QCalendarBackend::fromId(id))
1181{
1182 Q_ASSERT(!d_ptr || d_ptr->calendarId().index() == id.index());
1183}
1184
1186 : d_ptr(QCalendarBackend::fromName(name))
1187{
1188 Q_ASSERT(!d_ptr || d_ptr->calendarId().isValid());
1189}
1190
1200// Date queries:
1201
1211int QCalendar::daysInMonth(int month, int year) const
1212{
1213 SAFE_D();
1214 return d ? d->daysInMonth(month, year) : 0;
1215}
1216
1222int QCalendar::daysInYear(int year) const
1223{
1224 SAFE_D();
1225 return d ? d->daysInYear(year) : 0;
1226}
1227
1236int QCalendar::monthsInYear(int year) const
1237{
1238 SAFE_D();
1239 return d ? year == Unspecified ? d->maximumMonthsInYear() : d->monthsInYear(year) : 0;
1240}
1241
1250bool QCalendar::isDateValid(int year, int month, int day) const
1251{
1252 SAFE_D();
1253 return d && d->isDateValid(year, month, day);
1254}
1255
1256// properties of the calendar
1257
1263{
1264 SAFE_D();
1265 return d && d->isGregorian();
1266}
1267
1277bool QCalendar::isLeapYear(int year) const
1278{
1279 SAFE_D();
1280 return d && d->isLeapYear(year);
1281}
1282
1289{
1290 SAFE_D();
1291 return d && d->isLunar();
1292}
1293
1302{
1303 SAFE_D();
1304 return d && d->isLuniSolar();
1305}
1306
1314{
1315 SAFE_D();
1316 return d && d->isSolar();
1317}
1318
1329{
1330 SAFE_D();
1331 return d && d->isProleptic();
1332}
1333
1360{
1361 SAFE_D();
1362 return d && d->hasYearZero();
1363}
1364
1371{
1372 SAFE_D();
1373 return d ? d->maximumDaysInMonth() : 0;
1374}
1375
1382{
1383 SAFE_D();
1384 return d ? d->minimumDaysInMonth() : 0;
1385}
1386
1393{
1394 SAFE_D();
1395 return d ? d->maximumMonthsInYear() : 0;
1396}
1397
1398// Julian Day conversions:
1399
1414QDate QCalendar::dateFromParts(int year, int month, int day) const
1415{
1416 SAFE_D();
1417 qint64 jd;
1418 return d && d->dateToJulianDay(year, month, day, &jd)
1419 ? QDate::fromJulianDay(jd) : QDate();
1420}
1421
1423{
1424 return parts.isValid() ? dateFromParts(parts.year, parts.month, parts.day) : QDate();
1425}
1426
1437{
1438 SAFE_D();
1439 return d && date.isValid() ? d->julianDayToDate(date.toJulianDay()) : YearMonthDay();
1440}
1441
1452{
1453 SAFE_D();
1454 return d && date.isValid() ? d->dayOfWeek(date.toJulianDay()) : 0;
1455}
1456
1457// Locale data access
1458
1478QString QCalendar::monthName(const QLocale &locale, int month, int year,
1480{
1481 SAFE_D();
1482 const int maxMonth = year == Unspecified ? maximumMonthsInYear() : monthsInYear(year);
1483 if (!d || month < 1 || month > maxMonth)
1484 return QString();
1485
1486 return d->monthName(locale, month, year, format);
1487}
1488
1508QString QCalendar::standaloneMonthName(const QLocale &locale, int month, int year,
1510{
1511 SAFE_D();
1512 const int maxMonth = year == Unspecified ? maximumMonthsInYear() : monthsInYear(year);
1513 if (!d || month < 1 || month > maxMonth)
1514 return QString();
1515
1516 return d->standaloneMonthName(locale, month, year, format);
1517}
1518
1535{
1536 SAFE_D();
1537 return d ? d->weekDayName(locale, day, format) : QString();
1538}
1539
1558{
1559 SAFE_D();
1560 return d ? d->standaloneWeekDayName(locale, day, format) : QString();
1561}
1562
1583 QDate dateOnly, QTime timeOnly,
1584 const QLocale &locale) const
1585{
1586 SAFE_D();
1587 return d ? d->dateTimeToString(format, datetime, dateOnly, timeOnly, locale) : QString();
1588}
1589
1598{
1600}
1601
1603
1604#ifndef QT_BOOTSTRAPPED
1605#include "moc_qcalendar.cpp"
1606#endif
\inmodule QtCore
static Q_CORE_EXPORT int compare(QAnyStringView lhs, QAnyStringView rhs, Qt::CaseSensitivity cs=Qt::CaseSensitive) noexcept
Returns an integer that compares to zero as lhs compares to rhs.
Definition qstring.cpp:1601
\inmodule QtCore
Definition qatomic.h:112
\macro Q_ATOMIC_INTnn_IS_SUPPORTED
Definition qatomic.h:123
T fetchAndStoreRelease(T newValue) noexcept
void storeRelaxed(T newValue) noexcept
T loadAcquire() const noexcept
void storeRelease(T newValue) noexcept
T loadRelaxed() const noexcept
Type fetchAndStoreRelease(Type newValue) noexcept
Type loadAcquire() const noexcept
Type loadRelaxed() const noexcept
void storeRelease(Type newValue) noexcept
The QCalendarBackend class provides basic calendaring functions.
virtual int daysInMonth(int month, int year=QCalendar::Unspecified) const =0
Returns number of days in the month number month, in year year.
QCalendar::System calendarSystem() const
The calendar system of this calendar.
virtual bool isProleptic() const
Returns true if this calendar is a proleptic calendar.
virtual ~QCalendarBackend()
Destroys the calendar backend.
virtual bool hasYearZero() const
Returns true if year number 0 is considered a valid year in this calendar.
QCalendar::SystemId calendarId() const
virtual int dayOfWeek(qint64 jd) const
Returns the day of the week for the given Julian Day Number jd.
static QStringList availableCalendars()
Returns a list of names of the available calendar systems.
virtual bool isLeapYear(int year) const =0
Returns true if the specified year is a leap year for this calendar.
bool isGregorian() const
virtual int minimumDaysInMonth() const
Returns the minimum number of days in any valid month of any valid year.
virtual int maximumDaysInMonth() const
Returns the maximum number of days in a month for any year.
virtual int monthsInYear(int year) const
Returns the total number of months in the year number year.
virtual QString name() const =0
Returns the primary name of the calendar.
virtual int daysInYear(int year) const
Returns the total number of days in the year number year.
QStringList names() const
Returns list of names this backend was registered with.
QCalendar::SystemId registerCustomBackend(const QStringList &names)
Register this backend as a custom backend.
virtual int maximumMonthsInYear() const
Returns the maximum number of months possible in any year.
virtual bool isDateValid(int year, int month, int day) const
Returns true if the date specified by year, month, and day is valid for this calendar; otherwise retu...
\inmodule QtCore
Definition qcalendar.h:98
constexpr bool isValid() const noexcept
Returns true if this is a valid calendar implementation identifier, false otherwise.
Definition qcalendar.h:108
constexpr size_t index() const noexcept
Definition qcalendar.h:107
bool isGregorian() const
Returns true if this calendar object is the Gregorian calendar object used as default calendar by oth...
QDate dateFromParts(int year, int month, int day) const
System
This enumerated type is used to specify a choice of calendar system.
Definition qcalendar.h:73
int minimumDaysInMonth() const
Returns the number of days in the shortest month in the calendar, in any year.
bool isDateValid(int year, int month, int day) const
Returns true precisely if the given year, month, and day specify a valid date in this calendar.
QString standaloneMonthName(const QLocale &locale, int month, int year=Unspecified, QLocale::FormatType format=QLocale::LongFormat) const
Returns a suitably localised standalone name for a month.
static QStringList availableCalendars()
Returns a list of names of the available calendar systems.
bool isLunar() const
Returns true if this calendar is a lunar calendar.
QString dateTimeToString(QStringView format, const QDateTime &datetime, QDate dateOnly, QTime timeOnly, const QLocale &locale) const
Returns a string representing a given date, time or date-time.
QString name() const
The primary name of this calendar.
QString monthName(const QLocale &locale, int month, int year=Unspecified, QLocale::FormatType format=QLocale::LongFormat) const
Returns a suitably localised name for a month.
@ Unspecified
Definition qcalendar.h:57
YearMonthDay partsFromDate(QDate date) const
Converts a QDate to a year, month, and day of the month.
int maximumMonthsInYear() const
Returns the largest number of months that any year may contain.
int maximumDaysInMonth() const
Returns the number of days in the longest month in the calendar, in any year.
bool hasYearZero() const
Returns true if this calendar has a year zero.
int monthsInYear(int year) const
Returns the number of months in the given year.
int dayOfWeek(QDate date) const
Returns the day of the week number for the given date.
bool isLuniSolar() const
Returns true if this calendar is luni-solar.
bool isLeapYear(int year) const
Returns true if the given year is a leap year.
QString standaloneWeekDayName(const QLocale &locale, int day, QLocale::FormatType format=QLocale::LongFormat) const
Returns a suitably localised standalone name for a day of the week.
bool isProleptic() const
Returns true if this calendar is proleptic.
int daysInMonth(int month, int year=Unspecified) const
Returns the number of days in the given month of the given year.
int daysInYear(int year) const
Returns the number of days in the given year.
bool isSolar() const
Returns true if this calendar is solar.
QString weekDayName(const QLocale &locale, int day, QLocale::FormatType format=QLocale::LongFormat) const
Returns a suitably localised name for a day of the week.
\inmodule QtCore\reentrant
Definition qdatetime.h:257
\inmodule QtCore \reentrant
Definition qdatetime.h:27
constexpr bool isValid() const
Returns true if this date is valid; otherwise returns false.
Definition qdatetime.h:86
constexpr qint64 toJulianDay() const
Converts the date to a Julian day.
Definition qdatetime.h:161
static constexpr QDate fromJulianDay(qint64 jd_)
Converts the Julian day jd to a QDate.
Definition qdatetime.h:159
const key_container_type & keys() const noexcept
Definition qflatmap_p.h:582
T value(const Key &key, const T &defaultValue) const
Definition qflatmap_p.h:636
std::pair< iterator, bool > try_emplace(const Key &key, Args &&...args)
Definition qflatmap_p.h:700
size_type size() const noexcept
Definition qflatmap_p.h:577
The QGregorianCalendar class implements the Gregorian calendar.
static QStringList nameList()
Implements a commonly-used computed version of the Islamic calendar.
static QStringList nameList()
The QJalaliCalendar class provides Jalali (Hijri Shamsi) calendar system implementation.
static QStringList nameList()
The QJulianCalendar class provides Julian calendar system implementation.
static QStringList nameList()
The QMilankovicCalendar class provides Milanković calendar system implementation.
static QStringList nameList()
\inmodule QtCore
\inmodule QtCore
\inmodule QtCore
\inmodule QtCore
Definition qstringview.h:76
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
\inmodule QtCore \reentrant
Definition qdatetime.h:189
\inmodule QtCore
const QCalendarBackend * fromEnum(QCalendar::System system)
const QCalendarBackend * fromName(QAnyStringView name)
void registerCustomBackend(QCalendarBackend *backend, const QStringList &names)
bool isGregorian(const QCalendarBackend *backend) const
const QCalendarBackend * fromIndex(size_t index)
QStringList backendNames(const QCalendarBackend *backend)
const QCalendarBackend * gregorian()
QDate date
[1]
qDeleteAll(list.begin(), list.end())
QSet< QString >::iterator it
Combined button and popup list for selecting options.
\macro QT_NAMESPACE
@ CaseInsensitive
#define SAFE_D()
#define Q_UNLIKELY(x)
#define QT_WARNING_POP
#define Q_LIKELY(x)
#define QT_WARNING_PUSH
#define QT_WARNING_DISABLE_CLANG(text)
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
#define Q_GLOBAL_STATIC(TYPE, NAME,...)
#define qWarning
Definition qlogging.h:162
GLuint64 key
GLuint index
[2]
GLenum GLuint id
[7]
GLuint name
GLint GLsizei GLsizei GLenum format
GLuint GLuint * names
#define Q_ASSERT(cond)
Definition qrandom.cpp:47
#define qUtf16Printable(string)
Definition qstring.h:1403
ptrdiff_t qsizetype
Definition qtypes.h:70
unsigned int uint
Definition qtypes.h:29
long long qint64
Definition qtypes.h:55
bool operator()(QAnyStringView lhs, QAnyStringView rhs) const
Definition qcalendar.cpp:31
bool isValid() const
Definition qcalendar.h:63