KHolidays::HolidayRegion

KHolidays::HolidayRegion Class Reference

#include <holidayregion.h>

Public Member Functions

 HolidayRegion (const QString &regionCode=QString())
 
 HolidayRegion (const QFileInfo &regionFile)
 
 ~HolidayRegion ()
 
QString countryCode () const
 
QString description () const
 
Holiday::List holidays (const QDate &startDate, const QDate &endDate) const
 
Holiday::List holidays (const QDate &date) const
 
Holiday::List holidays (int calendarYear) const
 
bool isHoliday (const QDate &date) const
 
bool isValid () const
 
QString languageCode () const
 
QString name () const
 
QString regionCode () const
 

Static Public Member Functions

static QString countryCode (const QString &regionCode)
 
static QString defaultRegionCode (const QString &country=QString(), const QString &language=QString())
 
static QString description (const QString &regionCode)
 
static bool isValid (const QString &regionCode)
 
static QString languageCode (const QString &regionCode)
 
static QString name (const QString &regionCode)
 
static QStringList regionCodes ()
 

Detailed Description

Represents a holiday region.

Definition at line 30 of file holidayregion.h.

Constructor & Destructor Documentation

HolidayRegion::HolidayRegion ( const QString regionCode = QString())
explicit

Creates a new Holiday Region object for a given standard Region Code.

Parameters
regionCodeThe code for the Holiday Region. If null or unknown, an empty instance will be created.

Definition at line 800 of file holidayregion.cpp.

HolidayRegion::HolidayRegion ( const QFileInfo regionFile)
explicit

Creates a new Holiday Region object from a given holiday file.

If file doesn't exist, an empty instance will be created.

Parameters
regionFileThe code for the Holiday Region.

Definition at line 805 of file holidayregion.cpp.

HolidayRegion::~HolidayRegion ( )

Destroys the holidays object.

Definition at line 810 of file holidayregion.cpp.

Member Function Documentation

QString HolidayRegion::countryCode ( ) const
Since
4.5

Return the ISO 3166 country code of the file

May be either just a country code ("US" = USA) or may include a regional identifier ("US-CA" = California). Returns "XX" if not a country.

See https://en.wikipedia.org/wiki/ISO_3166-2

Returns
the full region code of the file

Definition at line 834 of file holidayregion.cpp.

QString HolidayRegion::countryCode ( const QString regionCode)
static
Since
4.5

Return the ISO 3166 country code of a given Holiday Region

May be either just a country code ("US" = USA) or may include a regional identifier ("US-CA" = California). Returns "XX" if not a country.

See https://en.wikipedia.org/wiki/ISO_3166-2

Parameters
regionCodeThe code for the Holiday Region.
Returns
the full region code of the file

Definition at line 839 of file holidayregion.cpp.

QString HolidayRegion::defaultRegionCode ( const QString country = QString(),
const QString language = QString() 
)
static
Since
4.6

Return a reasonable default Holiday Region code

If a required country/language is not provided then the current KDE country/lanaguage is used.

Parameters
countryThe country to find a default Holiday Region for
languageThe lanaguage to find a default Holiday Region for
Returns
the full region code of the default file

Definition at line 1111 of file holidayregion.cpp.

QString HolidayRegion::description ( ) const
Since
4.5

Return the description of the Holiday Region if available

Returns
the description of the Holiday Region

Definition at line 1045 of file holidayregion.cpp.

QString HolidayRegion::description ( const QString regionCode)
static
Since
4.5

Return the description of a given Holiday Region if available

Returns
the description of the Holiday Region

Definition at line 1050 of file holidayregion.cpp.

Holiday::List HolidayRegion::holidays ( const QDate startDate,
const QDate endDate 
) const
Since
4.6

Returns the list of holidays that occur between startDate and endDate.

Definition at line 1071 of file holidayregion.cpp.

Holiday::List HolidayRegion::holidays ( const QDate date) const
Since
4.6

Returns the list of holidays that occur on a date.

Definition at line 1080 of file holidayregion.cpp.

Holiday::List HolidayRegion::holidays ( int  calendarYear) const
Since
4.6

Returns the list of holidays that occur in a Gregorian calendar year calendarYear.

Definition at line 1089 of file holidayregion.cpp.

bool HolidayRegion::isHoliday ( const QDate date) const

Checks whether there is any holiday defined for a date.

Definition at line 1098 of file holidayregion.cpp.

bool HolidayRegion::isValid ( ) const

Returns whether the instance contains any holiday data.

Definition at line 1060 of file holidayregion.cpp.

bool HolidayRegion::isValid ( const QString regionCode)
static
Since
4.5

Returns whether the Region Code is valid.

Definition at line 1065 of file holidayregion.cpp.

QString HolidayRegion::languageCode ( ) const
Since
4.5

Return the ISO 639-1 language code of the file

May be either just a language code ("en" = US English) or may include a country identifier ("en_GB" = British English).

Returns
the language code of the file

Definition at line 849 of file holidayregion.cpp.

QString HolidayRegion::languageCode ( const QString regionCode)
static
Since
4.5

Return the ISO 639-1 language code of a given Holiday Region

May be either just a language code ("en" = US English) or may include a country identifier ("en_GB" = British English).

Parameters
regionCodeThe code for the Holiday Region.
Returns
the language code of the file

Definition at line 854 of file holidayregion.cpp.

QString HolidayRegion::name ( ) const
Since
4.5

Return the name of the Holiday Region. This may be a country, region, or type.

Returns
the short name code of the file

Definition at line 864 of file holidayregion.cpp.

QString HolidayRegion::name ( const QString regionCode)
static
Since
4.5

Return the name of a given Holiday Region

Parameters
regionCodeThe code for the Holiday Region.
Returns
the name of the Holiday Region

Definition at line 1035 of file holidayregion.cpp.

QString HolidayRegion::regionCode ( ) const
Since
4.5

Returns the unique Holiday Region code.

Clients should not infer any meaning from the format of the code.

Returns
region code, or null if the instance was constructed with an unknown region

Definition at line 829 of file holidayregion.cpp.

QStringList HolidayRegion::regionCodes ( )
static
Since
4.5

Return a list of all available Holiday Region codes.

One of these can then be passed to the constructor for a new HolidayRegion object, or to name() or language() to obtain the name and language of the region.

See also
name()
languageCode()

Definition at line 815 of file holidayregion.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Sep 21 2020 22:58:08 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.