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

KDECore

Public Member Functions | Protected Member Functions
KCalendarSystemGregorian Class Reference

#include <kcalendarsystemgregorian_p.h>

Inheritance diagram for KCalendarSystemGregorian:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 KCalendarSystemGregorian (const KLocale *locale=0)
 KCalendarSystemGregorian (const KSharedConfig::Ptr config, const KLocale *locale=0)
virtual ~KCalendarSystemGregorian ()
virtual QString calendarType () 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 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 yearStringToInteger (const QString &sNum, int &iLength) const

Protected Member Functions

 KCalendarSystemGregorian (KCalendarSystemGregorianPrivate &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

Detailed Description

This is the pure Gregorian calendar implementation.

Note: This is a proleptic version of the Gregorian calendar, it does not copy the QDate method of using the Julian Calendar for dates before 15 October 1582. This is the traditional proleptic Gregorian calendar that does not have a year 0, unlike the ISO version which does.

license GNU-LGPL v.2 or later

See also:
KLocale,KCalendarSystem
Author:
John Layt <john@layt.net>

Constructor & Destructor Documentation

KCalendarSystemGregorian::KCalendarSystemGregorian ( const KLocale *  locale = 0) [explicit]

Definition at line 387 of file kcalendarsystemgregorian.cpp.

KCalendarSystemGregorian::KCalendarSystemGregorian ( const KSharedConfig::Ptr  config,
const KLocale *  locale = 0 
) [explicit]

Definition at line 393 of file kcalendarsystemgregorian.cpp.

KCalendarSystemGregorian::~KCalendarSystemGregorian ( ) [virtual]

Definition at line 408 of file kcalendarsystemgregorian.cpp.

KCalendarSystemGregorian::KCalendarSystemGregorian ( KCalendarSystemGregorianPrivate &  dd,
const KSharedConfig::Ptr  config = KSharedConfig::Ptr(),
const KLocale *  locale = 0 
) [protected]

Definition at line 400 of file kcalendarsystemgregorian.cpp.


Member Function Documentation

QString KCalendarSystemGregorian::calendarType ( ) const [virtual]
Deprecated:
use calendarSystem() instead

Returns the calendar system type.

Returns:
type of calendar system

Implements KCalendarSystem.

Reimplemented in KCalendarSystemJapanese, KCalendarSystemMinguo, and KCalendarSystemThai.

Definition at line 412 of file kcalendarsystemgregorian.cpp.

bool KCalendarSystemGregorian::dateToJulianDay ( int  year,
int  month,
int  day,
int &  jd 
) const [protected, 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:
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.

Reimplemented in KCalendarSystemJapanese, KCalendarSystemMinguo, and KCalendarSystemThai.

Definition at line 534 of file kcalendarsystemgregorian.cpp.

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

Reimplemented in KCalendarSystemJapanese, KCalendarSystemMinguo, and KCalendarSystemThai.

Definition at line 422 of file kcalendarsystemgregorian.cpp.

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

Reimplemented in KCalendarSystemJapanese, KCalendarSystemMinguo, and KCalendarSystemThai.

Definition at line 417 of file kcalendarsystemgregorian.cpp.

bool KCalendarSystemGregorian::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.

Reimplemented in KCalendarSystemJapanese, KCalendarSystemMinguo, and KCalendarSystemThai.

Definition at line 446 of file kcalendarsystemgregorian.cpp.

bool KCalendarSystemGregorian::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.

Reimplemented in KCalendarSystemJapanese, KCalendarSystemMinguo, and KCalendarSystemThai.

Definition at line 451 of file kcalendarsystemgregorian.cpp.

bool KCalendarSystemGregorian::isLunar ( ) const [virtual]

Returns whether the calendar is lunar based.

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

Implements KCalendarSystem.

Reimplemented in KCalendarSystemJapanese, KCalendarSystemMinguo, and KCalendarSystemThai.

Definition at line 486 of file kcalendarsystemgregorian.cpp.

bool KCalendarSystemGregorian::isLunisolar ( ) const [virtual]

Returns whether the calendar is lunisolar based.

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

Implements KCalendarSystem.

Reimplemented in KCalendarSystemJapanese, KCalendarSystemMinguo, and KCalendarSystemThai.

Definition at line 491 of file kcalendarsystemgregorian.cpp.

bool KCalendarSystemGregorian::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.

Reimplemented in KCalendarSystemJapanese, KCalendarSystemMinguo, and KCalendarSystemThai.

Definition at line 501 of file kcalendarsystemgregorian.cpp.

bool KCalendarSystemGregorian::isSolar ( ) const [virtual]

Returns whether the calendar is solar based.

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

Implements KCalendarSystem.

Reimplemented in KCalendarSystemJapanese, KCalendarSystemMinguo, and KCalendarSystemThai.

Definition at line 496 of file kcalendarsystemgregorian.cpp.

bool KCalendarSystemGregorian::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.

Reimplemented in KCalendarSystemJapanese, KCalendarSystemMinguo, and KCalendarSystemThai.

Definition at line 436 of file kcalendarsystemgregorian.cpp.

bool KCalendarSystemGregorian::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.

Reimplemented in KCalendarSystemJapanese, KCalendarSystemMinguo, and KCalendarSystemThai.

Definition at line 441 of file kcalendarsystemgregorian.cpp.

bool KCalendarSystemGregorian::julianDayToDate ( int  jd,
int &  year,
int &  month,
int &  day 
) const [protected, 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:
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.

Reimplemented in KCalendarSystemJapanese, KCalendarSystemMinguo, and KCalendarSystemThai.

Definition at line 506 of file kcalendarsystemgregorian.cpp.

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

Reimplemented in KCalendarSystemJapanese, KCalendarSystemMinguo, and KCalendarSystemThai.

Definition at line 428 of file kcalendarsystemgregorian.cpp.

QString KCalendarSystemGregorian::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.

Reimplemented in KCalendarSystemJapanese, and KCalendarSystemMinguo.

Definition at line 456 of file kcalendarsystemgregorian.cpp.

QString KCalendarSystemGregorian::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.

Reimplemented in KCalendarSystemJapanese, and KCalendarSystemMinguo.

Definition at line 461 of file kcalendarsystemgregorian.cpp.

QString KCalendarSystemGregorian::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.

Reimplemented in KCalendarSystemJapanese, and KCalendarSystemMinguo.

Definition at line 466 of file kcalendarsystemgregorian.cpp.

QString KCalendarSystemGregorian::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.

Reimplemented in KCalendarSystemJapanese, and KCalendarSystemMinguo.

Definition at line 471 of file kcalendarsystemgregorian.cpp.

int KCalendarSystemGregorian::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.

Reimplemented in KCalendarSystemJapanese, KCalendarSystemMinguo, and KCalendarSystemThai.

Definition at line 481 of file kcalendarsystemgregorian.cpp.

int KCalendarSystemGregorian::yearStringToInteger ( const QString &  sNum,
int &  iLength 
) const [virtual]
Deprecated:
for internal use only

Converts a year literal of a part of a string into a integer starting at the beginning of the string

Parameters:
sNumThe string to parse
iLengthThe number of QChars used, and 0 if no valid symbols was found in the string
Returns:
An integer corresponding to the year

Reimplemented from KCalendarSystem.

Reimplemented in KCalendarSystemJapanese.

Definition at line 476 of file kcalendarsystemgregorian.cpp.


The documentation for this class was generated from the following files:
  • kcalendarsystemgregorian_p.h
  • kcalendarsystemgregorian.cpp

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

Skip menu "kdelibs"
  • 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
Generated for kdelibs by doxygen 1.7.5
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal