24#include <tqdatetime.h>
30#include "kcalendarsystemgregorian.h"
32KCalendarSystemGregorian::KCalendarSystemGregorian(
const TDELocale * locale)
37KCalendarSystemGregorian::~KCalendarSystemGregorian()
41int KCalendarSystemGregorian::year(
const TQDate& date)
const
46int KCalendarSystemGregorian::monthsInYear(
const TQDate & date )
const
53int KCalendarSystemGregorian::weeksInYear(
int year)
const
56 temp.setYMD(year, 12, 31);
60 if ( temp.weekNumber() == 1 )
61 temp = temp.addDays(-7);
63 return temp.weekNumber();
66int KCalendarSystemGregorian::weekNumber(
const TQDate& date,
69 return date.weekNumber(yearNum);
72TQString KCalendarSystemGregorian::monthName(
const TQDate& date,
75 return monthName(month(date), year(date), shortName);
78TQString KCalendarSystemGregorian::monthNamePossessive(
const TQDate& date,
bool shortName)
const
80 return monthNamePossessive(month(date), year(date), shortName);
83TQString KCalendarSystemGregorian::monthName(
int month,
int year,
bool shortName)
const
144 return TQString::null;
147TQString KCalendarSystemGregorian::monthNamePossessive(
int month,
int year,
148 bool shortName)
const
209 return TQString::null;
212bool KCalendarSystemGregorian::setYMD(TQDate & date,
int y,
int m,
int d)
const
215 if ( y >= 0 && y <= 99 )
219 return date.setYMD(y, m, d);
222TQDate KCalendarSystemGregorian::addYears(
const TQDate & date,
int nyears)
const
224 return date.addYears(nyears);
227TQDate KCalendarSystemGregorian::addMonths(
const TQDate & date,
int nmonths)
const
229 return date.addMonths(nmonths);
232TQDate KCalendarSystemGregorian::addDays(
const TQDate & date,
int ndays)
const
234 return date.addDays(ndays);
237TQString KCalendarSystemGregorian::weekDayName(
int col,
bool shortName)
const
245TQString KCalendarSystemGregorian::weekDayName(
const TQDate& date,
bool shortName)
const
247 return weekDayName(dayOfWeek(date), shortName);
251int KCalendarSystemGregorian::dayOfWeek(
const TQDate& date)
const
253 return date.dayOfWeek();
256int KCalendarSystemGregorian::dayOfYear(
const TQDate & date)
const
258 return date.dayOfYear();
261int KCalendarSystemGregorian::daysInMonth(
const TQDate& date)
const
263 return date.daysInMonth();
276int KCalendarSystemGregorian::day(
const TQDate& date)
const
281int KCalendarSystemGregorian::month(
const TQDate& date)
const
286int KCalendarSystemGregorian::daysInYear(
const TQDate& date)
const
288 return date.daysInYear();
298 return TQString::fromLatin1(
"gregorian");
316int KCalendarSystemGregorian::yearStringToInteger(
const TQString & sNum,
int & iLength)
const
325 else if (iYear < 100)
CalendarSystem abstract class, default derived kde gregorian class and factory class.
virtual int maxValidYear() const =0
Gets the maximum year value supported by specific calendar type algorithms (TQDate,...
virtual TQString weekDayName(int weekDay, bool shortName=false) const =0
Gets specific calendar type week day name If an invalid week day is specified, TQString::null is retu...
virtual bool isLunisolar() const =0
Gets if the calendar is lunisolar based.
virtual int weekDayOfPray() const =0
Gets the day of the week traditionaly associated with pray.
virtual int yearStringToInteger(const TQString &sNum, int &iLength) const
Converts a year literal of a part of a string into a integer starting at the beginning of the string.
virtual bool isSolar() const =0
Gets if the calendar is solar based.
virtual TQString calendarName() const =0
Gets the string representing the calendar.
virtual int minValidYear() const =0
Gets the first year value supported by specific calendar type algorithms.
virtual bool isLunar() const =0
Gets if the calendar is lunar based.
const TDELocale * locale() const
Gets the locale the calendar uses for translations.
TDELocale provides support for country specific stuff like the national language.
TQString translate(const char *index) const
Translates the string into the corresponding string in the national language, if available.