KHolidays::HolidayRegion

Search for usage in LXR

KHolidays::HolidayRegion Class Reference

#include <holidayregion.h>

Public Member Functions

 HolidayRegion (const HolidayRegion &)
 
 HolidayRegion (const QFileInfo &regionFile)
 
 HolidayRegion (const QString &regionCode=QString())
 
 HolidayRegion (HolidayRegion &&)
 
 ~HolidayRegion ()
 
QString countryCode () const
 
QString description () const
 
bool isHoliday (const QDate &date) const
 
bool isValid () const
 
QString languageCode () const
 
QString name () const
 
HolidayRegionoperator= (const HolidayRegion &)
 
HolidayRegionoperator= (HolidayRegion &&)
 
Holiday::List rawHolidays (const QDate &startDate, const QDate &endDate) const
 
Holiday::List rawHolidays (const QDate &startDate, const QDate &endDate, const QString &category) const
 
Holiday::List rawHolidaysWithAstroSeasons (const QDate &date) const
 
Holiday::List rawHolidaysWithAstroSeasons (const QDate &startDate, const QDate &endDate) const
 
Holiday::List rawHolidaysWithAstroSeasons (int calendarYear) 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 31 of file holidayregion.h.

Constructor & Destructor Documentation

◆ HolidayRegion() [1/4]

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 118 of file holidayregion.cpp.

◆ HolidayRegion() [2/4]

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 123 of file holidayregion.cpp.

◆ HolidayRegion() [3/4]

HolidayRegion::HolidayRegion ( const HolidayRegion & )
default

Copy constructor.

Since
5.77

◆ HolidayRegion() [4/4]

HolidayRegion::HolidayRegion ( HolidayRegion && )
default

Move constructor.

Since
5.77

◆ ~HolidayRegion()

HolidayRegion::~HolidayRegion ( )
default

Destroys the holidays object.

Member Function Documentation

◆ countryCode() [1/2]

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 154 of file holidayregion.cpp.

◆ countryCode() [2/2]

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
Warning
This methods is expensive as it involves parsing the corresponding holiday definition file. Prefer HolidayRegion::countryCode().

Definition at line 159 of file holidayregion.cpp.

◆ defaultRegionCode()

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/language is used.

Parameters
countryThe country or region to find a default Holiday Region for. This can be either an ISO 3166-1 or ISO 3166-2 code.
languageThe language to find a default Holiday Region for
Returns
the full region code of the default file
Warning
This methods is expensive as it involves parsing all holiday definition files.

Definition at line 453 of file holidayregion.cpp.

◆ description() [1/2]

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 358 of file holidayregion.cpp.

◆ description() [2/2]

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 363 of file holidayregion.cpp.

◆ isHoliday()

bool HolidayRegion::isHoliday ( const QDate & date) const

Checks whether there is any holiday defined for a date.

Definition at line 429 of file holidayregion.cpp.

◆ isValid() [1/2]

bool HolidayRegion::isValid ( ) const

Returns whether the instance contains any holiday data.

Definition at line 373 of file holidayregion.cpp.

◆ isValid() [2/2]

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

Returns whether the Region Code is valid.

Definition at line 378 of file holidayregion.cpp.

◆ languageCode() [1/2]

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 169 of file holidayregion.cpp.

◆ languageCode() [2/2]

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
Warning
This methods is expensive as it involves parsing the corresponding holiday definition file. Prefer HolidayRegion::languageCode().

Definition at line 174 of file holidayregion.cpp.

◆ name() [1/2]

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 184 of file holidayregion.cpp.

◆ name() [2/2]

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 348 of file holidayregion.cpp.

◆ operator=() [1/2]

HolidayRegion & HolidayRegion::operator= ( const HolidayRegion & )
default

Assignment operator.

Since
5.77

◆ operator=() [2/2]

HolidayRegion & HolidayRegion::operator= ( HolidayRegion && )
default

Move Assignment operator.

Since
5.77

◆ rawHolidays() [1/2]

Holiday::List HolidayRegion::rawHolidays ( const QDate & startDate,
const QDate & endDate ) const
Since
5.97

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

Definition at line 393 of file holidayregion.cpp.

◆ rawHolidays() [2/2]

Holiday::List HolidayRegion::rawHolidays ( const QDate & startDate,
const QDate & endDate,
const QString & category ) const
Since
5.95

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

Definition at line 384 of file holidayregion.cpp.

◆ rawHolidaysWithAstroSeasons() [1/3]

Holiday::List HolidayRegion::rawHolidaysWithAstroSeasons ( const QDate & date) const
Since
5.95

Returns the list of holidays and astronomical season dates (equinoxes and solstices) that occur on a date.

Definition at line 411 of file holidayregion.cpp.

◆ rawHolidaysWithAstroSeasons() [2/3]

Holiday::List HolidayRegion::rawHolidaysWithAstroSeasons ( const QDate & startDate,
const QDate & endDate ) const
Since
5.95

Returns the list of holidays and astronomical season dates (equinoxes and solstices) that occur between startDate and endDate.

Definition at line 402 of file holidayregion.cpp.

◆ rawHolidaysWithAstroSeasons() [3/3]

Holiday::List HolidayRegion::rawHolidaysWithAstroSeasons ( int calendarYear) const
Since
5.95

Returns the list of holidays and astronomical season dates (equinoxes and solstices) that occur in a Gregorian calendar year calendarYear.

Definition at line 420 of file holidayregion.cpp.

◆ regionCode()

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 149 of file holidayregion.cpp.

◆ regionCodes()

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 135 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-2024 The KDE developers.
Generated on Fri Nov 8 2024 11:59:30 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.