kcalendarsystem.h
00001 #ifndef KCALENDARSYSTEM 00002 #define KCALENDARSYSTEM 00003 00004 #include <qdatetime.h> 00005 #include <qstring.h> 00006 00017 class KCalendarSystem 00018 { 00019 public: 00020 KCalendarSystem () 00021 { 00022 } 00023 virtual ~ KCalendarSystem () 00024 { 00025 } 00026 00033 virtual QString monthName (const QDate & date, bool shortName = false ) = 0; 00034 00041 virtual int year (const QDate & date) = 0; 00042 00043 00050 virtual int month (const QDate & date) = 0; 00051 00058 virtual QString formatDate (const QDate & date) = 0; 00059 00065 virtual void nextMonthDate (QDate & date) = 0; 00066 00071 virtual void previousMonthDate (QDate & date) = 0; 00072 00077 virtual void nextYearDate (QDate & date) = 0; 00078 00084 virtual void previousYearDate (QDate & date) = 0; 00085 00092 virtual int monthsInYear (int year) = 0; 00093 00100 virtual QString monthName (int month) = 0; 00101 00108 virtual void constructDateInMonth (QDate & date, int month) = 0; 00109 00116 virtual void constructDateInYear (QDate & date, int year) = 0; 00117 00124 virtual QDate parseDate (QString text) = 0; 00125 00133 virtual QString weekDayName (int col, bool shortName = false) = 0; 00134 00141 virtual int dayOfTheWeek (const QDate & date) = 0; 00142 00149 virtual int numberOfDaysInMonth (const QDate & date) = 0; 00150 00157 virtual int numberOfDaysPrevMonth (const QDate & date) = 0; 00158 00164 virtual int maxValidYear () = 0; 00165 00172 virtual int day (const QDate & date) = 0; 00173 00180 virtual int numberOfDayInYear (const QDate & date) = 0; 00181 00187 virtual int weekDayOfPray () = 0; 00188 00192 virtual void printType () = 0; 00193 }; 00194 00198 class KCalendarSystemGregorian:public KCalendarSystem 00199 { 00200 public: 00201 KCalendarSystemGregorian (); 00202 virtual ~ KCalendarSystemGregorian (); 00203 00204 QString monthName (const QDate & date, bool shortName); 00205 int year (const QDate & date); 00206 int month (const QDate & date); 00207 QString formatDate (const QDate & date); 00208 void nextMonthDate (QDate & date); 00209 void previousMonthDate (QDate & date); 00210 void nextYearDate (QDate & date); 00211 void previousYearDate (QDate & date); 00212 int monthsInYear (int year); 00213 QString monthName (int month); 00214 void constructDateInMonth (QDate & date, int month); 00215 void constructDateInYear (QDate & date, int year); 00216 QDate parseDate (QString text); 00217 QString weekDayName (int col, bool shortName); 00218 int dayOfTheWeek (const QDate & date); 00219 int numberOfDaysInMonth (const QDate & date); 00220 int numberOfDaysPrevMonth (const QDate & date); 00221 int maxValidYear (); 00222 int day (const QDate & date); 00223 int numberOfDayInYear (const QDate & date); 00224 virtual int weekDayOfPray (); 00225 00226 void printType (); 00227 }; 00228 00232 class KCalendarSystemFactory 00233 { 00234 public: 00235 KCalendarSystemFactory (); 00236 ~KCalendarSystemFactory (); 00237 00244 static KCalendarSystem *create (const QString & calType = "gregorian"); 00245 00246 private: 00250 static QString calTy[]; 00251 }; 00252 00253 #endif 00254 // Best regards ;)