Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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
18#include "qromancalendar_p.h"
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
52
53#endif // QGREGORIAN_CALENDAR_P_H
\inmodule QtCore \reentrant
Definition qdatetime.h:29
The QGregorianCalendar class implements the Gregorian calendar.
The QRomanCalendar class is a shared base for calendars based on the ancient Roman calendar.
\inmodule QtCore
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
QDate date
[1]
Combined button and popup list for selecting options.
GLuint name
long long qint64
Definition qtypes.h:60