1// qcalendar.sip generated by MetaSIP
2//
3// This file is part of the QtCore Python extension module.
4//
5// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
6//
7// This file is part of PyQt5.
8//
9// This file may be used under the terms of the GNU General Public License
10// version 3.0 as published by the Free Software Foundation and appearing in
11// the file LICENSE included in the packaging of this file.  Please review the
12// following information to ensure the GNU General Public License version 3.0
13// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
14//
15// If you do not wish to use this file under the terms of the GPL version 3.0
16// then you may purchase a commercial license.  For more information contact
17// info@riverbankcomputing.com.
18//
19// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
20// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21
22
23%If (Qt_5_14_0 -)
24
25class QCalendar
26{
27%TypeHeaderCode
28#include <qcalendar.h>
29%End
30
31public:
32    enum
33    {
34        Unspecified,
35    };
36
37    struct YearMonthDay
38    {
39%TypeHeaderCode
40#include <qcalendar.h>
41%End
42
43        YearMonthDay();
44        YearMonthDay(int year, int month = 1, int day = 1);
45        bool isValid() const;
46        int year;
47        int month;
48        int day;
49    };
50
51    enum class System
52    {
53        Gregorian,
54        Julian,
55        Milankovic,
56        Jalali,
57        IslamicCivil,
58    };
59
60    QCalendar();
61    explicit QCalendar(QCalendar::System system);
62    explicit QCalendar(const char *name /Encoding="Latin-1"/) [(QLatin1String name)];
63%MethodCode
64        // This is currently the only occurence of a QLatin1String argument.
65        sipCpp = new QCalendar(QLatin1String(a0));
66%End
67
68    int daysInMonth(int month, int year = QCalendar::Unspecified) const;
69    int daysInYear(int year) const;
70    int monthsInYear(int year) const;
71    bool isDateValid(int year, int month, int day) const;
72    bool isLeapYear(int year) const;
73    bool isGregorian() const;
74    bool isLunar() const;
75    bool isLuniSolar() const;
76    bool isSolar() const;
77    bool isProleptic() const;
78    bool hasYearZero() const;
79    int maximumDaysInMonth() const;
80    int minimumDaysInMonth() const;
81    int maximumMonthsInYear() const;
82    QString name() const;
83    QDate dateFromParts(int year, int month, int day) const;
84    QDate dateFromParts(const QCalendar::YearMonthDay &parts) const;
85    QCalendar::YearMonthDay partsFromDate(QDate date) const;
86    int dayOfWeek(QDate date) const;
87    QString monthName(const QLocale &locale, int month, int year = QCalendar::Unspecified, QLocale::FormatType format = QLocale::LongFormat) const;
88    QString standaloneMonthName(const QLocale &locale, int month, int year = QCalendar::Unspecified, QLocale::FormatType format = QLocale::LongFormat) const;
89    QString weekDayName(const QLocale &locale, int day, QLocale::FormatType format = QLocale::LongFormat) const;
90    QString standaloneWeekDayName(const QLocale &locale, int day, QLocale::FormatType format = QLocale::LongFormat) const;
91    QString dateTimeToString(const QString &format, const QDateTime &datetime, const QDate &dateOnly, const QTime &timeOnly, const QLocale &locale) const;
92%MethodCode
93        // QStringView has issues being implemented as a mapped type.
94        sipRes = new QString(sipCpp->dateTimeToString(QStringView(*a0), *a1, *a2, *a3, *a4));
95%End
96
97    static QStringList availableCalendars();
98};
99
100%End
101