KDECore
kcalendarsystemgregorian_p.h
Go to the documentation of this file.
00001 /* 00002 Copyright (c) 2002 Carlos Moro <cfmoro@correo.uniovi.es> 00003 Copyright (c) 2002 Hans Petter Bieker <bieker@kde.org> 00004 Copyright 2007, 2010 John Layt <john@layt.net> 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Library General Public 00008 License as published by the Free Software Foundation; either 00009 version 2 of the License, or (at your option) any later version. 00010 00011 This library is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 Library General Public License for more details. 00015 00016 You should have received a copy of the GNU Library General Public License 00017 along with this library; see the file COPYING.LIB. If not, write to 00018 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00019 Boston, MA 02110-1301, USA. 00020 */ 00021 00022 #ifndef KCALENDARSYSTEMGREGORIAN_H 00023 #define KCALENDARSYSTEMGREGORIAN_H 00024 00025 #include "kcalendarsystem.h" 00026 00027 class KCalendarSystemGregorianPrivate; 00028 00045 class KCalendarSystemGregorian: public KCalendarSystem 00046 { 00047 public: 00048 explicit KCalendarSystemGregorian ( const KLocale *locale = 0 ); 00049 explicit KCalendarSystemGregorian( const KSharedConfig::Ptr config, const KLocale *locale = 0 ); 00050 virtual ~KCalendarSystemGregorian (); 00051 00052 virtual QString calendarType() const; 00053 00054 virtual QDate epoch() const; 00055 virtual QDate earliestValidDate() const; 00056 virtual QDate latestValidDate() const; 00057 virtual bool isValid( int year, int month, int day ) const; 00058 virtual bool isValid( const QDate &date ) const; 00059 00060 virtual bool setDate( QDate &date, int year, int month, int day ) const; 00062 virtual bool setYMD( QDate &date, int year, int month, int day ) const; 00063 00064 virtual int year( const QDate &date ) const; 00065 virtual int month( const QDate &date ) const; 00066 virtual int day( const QDate &date ) const; 00067 00068 virtual QDate addYears( const QDate &date, int nyears ) const; 00069 virtual QDate addMonths( const QDate &date, int nmonths ) const; 00070 virtual QDate addDays( const QDate &date, int ndays ) const; 00071 00072 virtual int monthsInYear( const QDate &date ) const; 00073 virtual int weeksInYear( const QDate &date ) const; 00074 virtual int weeksInYear( int year ) const; 00075 virtual int daysInYear( const QDate &date ) const; 00076 virtual int daysInMonth( const QDate &date ) const; 00077 virtual int daysInWeek( const QDate &date ) const; 00078 00079 virtual int dayOfYear( const QDate &date ) const; 00080 virtual int dayOfWeek( const QDate &date ) const; 00081 00082 virtual int weekNumber( const QDate &date, int *yearNum = 0 ) const; 00083 00084 virtual bool isLeapYear( int year ) const; 00085 virtual bool isLeapYear( const QDate &date ) const; 00086 00087 virtual QString monthName( int month, int year, MonthNameFormat format = LongName ) const; 00088 virtual QString monthName( const QDate &date, MonthNameFormat format = LongName ) const; 00089 00090 virtual QString weekDayName( int weekDay, WeekDayNameFormat format = LongDayName ) const; 00091 virtual QString weekDayName( const QDate &date, WeekDayNameFormat format = LongDayName ) const; 00092 00093 virtual QString yearString( const QDate & pDate, StringFormat format = LongFormat ) const; 00094 virtual QString monthString( const QDate &pDate, StringFormat format = LongFormat ) const; 00095 virtual QString dayString( const QDate &pDate, StringFormat format = LongFormat ) const; 00096 00097 virtual int yearStringToInteger( const QString &sNum, int &iLength ) const; 00098 virtual int monthStringToInteger( const QString &sNum, int &iLength ) const; 00099 virtual int dayStringToInteger( const QString &sNum, int &iLength ) const; 00100 00101 virtual QString formatDate( const QDate &fromDate, KLocale::DateFormat toFormat = KLocale::LongDate ) const; 00102 00103 virtual QDate readDate( const QString &str, bool *ok = 0 ) const; 00104 virtual QDate readDate( const QString &dateString, const QString &dateFormat, bool *ok = 0 ) const; 00105 virtual QDate readDate( const QString &str, KLocale::ReadDateFlags flags, bool *ok = 0 ) const; 00106 00107 virtual int weekStartDay() const; 00108 virtual int weekDayOfPray () const; 00109 00110 virtual bool isLunar() const; 00111 virtual bool isLunisolar() const; 00112 virtual bool isSolar() const; 00113 virtual bool isProleptic() const; 00114 00115 protected: 00116 virtual bool julianDayToDate( int jd, int &year, int &month, int &day ) const; 00117 virtual bool dateToJulianDay( int year, int month, int day, int &jd ) const; 00118 KCalendarSystemGregorian( KCalendarSystemGregorianPrivate &dd, 00119 const KSharedConfig::Ptr config = KSharedConfig::Ptr(), 00120 const KLocale *locale = 0 ); 00121 00122 private: 00123 Q_DECLARE_PRIVATE( KCalendarSystemGregorian ) 00124 KCalendarSystemGregorianPrivate * const dont_use; // KDE5 remove, use shared d 00125 }; 00126 00127 #endif
KDE 4.6 API Reference