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
qromancalendar.cpp
Go to the documentation of this file.
1// Copyright (C) 2020 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#include "qglobal.h"
7
9
10/*!
11 \since 5.14
12 \internal
13
14 \class QRomanCalendar
15 \inmodule QtCore
16 \brief The QRomanCalendar class is a shared base for calendars based on the
17 ancient Roman calendar.
18
19 Calendars based on the ancient Roman calendar have several common properties:
20 they have the same names for months, the month lengths depend in a common
21 way on whether the year is a leap year. They differ in how they determine
22 which years are leap years.
23
24 \sa QGregorianCalendar, QJulianCalendar, QMilankovicCalendar
25*/
26
27int QRomanCalendar::daysInMonth(int month, int year) const
28{
29 if (!year || month < 1 || month > 12)
30 return 0;
31
32 if (month == 2)
33 return year == QCalendar::Unspecified || isLeapYear(year) ? 29 : 28;
34
35 // Long if odd up to July = 7, or if even from 8 = August onwards:
36 return 30 | ((month & 1) ^ (month >> 3));
37}
38
39int QRomanCalendar::minimumDaysInMonth() const
40{
41 return 28;
42}
43
44bool QRomanCalendar::isLunar() const
45{
46 return false;
47}
48
49bool QRomanCalendar::isLuniSolar() const
50{
51 return false;
52}
53
54bool QRomanCalendar::isSolar() const
55{
56 return true;
57}
58
59const QCalendarLocale *QRomanCalendar::localeMonthIndexData() const
60{
61 return QtPrivate::Roman::locale_data;
62}
63
64const char16_t *QRomanCalendar::localeMonthData() const
65{
66 return QtPrivate::Roman::months_data;
67}
68
69QT_END_NAMESPACE
Combined button and popup list for selecting options.