• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KDECore

Public Member Functions | Protected Member Functions | List of all members
KCalendarSystemQDate Class Reference

#include <kcalendarsystemqdate_p.h>

Inheritance diagram for KCalendarSystemQDate:
Inheritance graph
[legend]

Public Member Functions

 KCalendarSystemQDate (const KLocale *locale=0)
 
 KCalendarSystemQDate (const KSharedConfig::Ptr config, const KLocale *locale=0)
 
virtual ~KCalendarSystemQDate ()
 
virtual QString calendarType () const
 
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 daysInYear (const QDate &date) const
 
virtual QDate earliestValidDate () const
 
virtual QDate epoch () const
 
virtual bool isLeapYear (int year) const
 
virtual bool isLeapYear (const QDate &date) const
 
virtual bool isLunar () const
 
virtual bool isLunisolar () const
 
virtual bool isProleptic () const
 
virtual bool isSolar () const
 
virtual bool isValid (int year, int month, int day) const
 
virtual bool isValid (const QDate &date) const
 
virtual QDate latestValidDate () const
 
virtual int month (const QDate &date) const
 
virtual QString monthName (int month, int year, MonthNameFormat format=LongName) const
 
virtual QString monthName (const QDate &date, MonthNameFormat format=LongName) const
 
virtual QString weekDayName (int weekDay, WeekDayNameFormat format=LongDayName) const
 
virtual QString weekDayName (const QDate &date, WeekDayNameFormat format=LongDayName) const
 
virtual int weekDayOfPray () const
 
virtual int year (const QDate &date) const
 
- Public Member Functions inherited from KCalendarSystem
 KCalendarSystem (const KLocale *locale=0)
 
 KCalendarSystem (const KSharedConfig::Ptr config, const KLocale *locale=0)
 
virtual ~KCalendarSystem ()
 
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
 
int applyShortYearWindow (int inputYear) const
 
QString calendarLabel () const
 
KLocale::CalendarSystem calendarSystem () const
 
void dateDifference (const QDate &fromDate, const QDate &toDate, int *yearsDiff, int *monthsDiff, int *daysDiff, int *direction) const
 
QString dayOfWeekString (const QDate &pDate) const
 
QString dayOfYearString (const QDate &pDate, StringFormat format=LongFormat) const
 
int daysDifference (const QDate &fromDate, const QDate &toDate) const
 
int daysInMonth (int year, int month) const
 
QString daysInMonthString (const QDate &pDate, StringFormat format=LongFormat) const
 
virtual int daysInWeek (const QDate &date) const
 
QString daysInWeekString (const QDate &date) const
 
int daysInYear (int year) const
 
QString daysInYearString (const QDate &pDate, StringFormat format=LongFormat) const
 
virtual QString dayString (const QDate &pDate, StringFormat format=LongFormat) const
 
virtual int dayStringToInteger (const QString &sNum, int &iLength) const
 
QString eraName (const QDate &date, StringFormat format=ShortFormat) const
 
QString eraYear (const QDate &date, StringFormat format=ShortFormat) const
 
QDate firstDayOfMonth (int year, int month) const
 
QDate firstDayOfMonth (const QDate &date=QDate::currentDate()) const
 
QDate firstDayOfYear (int year) const
 
QDate firstDayOfYear (const QDate &date=QDate::currentDate()) const
 
virtual QString formatDate (const QDate &fromDate, KLocale::DateFormat toFormat=KLocale::LongDate) const
 
QString formatDate (const QDate &fromDate, const QString &toFormat, KLocale::DateTimeFormatStandard formatStandard=KLocale::KdeFormat) const
 
QString formatDate (const QDate &fromDate, const QString &toFormat, KLocale::DigitSet digitSet, KLocale::DateTimeFormatStandard formatStandard=KLocale::KdeFormat) const
 
QString formatDate (const QDate &date, KLocale::DateTimeComponent component, KLocale::DateTimeComponentFormat format=KLocale::DefaultComponentFormat, KLocale::WeekNumberSystem weekNumberSystem=KLocale::DefaultWeekNumber) const
 
void getDate (const QDate date, int *year, int *month, int *day) const
 
bool isValid (int year, int dayOfYear) const
 
bool isValid (const QString &eraName, int yearInEra, int month, int day) const
 
bool isValidIsoWeekDate (int year, int isoWeekNumber, int dayOfIsoWeek) const
 
QDate lastDayOfMonth (int year, int month) const
 
QDate lastDayOfMonth (const QDate &date=QDate::currentDate()) const
 
QDate lastDayOfYear (int year) const
 
QDate lastDayOfYear (const QDate &date=QDate::currentDate()) const
 
int monthsDifference (const QDate &fromDate, const QDate &toDate) const
 
virtual int monthsInYear (const QDate &date) const
 
int monthsInYear (int year) const
 
QString monthsInYearString (const QDate &pDate, StringFormat format=LongFormat) 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, bool *ok=0) const
 
virtual QDate readDate (const QString &str, KLocale::ReadDateFlags flags, bool *ok=0) const
 
virtual QDate readDate (const QString &dateString, const QString &dateFormat, bool *ok=0) const
 
QDate readDate (const QString &dateString, const QString &dateFormat, bool *ok, KLocale::DateTimeFormatStandard formatStandard) const
 
virtual bool setDate (QDate &date, int year, int month, int day) const
 
bool setDate (QDate &date, int year, int dayOfYear) const
 
bool setDate (QDate &date, QString eraName, int yearInEra, int month, int day) const
 
bool setDateIsoWeek (QDate &date, int year, int isoWeekNumber, int dayOfIsoWeek) const
 
virtual bool setYMD (QDate &date, int y, int m, int d) const
 
int shortYearWindowStartYear () const
 
int week (const QDate &date, int *yearNum=0) const
 
int week (const QDate &date, KLocale::WeekNumberSystem weekNumberSystem, int *yearNum=0) const
 
virtual int weekNumber (const QDate &date, int *yearNum=0) const
 
QString weekNumberString (const QDate &pDate, StringFormat format=LongFormat) const
 
virtual int weeksInYear (const QDate &date) const
 
int weeksInYear (const QDate &date, KLocale::WeekNumberSystem weekNumberSystem) const
 
virtual int weeksInYear (int year) const
 
int weeksInYear (int year, KLocale::WeekNumberSystem weekNumberSystem) const
 
QString weeksInYearString (const QDate &pDate, StringFormat format=LongFormat) const
 
virtual int weekStartDay () const
 
int yearInEra (const QDate &date) const
 
QString yearInEraString (const QDate &date, StringFormat format=ShortFormat) const
 
int yearsDifference (const QDate &fromDate, const QDate &toDate) const
 
virtual QString yearString (const QDate &date, StringFormat format=LongFormat) const
 
virtual int yearStringToInteger (const QString &sNum, int &iLength) const
 

Protected Member Functions

 KCalendarSystemQDate (KCalendarSystemQDatePrivate &dd, const KSharedConfig::Ptr config=KSharedConfig::Ptr(), const KLocale *locale=0)
 
virtual bool dateToJulianDay (int year, int month, int day, int &jd) const
 
virtual bool julianDayToDate (int jd, int &year, int &month, int &day) const
 
- Protected Member Functions inherited from KCalendarSystem
 KCalendarSystem (KCalendarSystemPrivate &dd, const KSharedConfig::Ptr config=KSharedConfig::Ptr(), const KLocale *locale=0)
 
const KLocale * locale () const
 
void setHasYear0 (bool hasYear0)
 
void setMaxDaysInWeek (int maxDays)
 
void setMaxMonthsInYear (int maxMonths)
 

Additional Inherited Members

- Public Types inherited from KCalendarSystem
enum  MonthNameFormat {
  ShortName, LongName, ShortNamePossessive, LongNamePossessive,
  NarrowName
}
 
enum  StringFormat { ShortFormat, LongFormat }
 
enum  WeekDayNameFormat { ShortDayName, LongDayName, NarrowDayName }
 
- Static Public Member Functions inherited from KCalendarSystem
static QString calendarLabel (const QString &calendarType)
 
static QString calendarLabel (KLocale::CalendarSystem calendarSystem, const KLocale *locale=KGlobal::locale())
 
static KLocale::CalendarSystem calendarSystem (const QString &calendarType)
 
static KLocale::CalendarSystem calendarSystemForCalendarType (const QString &calendarType)
 
static QStringList calendarSystems ()
 
static QList
< KLocale::CalendarSystem > 
calendarSystemsList ()
 
static QString calendarType (KLocale::CalendarSystem calendarSystem)
 
static KCalendarSystem * create (const QString &calType=QLatin1String("gregorian"), const KLocale *locale=0)
 
static KCalendarSystem * create (const QString &calType, KSharedConfig::Ptr config, const KLocale *locale=0)
 
static KCalendarSystem * create (KLocale::CalendarSystem calendarSystem, const KLocale *locale=0)
 
static KCalendarSystem * create (KLocale::CalendarSystem calendarSystem, KSharedConfig::Ptr config, const KLocale *locale=0)
 

Detailed Description

This is the QDate calendar implementation which combines the Julian and Gregorian calculations into a single calendar. It should always be used by default in Qt applications for consistency.

license GNU-LGPL v.2+

See also
KLocale,KCalendarSystem
Author
John Layt john@.nosp@m.layt.nosp@m..net

Definition at line 41 of file kcalendarsystemqdate_p.h.

Constructor & Destructor Documentation

KCalendarSystemQDate::KCalendarSystemQDate ( const KLocale *  locale = 0)
explicit

Definition at line 391 of file kcalendarsystemqdate.cpp.

KCalendarSystemQDate::KCalendarSystemQDate ( const KSharedConfig::Ptr  config,
const KLocale *  locale = 0 
)
explicit

Definition at line 397 of file kcalendarsystemqdate.cpp.

KCalendarSystemQDate::~KCalendarSystemQDate ( )
virtual

Definition at line 409 of file kcalendarsystemqdate.cpp.

KCalendarSystemQDate::KCalendarSystemQDate ( KCalendarSystemQDatePrivate &  dd,
const KSharedConfig::Ptr  config = KSharedConfig::Ptr(),
const KLocale *  locale = 0 
)
protected

Definition at line 403 of file kcalendarsystemqdate.cpp.

Member Function Documentation

QString KCalendarSystemQDate::calendarType ( ) const
virtual
Deprecated:
use calendarSystem() instead

Returns the calendar system type.

Returns
type of calendar system

Implements KCalendarSystem.

Definition at line 413 of file kcalendarsystemqdate.cpp.

bool KCalendarSystemQDate::dateToJulianDay ( int  year,
int  month,
int  day,
int &  jd 
) const
protectedvirtual

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
yearyear number
monthmonth number
dayday of month
jdJulian day number returned in this variable
Returns
true if the date is valid, false otherwise

Implements KCalendarSystem.

Definition at line 553 of file kcalendarsystemqdate.cpp.

int KCalendarSystemQDate::day ( const QDate &  date) const
virtual

Returns the day portion of a given date in the current calendar system.

Parameters
datedate to return day for
Returns
day of the month, 0 if input date is invalid

Reimplemented from KCalendarSystem.

Definition at line 464 of file kcalendarsystemqdate.cpp.

int KCalendarSystemQDate::dayOfWeek ( const QDate &  date) const
virtual

Returns the weekday number for the given date.

The weekdays are numbered 1..7 for Monday..Sunday.

This value is not affected by the value of weekStartDay()

Parameters
datethe date to obtain day from
Returns
day of week number, -1 if input date not valid

Reimplemented from KCalendarSystem.

Definition at line 484 of file kcalendarsystemqdate.cpp.

int KCalendarSystemQDate::dayOfYear ( const QDate &  date) const
virtual

Returns the day number of year for the given date.

The days are numbered 1..daysInYear()

Parameters
datethe date to obtain day from
Returns
day of year number, -1 if input date not valid

Reimplemented from KCalendarSystem.

Definition at line 479 of file kcalendarsystemqdate.cpp.

int KCalendarSystemQDate::daysInMonth ( const QDate &  date) const
virtual

Returns the number of days in the given month.

Parameters
datethe date to obtain month from
Returns
number of days in month, -1 if input date invalid

Reimplemented from KCalendarSystem.

Definition at line 474 of file kcalendarsystemqdate.cpp.

int KCalendarSystemQDate::daysInYear ( const QDate &  date) const
virtual

Returns the number of days in the given year.

Parameters
datethe date to obtain year from
Returns
number of days in year, -1 if input date invalid

Reimplemented from KCalendarSystem.

Definition at line 469 of file kcalendarsystemqdate.cpp.

QDate KCalendarSystemQDate::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.

See also
KCalendarSystem::epoch
KCalendarSystem::latestValidDate
Returns
date the earliest valid date

Reimplemented from KCalendarSystem.

Definition at line 424 of file kcalendarsystemqdate.cpp.

QDate KCalendarSystemQDate::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 from KCalendarSystem.

Definition at line 418 of file kcalendarsystemqdate.cpp.

bool KCalendarSystemQDate::isLeapYear ( int  year) const
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
yearthe year to check
Returns
true if the year is a leap year, false otherwise

Implements KCalendarSystem.

Definition at line 489 of file kcalendarsystemqdate.cpp.

bool KCalendarSystemQDate::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
datethe date to check
Returns
true if the date falls in a leap year, false otherwise

Reimplemented from KCalendarSystem.

Definition at line 494 of file kcalendarsystemqdate.cpp.

bool KCalendarSystemQDate::isLunar ( ) const
virtual

Returns whether the calendar is lunar based.

Returns
true if the calendar is lunar based, false if not

Implements KCalendarSystem.

Definition at line 524 of file kcalendarsystemqdate.cpp.

bool KCalendarSystemQDate::isLunisolar ( ) const
virtual

Returns whether the calendar is lunisolar based.

Returns
true if the calendar is lunisolar based, false if not

Implements KCalendarSystem.

Definition at line 529 of file kcalendarsystemqdate.cpp.

bool KCalendarSystemQDate::isProleptic ( ) const
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

Implements KCalendarSystem.

Definition at line 539 of file kcalendarsystemqdate.cpp.

bool KCalendarSystemQDate::isSolar ( ) const
virtual

Returns whether the calendar is solar based.

Returns
true if the calendar is solar based, false if not

Implements KCalendarSystem.

Definition at line 534 of file kcalendarsystemqdate.cpp.

bool KCalendarSystemQDate::isValid ( int  year,
int  month,
int  day 
) const
virtual

Returns whether a given date is valid in this calendar system.

Parameters
yearthe year portion of the date to check
monththe month portion of the date to check
daythe day portion of the date to check
Returns
true if the date is valid, false otherwise

Implements KCalendarSystem.

Definition at line 439 of file kcalendarsystemqdate.cpp.

bool KCalendarSystemQDate::isValid ( const QDate &  date) const
virtual

Returns whether a given date is valid in this calendar system.

Parameters
datethe date to check
Returns
true if the date is valid, false otherwise

Reimplemented from KCalendarSystem.

Definition at line 449 of file kcalendarsystemqdate.cpp.

bool KCalendarSystemQDate::julianDayToDate ( int  jd,
int &  year,
int &  month,
int &  day 
) const
protectedvirtual

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
jdJulian day number to convert to date
yearyear number returned in this variable
monthmonth number returned in this variable
dayday of month returned in this variable
Returns
true if the date is valid, false otherwise

Implements KCalendarSystem.

Definition at line 544 of file kcalendarsystemqdate.cpp.

QDate KCalendarSystemQDate::latestValidDate ( ) const
virtual

Returns the latest date valid in this calendar system implementation.

See also
KCalendarSystem::epoch
KCalendarSystem::earliestValidDate
Returns
date the latest valid date

Reimplemented from KCalendarSystem.

Definition at line 431 of file kcalendarsystemqdate.cpp.

int KCalendarSystemQDate::month ( const QDate &  date) const
virtual

Returns the month portion of a given date in the current calendar system.

Parameters
datedate to return month for
Returns
month of year, 0 if input date is invalid

Reimplemented from KCalendarSystem.

Definition at line 459 of file kcalendarsystemqdate.cpp.

QString KCalendarSystemQDate::monthName ( int  month,
int  year,
MonthNameFormat  format = LongName 
) const
virtual

Gets specific calendar type month name for a given month number If an invalid month is specified, QString() is returned.

Parameters
monththe month number
yearthe year the month belongs to
formatspecifies whether the short month name or long month name should be used
Returns
name of the month, empty string if any error

Implements KCalendarSystem.

Definition at line 499 of file kcalendarsystemqdate.cpp.

QString KCalendarSystemQDate::monthName ( const QDate &  date,
MonthNameFormat  format = LongName 
) const
virtual

Gets specific calendar type month name for a given date.

Parameters
datedate to obtain month from
formatspecifies whether the short month name or long month name should be used
Returns
name of the month, empty string if any error

Reimplemented from KCalendarSystem.

Definition at line 504 of file kcalendarsystemqdate.cpp.

QString KCalendarSystemQDate::weekDayName ( int  weekDay,
WeekDayNameFormat  format = LongDayName 
) const
virtual

Gets specific calendar type week day name.

If an invalid week day is specified, QString() is returned.

Parameters
weekDaynumber of day in week (Monday = 1, ..., Sunday = 7)
formatspecifies whether the short month name or long month name should be used
Returns
day name, empty string if any error

Implements KCalendarSystem.

Definition at line 509 of file kcalendarsystemqdate.cpp.

QString KCalendarSystemQDate::weekDayName ( const QDate &  date,
WeekDayNameFormat  format = LongDayName 
) const
virtual

Gets specific calendar type week day name.

Parameters
datethe date
formatspecifies whether the short month name or long month name should be used
Returns
day name, empty string if any error

Reimplemented from KCalendarSystem.

Definition at line 514 of file kcalendarsystemqdate.cpp.

int KCalendarSystemQDate::weekDayOfPray ( ) const
virtual
Deprecated:
use KLocale::weekDayOfPray() instead

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)

Implements KCalendarSystem.

Definition at line 519 of file kcalendarsystemqdate.cpp.

int KCalendarSystemQDate::year ( const QDate &  date) const
virtual

Returns the year portion of a given date in the current calendar system.

Parameters
datedate to return year for
Returns
year, 0 if input date is invalid

Reimplemented from KCalendarSystem.

Definition at line 454 of file kcalendarsystemqdate.cpp.


The documentation for this class was generated from the following files:
  • kcalendarsystemqdate_p.h
  • kcalendarsystemqdate.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:22:12 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDECore

Skip menu "KDECore"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal