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

source code of qtbase/src/corelib/time/qromancalendar.cpp