Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qgregoriancalendar_p.h
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
4#ifndef QGREGORIAN_CALENDAR_P_H
5#define QGREGORIAN_CALENDAR_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists for the convenience
12// of calendar implementations. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
19
20#include <optional>
21
23
24class Q_CORE_EXPORT QGregorianCalendar : public QRomanCalendar
25{
26 // TODO: provide static methods, called by the overrides, that can be called
27 // directly by QDate to optimize various parts.
28public:
29 // Calendar property:
30 QString name() const override;
31 static QStringList nameList();
32 // Date queries:
33 bool isLeapYear(int year) const override;
34 // Julian Day conversions:
35 bool dateToJulianDay(int year, int month, int day, qint64 *jd) const override;
36 QCalendar::YearMonthDay julianDayToDate(qint64 jd) const override;
37 qint64 matchCenturyToWeekday(const QCalendar::YearMonthDay &parts, int dow) const override;
38
39 // Static optimized versions for the benefit of QDate:
40 static int weekDayOfJulian(qint64 jd);
41 static bool leapTest(int year);
42 static int monthLength(int month, int year);
43 static bool validParts(int year, int month, int day);
44 static QCalendar::YearMonthDay partsFromJulian(qint64 jd);
45 static std::optional<qint64> julianFromParts(int year, int month, int day);
46 // Used internally:
47 static int yearStartWeekDay(int year);
48 static int yearSharingWeekDays(QDate date);
49};
50
51QT_END_NAMESPACE
52
53#endif // QGREGORIAN_CALENDAR_P_H
\inmodule QtCore
Definition qatomic.h:113
\macro Q_ATOMIC_INTnn_IS_SUPPORTED
Definition qatomic.h:124
The QCalendarBackend class provides basic calendaring functions.
The QGregorianCalendar class implements the Gregorian calendar.
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()
#define SAFE_D()
Q_GLOBAL_STATIC(QtPrivate::QCalendarRegistry, calendarRegistry)
#define CASE(E, member)
quint16 m_longMonthStandalone_size
QLocaleData::DataRange monthName(QLocale::FormatType type) const
quint16 m_shortMonthStandalone_idx
quint8 m_narrowMonthStandalone_size
quint8 m_shortMonthStandalone_size
quint16 m_longMonthStandalone_idx
quint16 m_narrowMonthStandalone_idx
QLocaleData::DataRange standaloneMonthName(QLocale::FormatType type) const
bool operator()(QAnyStringView lhs, QAnyStringView rhs) const
Definition qcalendar.cpp:31