KDECore
KCalendarSystem Class Reference
KCalendarSystem abstract base class, provides support for local Calendar Systems in KDE. More...
#include <kcalendarsystem.h>

Public Types | |
enum | MonthNameFormat { ShortName, LongName, ShortNamePossessive, LongNamePossessive } |
enum | StringFormat { ShortFormat, LongFormat } |
enum | WeekDayNameFormat { ShortDayName, LongDayName } |
Public Member Functions | |
virtual QDate | addDays (const QDate &date, int ndays) const |
virtual QDate | addMonths (const QDate &date, int nmonths) const |
virtual QDate | addYears (const QDate &date, int nyears) const |
virtual QString | calendarType () const =0 |
virtual int | day (const QDate &date) const |
virtual int | dayOfWeek (const QDate &date) const |
virtual int | dayOfYear (const QDate &date) const |
virtual int | daysInMonth (const QDate &date) const |
virtual int | daysInWeek (const QDate &date) const |
virtual int | daysInYear (const QDate &date) const |
virtual QString | dayString (const QDate &pDate, StringFormat format=LongFormat) const |
virtual int | dayStringToInteger (const QString &sNum, int &iLength) const |
virtual QDate | earliestValidDate () const |
virtual QDate | epoch () const |
virtual QString | formatDate (const QDate &date, KLocale::DateFormat format=KLocale::LongDate) const |
virtual bool | isLeapYear (const QDate &date) const |
virtual bool | isLeapYear (int year) const =0 |
virtual bool | isLunar () const =0 |
virtual bool | isLunisolar () const =0 |
virtual bool | isProleptic () const =0 |
virtual bool | isSolar () const =0 |
virtual bool | isValid (const QDate &date) const |
virtual bool | isValid (int year, int month, int day) const =0 |
KCalendarSystem (const KLocale *locale=0) | |
virtual QDate | latestValidDate () const |
virtual int | month (const QDate &date) const |
virtual QString | monthName (const QDate &date, MonthNameFormat format=LongName) const |
virtual QString | monthName (int month, int year, MonthNameFormat format=LongName) const =0 |
virtual int | monthsInYear (const QDate &date) const |
virtual QString | monthString (const QDate &pDate, StringFormat format=LongFormat) const |
virtual int | monthStringToInteger (const QString &sNum, int &iLength) const |
virtual QDate | readDate (const QString &str, KLocale::ReadDateFlags flags, bool *ok=0) const |
virtual QDate | readDate (const QString &intstr, const QString &format, bool *ok=0) const |
virtual QDate | readDate (const QString &str, bool *ok=0) const |
virtual bool | setDate (QDate &date, int year, int month, int day) const |
virtual bool | setYMD (QDate &date, int y, int m, int d) const |
virtual QString | weekDayName (const QDate &date, WeekDayNameFormat format=LongDayName) const |
virtual QString | weekDayName (int weekDay, WeekDayNameFormat format=LongDayName) const =0 |
virtual int | weekDayOfPray () const =0 |
virtual int | weekNumber (const QDate &date, int *yearNum=0) const |
virtual int | weeksInYear (int year) const |
virtual int | weeksInYear (const QDate &date) const |
virtual int | weekStartDay () const |
virtual int | year (const QDate &date) const |
virtual QString | yearString (const QDate &date, StringFormat format=LongFormat) const |
virtual int | yearStringToInteger (const QString &sNum, int &iLength) const |
virtual | ~KCalendarSystem () |
Static Public Member Functions | |
static QString | calendarLabel (const QString &calendarType) |
static QStringList | calendarSystems () |
static KCalendarSystem * | create (const QString &calType=QLatin1String("gregorian"), const KLocale *locale=0) |
Protected Member Functions | |
virtual bool | dateToJulianDay (int year, int month, int day, int &jd) const =0 |
virtual bool | julianDayToDate (int jd, int &year, int &month, int &day) const =0 |
const KLocale * | locale () const |
Detailed Description
KCalendarSystem abstract base class, provides support for local Calendar Systems in KDE.
Derived classes must be created through the create() static method
Definition at line 39 of file kcalendarsystem.h.
Member Enumeration Documentation
Format for returned month / day name.
- Enumerator:
Definition at line 54 of file kcalendarsystem.h.
Format for returned year number / month number / day number as string.
- Enumerator:
ShortFormat Short string format, e.g.
2000 = "00" or 6 = "6"
LongFormat Long string format, e.g.
2000 = "2000" or 6 = "06"
Definition at line 46 of file kcalendarsystem.h.
Format for returned month / day name.
Definition at line 64 of file kcalendarsystem.h.
Constructor & Destructor Documentation
KCalendarSystem::KCalendarSystem | ( | const KLocale * | locale = 0 |
) | [explicit] |
Constructor of abstract calendar class.
This will be called by derived classes.
- Parameters:
-
locale locale to use for translations. The global locale is used if null.
Definition at line 159 of file kcalendarsystem.cpp.
KCalendarSystem::~KCalendarSystem | ( | ) | [virtual] |
Destructor.
Definition at line 164 of file kcalendarsystem.cpp.
Member Function Documentation
QDate KCalendarSystem::addDays | ( | const QDate & | date, | |
int | ndays | |||
) | const [virtual] |
Returns a QDate containing a date ndays
days later.
- Parameters:
-
date The old date ndays number of days to add
- Returns:
- The new date, null date if any errors
Reimplemented in KCalendarSystemGregorian, KCalendarSystemHebrew, KCalendarSystemHijri, and KCalendarSystemJalali.
Definition at line 351 of file kcalendarsystem.cpp.
QDate KCalendarSystem::addMonths | ( | const QDate & | date, | |
int | nmonths | |||
) | const [virtual] |
Returns a QDate containing a date nmonths
months later.
- Parameters:
-
date The old date nmonths number of months to add
- Returns:
- The new date, null date if any errors
Reimplemented in KCalendarSystemGregorian, KCalendarSystemHebrew, KCalendarSystemHijri, and KCalendarSystemJalali.
Definition at line 310 of file kcalendarsystem.cpp.
QDate KCalendarSystem::addYears | ( | const QDate & | date, | |
int | nyears | |||
) | const [virtual] |
Returns a QDate containing a date nyears
years later.
- Parameters:
-
date The old date nyears The number of years to add
- Returns:
- The new date, null date if any errors
Reimplemented in KCalendarSystemGregorian, KCalendarSystemHebrew, KCalendarSystemHijri, and KCalendarSystemJalali.
Definition at line 281 of file kcalendarsystem.cpp.
Returns a typographically correct and translated label to display for the calendar system type.
Use with calendarSystems() to neatly format labels to display on combo widget of available calendar systems.
- Parameters:
-
calendarType the specific calendar type to return the label for
- Returns:
- label for calendar
Definition at line 67 of file kcalendarsystem.cpp.
QStringList KCalendarSystem::calendarSystems | ( | ) | [static] |
Gets a list of names of supported calendar systems.
- Returns:
- list of names
Definition at line 55 of file kcalendarsystem.cpp.
virtual QString KCalendarSystem::calendarType | ( | ) | const [pure virtual] |
Returns the calendar system type.
- Returns:
- type of calendar system
Implemented in KCalendarSystemGregorian, KCalendarSystemHebrew, KCalendarSystemHijri, and KCalendarSystemJalali.
KCalendarSystem * KCalendarSystem::create | ( | const QString & | calType = QLatin1String( "gregorian" ) , |
|
const KLocale * | locale = 0 | |||
) | [static] |
Creates specific calendar type.
- Parameters:
-
calType string identification of the specific calendar type to be constructed locale locale to use for translations. The global locale is used if null.
- Returns:
- a KCalendarSystem object
Definition at line 33 of file kcalendarsystem.cpp.
bool KCalendarSystem::dateToJulianDay | ( | int | year, | |
int | month, | |||
int | day, | |||
int & | jd | |||
) | const [protected, pure virtual] |
Internal method to convert YMD values for this calendar system into a Julian Day number.
All calendar system implementations MUST implement julianDayToDate and dateToJulianDay methods as all other methods can be expressed as functions of these. Does no internal validity checking.
- See also:
- KCalendarSystem::julianDayToDate
- Parameters:
-
year year number month month number day day of month jd Julian day number returned in this variable
- Returns:
true
if the date is valid,false
otherwise
Implemented in KCalendarSystemGregorian, KCalendarSystemHebrew, KCalendarSystemHijri, and KCalendarSystemJalali.
Definition at line 704 of file kcalendarsystem.cpp.
int KCalendarSystem::day | ( | const QDate & | date | ) | const [virtual] |
Returns the day portion of a given date in the current calendar system.
- Parameters:
-
date date to return day for
- Returns:
- day of the month, 0 if input date is invalid
Reimplemented in KCalendarSystemGregorian, KCalendarSystemHebrew, KCalendarSystemHijri, and KCalendarSystemJalali.
Definition at line 268 of file kcalendarsystem.cpp.
int KCalendarSystem::dayOfWeek | ( | const QDate & | date | ) | const [virtual] |
Returns the weekday number for the given date.
- Parameters:
-
date the date to obtain day from
- Returns:
- day of week number, -1 if input date not valid
Reimplemented in KCalendarSystemGregorian, KCalendarSystemHebrew, KCalendarSystemHijri, and KCalendarSystemJalali.
Definition at line 477 of file kcalendarsystem.cpp.
int KCalendarSystem::dayOfYear | ( | const QDate & | date | ) | const [virtual] |
Returns the day number of year for the given date.
- Parameters:
-
date the date to obtain day from
- Returns:
- day of year number, -1 if input date not valid
Reimplemented in KCalendarSystemGregorian, KCalendarSystemHebrew, KCalendarSystemHijri, and KCalendarSystemJalali.
Definition at line 462 of file kcalendarsystem.cpp.
int KCalendarSystem::daysInMonth | ( | const QDate & | date | ) | const [virtual] |
Returns the number of days in the given month.
- Parameters:
-
date the date to obtain month from
- Returns:
- number of days in month, -1 if input date invalid
Reimplemented in KCalendarSystemGregorian, KCalendarSystemHebrew, KCalendarSystemHijri, and KCalendarSystemJalali.
Definition at line 430 of file kcalendarsystem.cpp.
int KCalendarSystem::daysInWeek | ( | const QDate & | date | ) | const [virtual] |
Returns the number of days in the given week.
- Parameters:
-
date the date to obtain week from
- Returns:
- number of days in week, -1 if input date invalid
Reimplemented in KCalendarSystemGregorian, KCalendarSystemHebrew, KCalendarSystemHijri, and KCalendarSystemJalali.
Definition at line 456 of file kcalendarsystem.cpp.
int KCalendarSystem::daysInYear | ( | const QDate & | date | ) | const [virtual] |
Returns the number of days in the given year.
- Parameters:
-
date the date to obtain year from
- Returns:
- number of days in year, -1 if input date invalid
Reimplemented in KCalendarSystemGregorian, KCalendarSystemHebrew, KCalendarSystemHijri, and KCalendarSystemJalali.
Definition at line 413 of file kcalendarsystem.cpp.
QString KCalendarSystem::dayString | ( | const QDate & | pDate, | |
StringFormat | format = LongFormat | |||
) | const [virtual] |
Converts a date into a day literal.
- Parameters:
-
pDate The date to convert format The format to return, either short or long
- Returns:
- The day literal of the date, empty string if any error
Reimplemented in KCalendarSystemGregorian, KCalendarSystemHebrew, KCalendarSystemHijri, and KCalendarSystemJalali.
Definition at line 624 of file kcalendarsystem.cpp.
int KCalendarSystem::dayStringToInteger | ( | const QString & | sNum, | |
int & | iLength | |||
) | const [virtual] |
Converts a day literal of a part of a string into a integer starting at the beginning of the string.
- Parameters:
-
sNum The string to parse iLength The number of QChars used, and 0 if no valid symbols was found in the string
- Returns:
- An integer corresponding to the day
Reimplemented in KCalendarSystemGregorian, KCalendarSystemHebrew, KCalendarSystemHijri, and KCalendarSystemJalali.
Definition at line 651 of file kcalendarsystem.cpp.
QDate KCalendarSystem::earliestValidDate | ( | ) | const [virtual] |
Returns the earliest date valid in this calendar system implementation.
If the calendar system is proleptic then this may be before epoch.
- Returns:
- date the earliest valid date
Reimplemented in KCalendarSystemGregorian, KCalendarSystemHebrew, KCalendarSystemHijri, and KCalendarSystemJalali.
Definition at line 176 of file kcalendarsystem.cpp.
QDate KCalendarSystem::epoch | ( | ) | const [virtual] |
Returns a QDate holding the epoch of the calendar system.
Usually YMD of 1/1/1, access the returned QDates method toJulianDay() if you require the actual Julian day number. Note: a particular calendar system implementation may not include the epoch in its supported range, or the calendar system may be proleptic in which case it supports dates before the epoch.
- See also:
- KCalendarSystem::earliestValidDate
- KCalendarSystem::latestValidDate
- KCalendarSystem::isProleptic
- KCalendarSystem::isValid
- Returns:
- epoch of calendar system
Reimplemented in KCalendarSystemGregorian, KCalendarSystemHebrew, KCalendarSystemHijri, and KCalendarSystemJalali.
Definition at line 170 of file kcalendarsystem.cpp.
QString KCalendarSystem::formatDate | ( | const QDate & | date, | |
KLocale::DateFormat | format = KLocale::LongDate | |||
) | const [virtual] |
Returns a string formatted to the current locale's conventions regarding dates.
Uses the calendar system's internal locale set when the instance was created, which ensures that the correct calendar system and locale settings are respected, which would not occur in some cases if using the global locale. Defaults to global locale.
- See also:
- KLocale::formatDate
- Parameters:
-
date the date to be formatted format category of date format to use
- Returns:
- The date as a string
Reimplemented in KCalendarSystemGregorian, KCalendarSystemHebrew, KCalendarSystemHijri, and KCalendarSystemJalali.
Definition at line 656 of file kcalendarsystem.cpp.
bool KCalendarSystem::isLeapYear | ( | const QDate & | date | ) | const [virtual] |
Returns whether a given date falls in a leap year.
Input date must be checked for validity in current Calendar System prior to calling, no validity checking performed in this routine, behaviour is undefined in invalid case.
- Parameters:
-
date the date to check
- Returns:
true
if the date falls in a leap year,false
otherwise
Reimplemented in KCalendarSystemGregorian, KCalendarSystemHebrew, KCalendarSystemHijri, and KCalendarSystemJalali.
Definition at line 567 of file kcalendarsystem.cpp.
bool KCalendarSystem::isLeapYear | ( | int | year | ) | const [pure virtual] |
Returns whether a given year is a leap year.
Input year must be checked for validity in current Calendar System prior to calling, no validity checking performed in this routine, behaviour is undefined in invalid case.
- Parameters:
-
year the year to check
- Returns:
true
if the year is a leap year,false
otherwise
Implemented in KCalendarSystemGregorian, KCalendarSystemHebrew, KCalendarSystemHijri, and KCalendarSystemJalali.
Definition at line 545 of file kcalendarsystem.cpp.
virtual bool KCalendarSystem::isLunar | ( | ) | const [pure virtual] |
Returns whether the calendar is lunar based.
- Returns:
true
if the calendar is lunar based,false
if not
Implemented in KCalendarSystemGregorian, KCalendarSystemHebrew, KCalendarSystemHijri, and KCalendarSystemJalali.
virtual bool KCalendarSystem::isLunisolar | ( | ) | const [pure virtual] |
Returns whether the calendar is lunisolar based.
- Returns:
true
if the calendar is lunisolar based,false
if not
Implemented in KCalendarSystemGregorian, KCalendarSystemHebrew, KCalendarSystemHijri, and KCalendarSystemJalali.
virtual bool KCalendarSystem::isProleptic | ( | ) | const [pure virtual] |
Returns whether the calendar system is proleptic, i.e.
whether dates before the epoch are supported.
- See also:
- KCalendarSystem::epoch
- Returns:
true
if the calendar system is proleptic,false
if not
Implemented in KCalendarSystemGregorian, KCalendarSystemHebrew, KCalendarSystemHijri, and KCalendarSystemJalali.
virtual bool KCalendarSystem::isSolar | ( | ) | const [pure virtual] |
Returns whether the calendar is solar based.
- Returns:
true
if the calendar is solar based,false
if not
Implemented in KCalendarSystemGregorian, KCalendarSystemHebrew, KCalendarSystemHijri, and KCalendarSystemJalali.
bool KCalendarSystem::isValid | ( | const QDate & | date | ) | const [virtual] |
Returns whether a given date is valid in this calendar system.
- Parameters:
-
date the date to check
- Returns:
true
if the date is valid,false
otherwise
Reimplemented in KCalendarSystemGregorian, KCalendarSystemHebrew, KCalendarSystemHijri, and KCalendarSystemJalali.
Definition at line 216 of file kcalendarsystem.cpp.
bool KCalendarSystem::isValid | ( | int | year, | |
int | month, | |||
int | day | |||
) | const [pure virtual] |
Returns whether a given date is valid in this calendar system.
- Parameters:
-
year the year portion of the date to check month the month portion of the date to check day the day portion of the date to check
- Returns:
true
if the date is valid,false
otherwise
Implemented in KCalendarSystemGregorian, KCalendarSystemHebrew, KCalendarSystemHijri, and KCalendarSystemJalali.
Definition at line 189 of file kcalendarsystem.cpp.
bool KCalendarSystem::julianDayToDate | ( | int | jd, | |
int & | year, | |||
int & | month, | |||
int & | day | |||
) | const [protected, pure virtual] |
Internal method to convert a Julian Day number into the YMD values for this calendar system.
All calendar system implementations MUST implement julianDayToDate and dateToJulianDay methods as all other methods can be expressed as functions of these. Does no internal validity checking.
- See also:
- KCalendarSystem::dateToJulianDay
- Parameters:
-
jd Julian day number to convert to date year year number returned in this variable month month number returned in this variable day day of month returned in this variable
- Returns:
true
if the date is valid,false
otherwise
Implemented in KCalendarSystemGregorian, KCalendarSystemHebrew, KCalendarSystemHijri, and KCalendarSystemJalali.
Definition at line 686 of file kcalendarsystem.cpp.
QDate KCalendarSystem::latestValidDate | ( | ) | const [virtual] |
Returns the latest date valid in this calendar system implementation.
- Returns:
- date the latest valid date
Reimplemented in KCalendarSystemGregorian, KCalendarSystemHebrew, KCalendarSystemHijri, and KCalendarSystemJalali.
Definition at line 182 of file kcalendarsystem.cpp.
const KLocale * KCalendarSystem::locale | ( | ) | const [protected] |
Returns the locale used for translations and formats for this calendar system instance.
This allows a calendar system instance to be independent of the global translations and formats if required. All implementations must refer to this locale.
Only for internal calendar system use; if public access is required then provide public methods only for those methods actually required. Any app that creates an instance with its own locale overriding global will have the original handle to the locale and can manipulate it that way if required, e.g. to change default date format. Only expose those methods that library widgets require access to internally.
- See also:
- KCalendarSystem::formatDate
- KLocale::formatDate
- KCalendarSystem::weekStartDay
- KLocale::weekStartDay
- KCalendarSystem::readDate
- KLoacle::readDate
- Returns:
- locale to use
Definition at line 716 of file kcalendarsystem.cpp.
int KCalendarSystem::month | ( | const QDate & | date | ) | const [virtual] |
Returns the month portion of a given date in the current calendar system.
- Parameters:
-
date date to return month for
- Returns:
- month of year, 0 if input date is invalid
Reimplemented in KCalendarSystemGregorian, KCalendarSystemHebrew, KCalendarSystemHijri, and KCalendarSystemJalali.
Definition at line 255 of file kcalendarsystem.cpp.
QString KCalendarSystem::monthName | ( | const QDate & | date, | |
MonthNameFormat | format = LongName | |||
) | const [virtual] |
Gets specific calendar type month name for a given date.
- Parameters:
-
date date to obtain month from format specifies whether the short month name or long month name should be used
- Returns:
- name of the month, empty string if any error
Reimplemented in KCalendarSystemGregorian, KCalendarSystemHebrew, KCalendarSystemHijri, and KCalendarSystemJalali.
Definition at line 572 of file kcalendarsystem.cpp.
virtual QString KCalendarSystem::monthName | ( | int | month, | |
int | year, | |||
MonthNameFormat | format = LongName | |||
) | const [pure virtual] |
Gets specific calendar type month name for a given month number If an invalid month is specified, QString() is returned.
- Parameters:
-
month the month number year the year the month belongs to format specifies whether the short month name or long month name should be used
- Returns:
- name of the month, empty string if any error
Implemented in KCalendarSystemGregorian, KCalendarSystemHebrew, KCalendarSystemHijri, and KCalendarSystemJalali.
int KCalendarSystem::monthsInYear | ( | const QDate & | date | ) | const [virtual] |
Returns number of months in the given year.
- Parameters:
-
date the date to obtain year from
- Returns:
- number of months in the year, -1 if input date invalid
Reimplemented in KCalendarSystemGregorian, KCalendarSystemHebrew, KCalendarSystemHijri, and KCalendarSystemJalali.
Definition at line 365 of file kcalendarsystem.cpp.
QString KCalendarSystem::monthString | ( | const QDate & | pDate, | |
StringFormat | format = LongFormat | |||
) | const [virtual] |
Converts a date into a month literal.
- Parameters:
-
pDate The date to convert format The format to return, either short or long
- Returns:
- The month literal of the date, empty string if any error
Reimplemented in KCalendarSystemGregorian, KCalendarSystemHebrew, KCalendarSystemHijri, and KCalendarSystemJalali.
Definition at line 607 of file kcalendarsystem.cpp.
int KCalendarSystem::monthStringToInteger | ( | const QString & | sNum, | |
int & | iLength | |||
) | const [virtual] |
Converts a month literal of a part of a string into a integer starting at the beginning of the string.
- Parameters:
-
sNum The string to parse iLength The number of QChars used, and 0 if no valid symbols was found in the string
- Returns:
- An integer corresponding to the month
Reimplemented in KCalendarSystemGregorian, KCalendarSystemHebrew, KCalendarSystemHijri, and KCalendarSystemJalali.
Definition at line 646 of file kcalendarsystem.cpp.
QDate KCalendarSystem::readDate | ( | const QString & | str, | |
KLocale::ReadDateFlags | flags, | |||
bool * | ok = 0 | |||
) | const [virtual] |
Converts a localized date string to a QDate.
This method is stricter than readDate(str,&ok): it will either accept a date in full format or a date in short format, depending on flags
.
Uses the calendar system's internal locale set when the instance was created, which ensures that the correct calendar system and locale settings are respected, which would not occur in some cases if using the global locale. Defaults to global locale.
- See also:
- KLocale::readDate
- Parameters:
-
str the string to convert flags whether the date string is to be in full format or in short format ok if non-null, will be set to true
if the date is valid,false
if invalid
- Returns:
- the string converted to a QDate
Reimplemented in KCalendarSystemGregorian, KCalendarSystemHebrew, KCalendarSystemHijri, and KCalendarSystemJalali.
Definition at line 671 of file kcalendarsystem.cpp.
QDate KCalendarSystem::readDate | ( | const QString & | intstr, | |
const QString & | format, | |||
bool * | ok = 0 | |||
) | const [virtual] |
Converts a localized date string to a QDate, using the specified format
.
You will usually not want to use this method.
- See also:
- KLocale::readDate
Reimplemented in KCalendarSystemGregorian, KCalendarSystemHebrew, KCalendarSystemHijri, and KCalendarSystemJalali.
Definition at line 666 of file kcalendarsystem.cpp.
Converts a localized date string to a QDate.
The bool pointed by ok
will be false
if the date entered was invalid.
Uses the calendar system's internal locale set when the instance was created, which ensures that the correct calendar system and locale settings are respected, which would not occur in some cases if using the global locale. Defaults to global locale.
- See also:
- KLocale::readDate
- Parameters:
-
str the string to convert ok if non-null, will be set to true
if the date is valid,false
if invalid
- Returns:
- the string converted to a QDate
Reimplemented in KCalendarSystemGregorian, KCalendarSystemHebrew, KCalendarSystemHijri, and KCalendarSystemJalali.
Definition at line 661 of file kcalendarsystem.cpp.
bool KCalendarSystem::setDate | ( | QDate & | date, | |
int | year, | |||
int | month, | |||
int | day | |||
) | const [virtual] |
Changes the date's year, month and day.
The range of the year, month and day depends on which calendar is being used. All years entered are treated literally, i.e. no Y2K translation is applied to years entered in the range 00 to 99. Replaces setYMD.
- Parameters:
-
date date to change year year month month number day day of month
- Returns:
true
if the date is valid,false
otherwise
Reimplemented in KCalendarSystemGregorian, KCalendarSystemHebrew, KCalendarSystemHijri, and KCalendarSystemJalali.
Definition at line 224 of file kcalendarsystem.cpp.
bool KCalendarSystem::setYMD | ( | QDate & | date, | |
int | y, | |||
int | m, | |||
int | d | |||
) | const [virtual] |
Use setDate instead
- See also:
- KCalendarSystem::setDate
Some implementations reject year range 00 to 99, but extended date ranges now require these to be accepted. Equivalent in QDate is obsoleted.
Changes the date's year, month and day. The range of the year, month and day depends on which calendar is being used.
- Parameters:
-
date Date to change y Year m Month number d Day of month
- Returns:
- true if the date is valid; otherwise returns false.
Reimplemented in KCalendarSystemGregorian, KCalendarSystemHebrew, KCalendarSystemHijri, and KCalendarSystemJalali.
Definition at line 237 of file kcalendarsystem.cpp.
QString KCalendarSystem::weekDayName | ( | const QDate & | date, | |
WeekDayNameFormat | format = LongDayName | |||
) | const [virtual] |
Gets specific calendar type week day name.
- Parameters:
-
date the date format specifies whether the short month name or long month name should be used
- Returns:
- day name, empty string if any error
Reimplemented in KCalendarSystemGregorian, KCalendarSystemHebrew, KCalendarSystemHijri, and KCalendarSystemJalali.
Definition at line 581 of file kcalendarsystem.cpp.
virtual QString KCalendarSystem::weekDayName | ( | int | weekDay, | |
WeekDayNameFormat | format = LongDayName | |||
) | const [pure virtual] |
Gets specific calendar type week day name.
If an invalid week day is specified, QString() is returned.
- Parameters:
-
weekDay number of day in week (Monday = 1, ..., Sunday = 7) format specifies whether the short month name or long month name should be used
- Returns:
- day name, empty string if any error
Implemented in KCalendarSystemGregorian, KCalendarSystemHebrew, KCalendarSystemHijri, and KCalendarSystemJalali.
virtual int KCalendarSystem::weekDayOfPray | ( | ) | const [pure virtual] |
Returns the day of the week traditionally associated with religious observance for this calendar system.
Note this may not be accurate for the users locale, e.g. Gregorian calendar used in non-Christian countries, in use cases where this could be an issue it is recommended to use KLocale::weekDayOfPray() instead.
- Returns:
- day number (None = 0, Monday = 1, ..., Sunday = 7)
Implemented in KCalendarSystemGregorian, KCalendarSystemHebrew, KCalendarSystemHijri, and KCalendarSystemJalali.
int KCalendarSystem::weekNumber | ( | const QDate & | date, | |
int * | yearNum = 0 | |||
) | const [virtual] |
Returns the ISO week number for the given date.
ISO 8601 defines the first week of the year as the week containing the first Thursday. See http://en.wikipedia.org/wiki/ISO_8601 and http://en.wikipedia.org/wiki/ISO_week_date
If the date falls in the last week of the previous year or the first week of the following year, then the yearNum returned will be set to the appropriate year.
- Parameters:
-
date the date to obtain week from yearNum returns the year the date belongs to
- Returns:
- ISO week number, -1 if input date invalid
Reimplemented in KCalendarSystemGregorian, KCalendarSystemHebrew, KCalendarSystemHijri, and KCalendarSystemJalali.
Definition at line 492 of file kcalendarsystem.cpp.
int KCalendarSystem::weeksInYear | ( | int | year | ) | const [virtual] |
Returns the number of ISO weeks in the given year.
ISO 8601 defines the first week of the year as the week containing the first Thursday. See http://en.wikipedia.org/wiki/ISO_8601 and http://en.wikipedia.org/wiki/ISO_week_date
- Parameters:
-
year the year
- Returns:
- number of weeks in the year, -1 if input date invalid
Reimplemented in KCalendarSystemGregorian, KCalendarSystemHebrew, KCalendarSystemHijri, and KCalendarSystemJalali.
Definition at line 389 of file kcalendarsystem.cpp.
int KCalendarSystem::weeksInYear | ( | const QDate & | date | ) | const [virtual] |
Returns the number of ISO weeks in the given year.
- Parameters:
-
date the date to obtain year from
- Returns:
- number of weeks in the year, -1 if input date invalid
Reimplemented in KCalendarSystemGregorian, KCalendarSystemHebrew, KCalendarSystemHijri, and KCalendarSystemJalali.
Definition at line 380 of file kcalendarsystem.cpp.
int KCalendarSystem::weekStartDay | ( | ) | const [virtual] |
Use this to determine which day is the first day of the week.
Uses the calendar system's internal locale set when the instance was created, which ensures that the correct calendar system and locale settings are respected, which would not occur in some cases if using the global locale. Defaults to global locale.
- See also:
- KLocale::weekStartDay
- Returns:
- an integer (Monday = 1, ..., Sunday = 7)
Reimplemented in KCalendarSystemGregorian, KCalendarSystemHebrew, KCalendarSystemHijri, and KCalendarSystemJalali.
Definition at line 676 of file kcalendarsystem.cpp.
int KCalendarSystem::year | ( | const QDate & | date | ) | const [virtual] |
Returns the year portion of a given date in the current calendar system.
- Parameters:
-
date date to return year for
- Returns:
- year, 0 if input date is invalid
Reimplemented in KCalendarSystemGregorian, KCalendarSystemHebrew, KCalendarSystemHijri, and KCalendarSystemJalali.
Definition at line 242 of file kcalendarsystem.cpp.
QString KCalendarSystem::yearString | ( | const QDate & | date, | |
StringFormat | format = LongFormat | |||
) | const [virtual] |
Converts a date into a year literal.
- Parameters:
-
date date to convert format format to return, either short or long
- Returns:
- year literal of the date, empty string if any error
Reimplemented in KCalendarSystemGregorian, KCalendarSystemHebrew, KCalendarSystemHijri, and KCalendarSystemJalali.
Definition at line 590 of file kcalendarsystem.cpp.
int KCalendarSystem::yearStringToInteger | ( | const QString & | sNum, | |
int & | iLength | |||
) | const [virtual] |
Converts a year literal of a part of a string into a integer starting at the beginning of the string.
- Parameters:
-
sNum The string to parse iLength The number of QChars used, and 0 if no valid symbols was found in the string
- Returns:
- An integer corresponding to the year
Reimplemented in KCalendarSystemGregorian, KCalendarSystemHebrew, KCalendarSystemHijri, and KCalendarSystemJalali.
Definition at line 641 of file kcalendarsystem.cpp.
The documentation for this class was generated from the following files: