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