42 #ifndef QT_BOOTSTRAPPED
46 #if QT_CONFIG(jalalicalendar)
49 #if QT_CONFIG(islamiccivilcalendar)
103 std::vector<QCalendarBackend *> byId;
135 void ensurePopulated();
228 void QCalendarRegistry::ensurePopulated()
238 if (byId[
i] ==
nullptr)
242 #if defined(QT_FORCE_ASSERTS) || !defined(QT_NO_DEBUG)
269 #ifndef QT_BOOTSTRAPPED
279 #if QT_CONFIG(jalalicalendar)
280 case QCalendar::System::Jalali:
285 #if QT_CONFIG(islamiccivilcalendar)
286 case QCalendar::System::IslamicCivil:
299 registerBackendLockHeld(backend,
names, system);
300 Q_ASSERT(backend == byId[
size_t(system)]);
317 auto index = size_t(system);
322 backend->setIndex(byId.size());
323 byId.push_back(backend);
324 }
else if (byId[
index] ==
nullptr) {
325 backend->setIndex(
index);
327 #if defined(QT_FORCE_ASSERTS) || !defined(QT_NO_DEBUG)
337 byId[
index] = backend;
344 qWarning(
"Cannot register name %ls (already in use) for %ls",
345 qUtf16Printable(
name), qUtf16Printable(backend->
name()));
347 byName[
name] = backend;
383 return byName.
value(nameU16,
nullptr);
399 if (
index >= byId.size())
402 if (
auto backend = byId[
index])
427 auto index = size_t(system);
432 if (
auto backend = byId[
index])
439 if (
auto backend = byId[
index])
442 return registerSystemBackendLockHeld(system);
451 l.reserve(byName.
size());
457 if (
it.value() == backend)
458 l.push_back(
it.key());
553 || calendarRegistry->isBeingDestroyed());
572 if (
Q_UNLIKELY(calendarRegistry.isDestroyed()))
575 return calendarRegistry->backendNames(
this);
584 void QCalendarBackend::setIndex(
size_t index)
616 if (
Q_LIKELY(!calendarRegistry.isDestroyed()))
617 calendarRegistry->registerCustomBackend(
this,
names);
624 if (
Q_UNLIKELY(calendarRegistry.isDestroyed()))
627 return calendarRegistry->isGregorian(
this);
658 #define SAFE_D() const auto d = Q_UNLIKELY(calendarRegistry.isDestroyed()) ? nullptr : d_ptr
1015 if (
Q_UNLIKELY(calendarRegistry.isDestroyed()))
1018 return calendarRegistry->availableCalendars();
1033 if (
Q_UNLIKELY(calendarRegistry.isDestroyed()))
1036 return calendarRegistry->fromName(
name);
1050 if (
Q_UNLIKELY(calendarRegistry.isDestroyed() || !
id.isValid()))
1053 return calendarRegistry->fromIndex(
id.
index());
1071 return calendarRegistry->fromEnum(system);
1082 if (
Q_UNLIKELY(calendarRegistry.isDestroyed()))
1085 return calendarRegistry->gregorian();
1251 return d ?
d->daysInMonth(month, year) : 0;
1262 return d ?
d->daysInYear(year) : 0;
1276 return d ? year ==
Unspecified ?
d->maximumMonthsInYear() :
d->monthsInYear(year) : 0;
1290 return d &&
d->isDateValid(year, month, day);
1302 return d &&
d->isGregorian();
1317 return d &&
d->isLeapYear(year);
1328 return d &&
d->isLunar();
1341 return d &&
d->isLuniSolar();
1353 return d &&
d->isSolar();
1368 return d &&
d->isProleptic();
1399 return d &&
d->hasYearZero();
1410 return d ?
d->maximumDaysInMonth() : 0;
1421 return d ?
d->minimumDaysInMonth() : 0;
1432 return d ?
d->maximumMonthsInYear() : 0;
1455 return d &&
d->dateToJulianDay(year, month, day, &jd)
1520 if (!
d || month < 1 || month > maxMonth)
1523 return d->monthName(locale, month, year,
format);
1550 if (!
d || month < 1 || month > maxMonth)
1553 return d->standaloneMonthName(locale, month, year,
format);
1624 return d ?
d->dateTimeToString(
format, datetime, dateOnly, timeOnly, locale) :
QString();
1641 #ifndef QT_BOOTSTRAPPED
1642 #include "moc_qcalendar.cpp"
small capitals from c petite p scientific f u
small capitals from c petite p scientific i
[1]
The QAtomicInt class provides platform-independent atomic operations on int.
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
constexpr bool isValid() const noexcept
constexpr size_t index() const noexcept
virtual int daysInMonth(int month, int year=QCalendar::Unspecified) const =0
QCalendar::System calendarSystem() const
virtual bool isProleptic() const
virtual ~QCalendarBackend()
virtual bool hasYearZero() const
QCalendar::SystemId calendarId() const
virtual int dayOfWeek(qint64 jd) const
static QStringList availableCalendars()
virtual bool isLeapYear(int year) const =0
virtual int minimumDaysInMonth() const
virtual int maximumDaysInMonth() const
virtual int monthsInYear(int year) const
virtual QString name() const =0
virtual int daysInYear(int year) const
QStringList names() const
QCalendar::SystemId registerCustomBackend(const QStringList &names)
virtual int maximumMonthsInYear() const
virtual bool isDateValid(int year, int month, int day) const
QDate dateFromParts(int year, int month, int day) const
int minimumDaysInMonth() const
bool isDateValid(int year, int month, int day) const
QString standaloneMonthName(const QLocale &locale, int month, int year=Unspecified, QLocale::FormatType format=QLocale::LongFormat) const
static QStringList availableCalendars()
QString dateTimeToString(QStringView format, const QDateTime &datetime, QDate dateOnly, QTime timeOnly, const QLocale &locale) const
QString monthName(const QLocale &locale, int month, int year=Unspecified, QLocale::FormatType format=QLocale::LongFormat) const
YearMonthDay partsFromDate(QDate date) const
int maximumMonthsInYear() const
int maximumDaysInMonth() const
int monthsInYear(int year) const
int dayOfWeek(QDate date) const
bool isLeapYear(int year) const
QString standaloneWeekDayName(const QLocale &locale, int day, QLocale::FormatType format=QLocale::LongFormat) const
int daysInMonth(int month, int year=Unspecified) const
int daysInYear(int year) const
QString weekDayName(const QLocale &locale, int day, QLocale::FormatType format=QLocale::LongFormat) const
The QDate class provides date functions.
constexpr bool isValid() const
constexpr qint64 toJulianDay() const
static constexpr QDate fromJulianDay(qint64 jd_)
The QDateTime class provides date and time functions.
template< typename Enum > size_t qHash(QFlags< Enum > flags, size_t seed=0) noexcept
template< typename Enum > bool operator==(Enum lhs, QFlags< Enum > rhs)
The QGregorianCalendar class implements the Gregorian calendar.
static QStringList nameList()
key_iterator keyEnd() const noexcept
const_iterator cbegin() const noexcept
qsizetype size() const noexcept
bool contains(const Key &key) const noexcept
key_iterator keyBegin() const noexcept
T value(const Key &key) const noexcept
const_iterator cend() const noexcept
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 QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal.
The QMilankovicCalendar class provides Milanković calendar system implementation.
static QStringList nameList()
The QReadLocker class is a convenience class that simplifies locking and unlocking read-write locks f...
The QReadWriteLock class provides read-write locking.
The QString class provides a Unicode character string.
The QStringList class provides a list of strings.
The QStringView class provides a unified view on UTF-16 strings with a read-only subset of the QStrin...
The QTime class provides clock time functions.
The QWriteLocker class is a convenience class that simplifies locking and unlocking read-write locks ...
const QCalendarBackend * fromEnum(QCalendar::System system)
QStringList availableCalendars()
const QCalendarBackend * fromName(QAnyStringView name)
void registerCustomBackend(QCalendarBackend *backend, const QStringList &names)
bool isGregorian(const QCalendarBackend *backend) const
bool isBeingDestroyed() const
const QCalendarBackend * fromIndex(size_t index)
QStringList backendNames(const QCalendarBackend *backend)
const QCalendarBackend * gregorian()
qDeleteAll(list.begin(), list.end())
constexpr Int qMod(Int a, unsigned b)
Q_GLOBAL_STATIC(QtPrivate::QCalendarRegistry, calendarRegistry)
QList< QString > QStringList
GLsizei const GLfloat * v
[13]
GLint GLsizei GLsizei GLenum format
CalendarName(const QString &name)