File indexing completed on 2024-03-24 15:27:15

0001 /*
0002     Copyright 2009, 2010 John Layt <john@layt.net>
0003 
0004     This library is free software; you can redistribute it and/or
0005     modify it under the terms of the GNU Library General Public
0006     License as published by the Free Software Foundation; either
0007     version 2 of the License, or (at your option) any later version.
0008 
0009     This library is distributed in the hope that it will be useful,
0010     but WITHOUT ANY WARRANTY; without even the implied warranty of
0011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012     Library General Public License for more details.
0013 
0014     You should have received a copy of the GNU Library General Public License
0015     along with this library; see the file COPYING.LIB.  If not, write to
0016     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0017     Boston, MA 02110-1301, USA.
0018 */
0019 
0020 #ifndef KCALENDARSYSTEMJULIAN_H
0021 #define KCALENDARSYSTEMJULIAN_H
0022 
0023 #include "kcalendarsystem.h"
0024 
0025 class KCalendarSystemJulianPrivate;
0026 
0027 /**
0028  * @internal
0029  * This is the Julian calendar implementation.
0030  *
0031  * WARNING: This is a proleptic version of the Julian calendar, it does not
0032  * reflect the historic marking of leap years prior to 4 AD and always
0033  * uses New Style years with 1 Jan for the start of the year.
0034  *
0035  * @b license GNU-LGPL v.2 or later
0036  *
0037  * @see KLocale,KCalendarSystem
0038  *
0039  * @author John Layt <john@layt.net>
0040  */
0041 class KCalendarSystemJulian: public KCalendarSystem
0042 {
0043 public:
0044     KDELIBS4SUPPORT_DEPRECATED explicit KCalendarSystemJulian(const KSharedConfig::Ptr config, const KLocale *locale);
0045     ~KCalendarSystemJulian() override;
0046 
0047     QString calendarType() const override;
0048     KLocale::CalendarSystem calendarSystem() const override;
0049 
0050     QDate epoch() const override;
0051     QDate earliestValidDate() const override;
0052     QDate latestValidDate() const override;
0053 
0054     QString monthName(int month, int year, MonthNameFormat format = LongName) const override;
0055     QString monthName(const QDate &date, MonthNameFormat format = LongName) const override;
0056 
0057     QString weekDayName(int weekDay, WeekDayNameFormat format = LongDayName) const override;
0058     QString weekDayName(const QDate &date, WeekDayNameFormat format = LongDayName) const override;
0059 
0060     bool isLunar() const override;
0061     bool isLunisolar() const override;
0062     bool isSolar() const override;
0063     bool isProleptic() const override;
0064 
0065 protected:
0066     bool julianDayToDate(qint64 jd, int &year, int &month, int &day) const override;
0067     bool dateToJulianDay(int year, int month, int day, qint64 &jd) const override;
0068     KCalendarSystemJulian(KCalendarSystemJulianPrivate &dd, const KSharedConfig::Ptr config, const KLocale *locale);
0069 
0070 private:
0071     Q_DECLARE_PRIVATE(KCalendarSystemJulian)
0072 };
0073 
0074 #endif // KCALENDARSYSTEMJULIAN_H