20 #include "kcalendarsystemthai_p.h" 21 #include "kcalendarsystemgregorianprivate_p.h" 29 class KCalendarSystemThaiPrivate :
public KCalendarSystemGregorianPrivate
32 KDELIBS4SUPPORT_DEPRECATED
explicit KCalendarSystemThaiPrivate(KCalendarSystemThai *q);
33 virtual ~KCalendarSystemThaiPrivate();
35 void loadDefaultEraList()
override;
36 int daysInMonth(
int year,
int month)
const override;
37 int daysInYear(
int year)
const override;
38 bool isLeapYear(
int year)
const override;
39 bool hasYearZero()
const override;
40 int earliestValidYear()
const override;
45 KCalendarSystemThaiPrivate::KCalendarSystemThaiPrivate(KCalendarSystemThai *q)
46 : KCalendarSystemGregorianPrivate(q)
50 KCalendarSystemThaiPrivate::~KCalendarSystemThaiPrivate()
54 void KCalendarSystemThaiPrivate::loadDefaultEraList()
58 name =
i18nc(
"Calendar Era: Thai Buddhist Era, years > 0, LongFormat",
"Buddhist Era");
59 shortName =
i18nc(
"Calendar Era: Thai Buddhist Era, years > 0, ShortFormat",
"BE");
60 format =
i18nc(
"(kdedt-format) Thai, BE, full era year format used for %EY, e.g. 2000 BE",
"%Ey %EC");
61 addEra(
'+', 1, q->epoch(), 1, q->latestValidDate(), name, shortName, format);
64 int KCalendarSystemThaiPrivate::daysInMonth(
int year,
int month)
const 66 return KCalendarSystemGregorianPrivate::daysInMonth(year - 543, month);
69 int KCalendarSystemThaiPrivate::daysInYear(
int year)
const 71 return KCalendarSystemGregorianPrivate::daysInYear(year - 543);
74 bool KCalendarSystemThaiPrivate::isLeapYear(
int year)
const 76 return KCalendarSystemGregorianPrivate::isLeapYear(year - 543);
79 bool KCalendarSystemThaiPrivate::hasYearZero()
const 84 int KCalendarSystemThaiPrivate::earliestValidYear()
const 89 KCalendarSystemThai::KCalendarSystemThai(
const KSharedConfig::Ptr config,
const KLocale *
locale)
90 : KCalendarSystemGregorian(*new KCalendarSystemThaiPrivate(this), config, locale)
95 KCalendarSystemThai::KCalendarSystemThai(KCalendarSystemThaiPrivate &dd,
96 const KSharedConfig::Ptr config,
const KLocale *locale)
97 : KCalendarSystemGregorian(dd, config, locale)
102 KCalendarSystemThai::~KCalendarSystemThai()
106 QString KCalendarSystemThai::calendarType()
const 116 QDate KCalendarSystemThai::epoch()
const 122 QDate KCalendarSystemThai::earliestValidDate()
const 127 QDate KCalendarSystemThai::latestValidDate()
const 134 bool KCalendarSystemThai::isLunar()
const 136 return KCalendarSystemGregorian::isLunar();
139 bool KCalendarSystemThai::isLunisolar()
const 141 return KCalendarSystemGregorian::isLunisolar();
144 bool KCalendarSystemThai::isSolar()
const 146 return KCalendarSystemGregorian::isSolar();
149 bool KCalendarSystemThai::isProleptic()
const 154 bool KCalendarSystemThai::julianDayToDate(qint64 jd,
int &
year,
int &
month,
int &
day)
const 156 bool result = KCalendarSystemGregorian::julianDayToDate(jd, year, month, day);
161 bool KCalendarSystemThai::dateToJulianDay(
int year,
int month,
int day, qint64 &jd)
const 163 return KCalendarSystemGregorian::dateToJulianDay(year - 543, month, day, jd);
QString name(const QVariant &location)
virtual int day(const QDate &date) const
Returns the day portion of a given date in the current calendar system.
virtual QDate epoch() const =0
Returns a QDate holding the epoch of the calendar system.
QString i18nc(const char *context, const char *text, const TYPE &arg...)
virtual int month(const QDate &date) const
Returns the month portion of a given date in the current calendar system.
const KLocale * locale() const
Returns the locale used for translations and formats for this calendar system instance.
virtual int year(const QDate &date) const
Returns the year portion of a given date in the current calendar system.
KLocale provides support for language and country specific stuff.
QDate fromJulianDay(qint64 jd)
virtual QString calendarType() const =0
Thai Calendar, aka Buddhist or Thai Buddhist.