QtBase
v6.3.1
|
#include <qcalendarbackend_p.h>
Static Public Member Functions | |
static QStringList | availableCalendars () |
Protected Member Functions | |
virtual const QCalendarLocale * | localeMonthIndexData () const =0 |
virtual const char16_t * | localeMonthData () const =0 |
Friends | |
class | QCalendar |
class | QtPrivate::QCalendarRegistry |
|
virtual |
Destroys the calendar backend.
Each calendar backend, once instantiated and successfully registered by ID, shall exist until it is destroyed by the registry. Destroying a successfully-registered backend otherwise may leave existing QCalendar instances referencing the destroyed calendar, with undefined results.
If a backend has not been registered it may safely be deleted.
Definition at line 550 of file qcalendar.cpp.
|
static |
Returns a list of names of the available calendar systems. Any QCalendarBackend sub-class must be registered before being exposed to Date and Time APIs.
Definition at line 1013 of file qcalendar.cpp.
|
inline |
Each backend is allocated an ID when successfully registered. A backend whose calendarId() has isValid() {false} has not been registered; it also cannot be used, as it is not known to any of the available ways to create a QCalendar.
Definition at line 106 of file qcalendarbackend_p.h.
QCalendar::System QCalendarBackend::calendarSystem | ( | ) | const |
The calendar system of this calendar.
Definition at line 646 of file qcalendar.cpp.
|
virtual |
Returns a string representing a given date, time or date-time.
If datetime is specified and valid, it is used and both date and time format tokens are converted to appropriate representations of the parts of the datetime. Otherwise, if dateOnly is valid, only date format tokens are converted; else, if timeOnly is valid, only time format tokens are converted. If none are valid, an empty string is returned.
The specified locale influences how some format tokens are converted; for example, when substituting day and month names and their short-forms. For the supported formatting tokens, see QDate::toString() and QTime::toString(). As described above, the provided date, time and date-time determine which of these tokens are recognized: where these appear in format they are replaced by data. Any text in format not recognized as a format token is copied verbatim into the result string.
Definition at line 3319 of file qlocale.cpp.
|
pure virtual |
Computes the Julian day number corresponding to the specified year, month, and day. Returns true and sets jd if there is such a date in this calendar; otherwise, returns false.
Implemented in QMilankovicCalendar, QJulianCalendar, QJalaliCalendar, QIslamicCivilCalendar, and QGregorianCalendar.
|
virtual |
Returns the day of the week for the given Julian Day Number jd.
This is 1 for Monday through 7 for Sunday.
Calendars with intercallary days may return larger values for these intercallary days. They should avoid using 0 for any special purpose (it is already used in QDate::dayOfWeek() to mean an invalid date). The calendar should treat the numbers used as an enum
, whose values need not be contiguous, nor need they follow closely from the 1 through 7 of the usual returns. It suffices that weekDayName() can recognize each such number as identifying a distinct name, that it returns to identify the particular intercallary day.
This base implementation uses the day-numbering that various calendars have borrowed off the Hebrew calendar.
Definition at line 898 of file qcalendar.cpp.
|
pure virtual |
Returns number of days in the month number month, in year year.
An implementation should return 0 if the given year had no such month. If year is QCalendar::Unspecified, return the usual number of days for the month, in those years that include it.
Calendars with intercallary days may represent these as extra days of the preceding month, or as short months separate from the usual ones. In the former case, daysInMonth(month, year) should be the number of ordinary days in the month, although {isDateValid(year, month, day)} might return
true
for some larger values of day
.
Implemented in QRomanCalendar, QJalaliCalendar, and QHijriCalendar.
|
virtual |
Returns the total number of days in the year number year. Returns zero if there is no such year in this calendar.
This base implementation returns 366 for leap years and 365 for ordinary years.
Reimplemented in QHijriCalendar.
Definition at line 750 of file qcalendar.cpp.
|
virtual |
Returns true
if year number 0
is considered a valid year in this calendar. Otherwise returns false
.
Definition at line 808 of file qcalendar.cpp.
|
virtual |
Returns true
if the date specified by year, month, and day is valid for this calendar; otherwise returns false
. For example, the date 2018-04-19 is valid for the Gregorian calendar, but 2018-16-19 and 2018-04-38 are invalid.
Calendars with intercallary days may represent these as extra days of the preceding month or as short months separate from the usual ones. In the former case, a day value greater than {daysInMonth({month}, {year})} may be valid.
Definition at line 781 of file qcalendar.cpp.
bool QCalendarBackend::isGregorian | ( | ) | const |
Definition at line 622 of file qcalendar.cpp.
|
pure virtual |
Returns true
if the specified year is a leap year for this calendar.
Implemented in QMilankovicCalendar, QJulianCalendar, QJalaliCalendar, QIslamicCivilCalendar, and QGregorianCalendar.
|
pure virtual |
Returns true
if this calendar is a lunar calendar. Otherwise returns false
.
A lunar calendar is a calendar based upon the monthly cycles of the Moon's phases (synodic months). This contrasts with solar calendars, whose annual cycles are based only upon the solar year.
Implemented in QRomanCalendar, QJalaliCalendar, and QHijriCalendar.
|
pure virtual |
Returns true
if this calendar is a lunisolar calendar. Otherwise returns false
.
A lunisolar calendar is a calendar whose date indicates both the moon phase and the time of the solar year.
Implemented in QRomanCalendar, QJalaliCalendar, and QHijriCalendar.
|
virtual |
Returns true
if this calendar is a proleptic calendar. Otherwise returns false
.
A proleptic calendar results from allowing negative year numbers to indicate years before the nominal start of the calendar system.
Definition at line 796 of file qcalendar.cpp.
|
pure virtual |
Returns true
if this calendar is a solar calendar. Otherwise returns false
.
A solar calendar is a calendar whose dates indicate the season or almost equivalently the apparent position of the sun relative to the fixed stars. The Gregorian calendar, widely accepted as standard in the world, is an example of solar calendar.
Implemented in QRomanCalendar, QJalaliCalendar, and QHijriCalendar.
|
pure virtual |
Computes the year, month, and day in this calendar for the given Julian day number jd. If the given day falls outside this calendar's scope (e.g. before the start-date of a non-proleptic calendar), the returned structure's isValid() is false; otherwise, its year, month, and day fields provide this calendar's description of the date.
Implemented in QMilankovicCalendar, QJulianCalendar, QJalaliCalendar, QIslamicCivilCalendar, and QGregorianCalendar.
|
protectedpure virtual |
Implemented in QRomanCalendar, QJalaliCalendar, and QHijriCalendar.
|
protectedpure virtual |
Implemented in QRomanCalendar, QJalaliCalendar, and QHijriCalendar.
|
virtual |
Returns the maximum number of days in a month for any year.
This base implementation returns 31, as this is a common case.
For calendars with intercallary days, although daysInMonth() doesn't include the intercallary days in its count for an individual month, maximumDaysInMonth() should include intercallary days, so that it is the maximum value of day
for which {isDateValid(year, month, day)} can be true.
Reimplemented in QHijriCalendar.
Definition at line 826 of file qcalendar.cpp.
|
virtual |
Returns the maximum number of months possible in any year.
This base implementation returns 12, as this is a common case.
Definition at line 850 of file qcalendar.cpp.
|
virtual |
Returns the minimum number of days in any valid month of any valid year.
This base implementation returns 29, as this is a common case.
Reimplemented in QRomanCalendar.
Definition at line 838 of file qcalendar.cpp.
|
virtual |
Returns the name of the specified month in the given year for the chosen locale, using the given format to determine how complete the name is.
If year is Unspecified, return the name for the month that usually has this number within a typical year. Calendars with a leap month that isn't always the last may need to take account of the year to map the month number to the particular year's month with that number.
Reimplemented in QGregorianCalendar.
Definition at line 2981 of file qlocale.cpp.
|
virtual |
Returns the total number of months in the year number year. Returns zero if there is no such year in this calendar.
This base implementation returns 12 for any valid year.
Definition at line 763 of file qcalendar.cpp.
|
pure virtual |
Returns the primary name of the calendar.
Implemented in QMilankovicCalendar, QJulianCalendar, QJalaliCalendar, QIslamicCivilCalendar, and QGregorianCalendar.
QStringList QCalendarBackend::names | ( | ) | const |
Returns list of names this backend was registered with.
The list is a subset of the names passed to registerCustomBackend()
. Some names passed during the registration may not be associated with a backend if they were claimed by another backend first.
Definition at line 570 of file qcalendar.cpp.
QCalendar::SystemId QCalendarBackend::registerCustomBackend | ( | const QStringList & | names | ) |
Register this backend as a custom backend.
The backend should not already be registered. This method should only be called on objects that are completely initialized because they become available to other threads immediately. In particular, this function should not be called from backend constructors.
The backend is also registered by names passed in names. Only the names that are not already registered are associated with the backend. The name matching is case-insensitive. The list of names associated with the backend can be queried using names()
method after successful registration.
Returns the new ID assigned to this backend. If its isValid() is true
, the calendar registry has taken ownership of the object; this ID can then be used to create QCalendar
instances. Otherwise, registration failed and the caller is responsible for destruction of the backend, which shall not be available for use by QCalendar
. Failure should normally only happen if registration is attempted during program termination.
Definition at line 612 of file qcalendar.cpp.
|
virtual |
Returns the standalone name of the specified month in the chosen locale, using the specified format to determine how complete the name is.
If year is Unspecified, return the standalone name for the month that usually has this number within a typical year. Calendars with a leap month that isn't always the last may need to take account of the year to map the month number to the particular year's month with that number.
Reimplemented in QGregorianCalendar.
Definition at line 3016 of file qlocale.cpp.
|
virtual |
Returns the standalone name of the specified day of the week in the chosen locale, using the specified format to determine how complete the name is.
The base implementation handles day values from 1 to 7 using the standalone day names CLDR provides, which are suitable for calendards that use the same (Hebrew-derived) week as the Gregorian calendar.
Calendars whose dayOfWeek() returns a value outside the range from 1 to 7 need to reimplement this method to handle such extra week-day values. They can assume that day is a value returned by the same calendar's dayOfWeek().
Definition at line 3082 of file qlocale.cpp.
|
virtual |
Returns the name of the specified day of the week in the chosen locale, using the specified format to determine how complete the name is.
The base implementation handles day values from 1 to 7 using the day names CLDR provides, which are suitable for calendards that use the same (Hebrew-derived) week as the Gregorian calendar.
Calendars whose dayOfWeek() returns a value outside the range from 1 to 7 need to reimplement this method to handle such extra week-day values. They can assume that day is a value returned by the same calendar's dayOfWeek().
Definition at line 3053 of file qlocale.cpp.
|
friend |
Definition at line 96 of file qcalendarbackend_p.h.
|
friend |
Definition at line 97 of file qcalendarbackend_p.h.