KHolidays::HolidayRegion Class
Represents a holiday region. More...
Header: | #include <KHolidays/HolidayRegion> |
CMake: | find_package(KF6 REQUIRED COMPONENTS Holidays) target_link_libraries(mytarget PRIVATE KF6::Holidays) |
Public Functions
HolidayRegion(const QFileInfo ®ionFile) | |
HolidayRegion(const QString ®ionCode = QString()) | |
(since 4.5) QString | countryCode() const |
(since 4.5) QString | description() const |
bool | isHoliday(const QDate &date) const |
bool | isValid() const |
(since 4.5) QString | languageCode() const |
(since 4.5) QString | name() const |
(since 5.97) KHolidays::Holiday::List | rawHolidays(const QDate &startDate, const QDate &endDate) const |
(since 5.95) KHolidays::Holiday::List | rawHolidays(const QDate &startDate, const QDate &endDate, const QString &category) const |
(since 5.95) KHolidays::Holiday::List | rawHolidaysWithAstroSeasons(const QDate &date) const |
(since 5.95) KHolidays::Holiday::List | rawHolidaysWithAstroSeasons(int calendarYear) const |
(since 5.95) KHolidays::Holiday::List | rawHolidaysWithAstroSeasons(const QDate &startDate, const QDate &endDate) const |
(since 4.5) QString | regionCode() const |
Static Public Members
(since 4.5) QString | countryCode(const QString ®ionCode) |
(since 4.6) QString | defaultRegionCode(const QString &country = QString(), const QString &language = QString()) |
(since 4.5) QString | description(const QString ®ionCode) |
(since 4.5) bool | isValid(const QString ®ionCode) |
(since 4.5) QString | languageCode(const QString ®ionCode) |
(since 4.5) QString | name(const QString ®ionCode) |
(since 4.5) QStringList | regionCodes() |
Detailed Description
Member Function Documentation
[explicit]
HolidayRegion::HolidayRegion(const QFileInfo ®ionFile)
Creates a new Holiday Region object from a given holiday file. If file doesn't exist, an empty instance will be created.
regionFile The code for the Holiday Region.
[explicit]
HolidayRegion::HolidayRegion(const QString ®ionCode = QString())
Creates a new Holiday Region object for a given standard Region Code.
regionCode The code for the Holiday Region. If null or unknown, an empty instance will be created.
[since 4.5]
QString HolidayRegion::countryCode() const
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
This function was introduced in 4.5.
[static, since 4.5]
QString HolidayRegion::countryCode(const QString ®ionCode)
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
regionCode The code for the Holiday Region.
Warning: This methods is expensive as it involves parsing the corresponding holiday definition file. Prefer HolidayRegion::countryCode().
This function was introduced in 4.5.
[static, since 4.6]
QString HolidayRegion::defaultRegionCode(const QString &country = QString(), const QString &language = QString())
Return a reasonable default Holiday Region code
If a required country/language is not provided then the current KDE country/language is used.
country The country or region to find a default Holiday Region for. This can be either an ISO 3166-1 or ISO 3166-2 code.
language The 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.
This function was introduced in 4.6.
[since 4.5]
QString HolidayRegion::description() const
Return the description of the Holiday Region if available
This function was introduced in 4.5.
[static, since 4.5]
QString HolidayRegion::description(const QString ®ionCode)
Return the description of a given Holiday Region if available
This function was introduced in 4.5.
bool HolidayRegion::isHoliday(const QDate &date) const
Checks whether there is any holiday defined for a date.
bool HolidayRegion::isValid() const
Returns whether the instance contains any holiday data.
[static, since 4.5]
bool HolidayRegion::isValid(const QString ®ionCode)
Returns whether the Region Code is valid.
This function was introduced in 4.5.
[since 4.5]
QString HolidayRegion::languageCode() const
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).
This function was introduced in 4.5.
[static, since 4.5]
QString HolidayRegion::languageCode(const QString ®ionCode)
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).
regionCode The code for the Holiday Region.
Warning: This methods is expensive as it involves parsing the corresponding holiday definition file. Prefer HolidayRegion::languageCode().
This function was introduced in 4.5.
[since 4.5]
QString HolidayRegion::name() const
Return the name of the Holiday Region. This may be a country, region, or type.
This function was introduced in 4.5.
[static, since 4.5]
QString HolidayRegion::name(const QString ®ionCode)
Return the name of a given Holiday Region
regionCode The code for the Holiday Region.
This function was introduced in 4.5.
[since 5.97]
KHolidays::Holiday::List HolidayRegion::rawHolidays(const QDate &startDate, const QDate &endDate) const
Returns the list of holidays that occur between startDate and endDate.
This function was introduced in 5.97.
[since 5.95]
KHolidays::Holiday::List HolidayRegion::rawHolidays(const QDate &startDate, const QDate &endDate, const QString &category) const
Returns the list of holidays that occur between startDate and endDate and with category.
This function was introduced in 5.95.
[since 5.95]
KHolidays::Holiday::List HolidayRegion::rawHolidaysWithAstroSeasons(const QDate &date) const
Returns the list of holidays and astronomical season dates (equinoxes and solstices) that occur on a date.
This function was introduced in 5.95.
[since 5.95]
KHolidays::Holiday::List HolidayRegion::rawHolidaysWithAstroSeasons(int calendarYear) const
Returns the list of holidays and astronomical season dates (equinoxes and solstices) that occur in a Gregorian calendar year calendarYear.
This function was introduced in 5.95.
[since 5.95]
KHolidays::Holiday::List HolidayRegion::rawHolidaysWithAstroSeasons(const QDate &startDate, const QDate &endDate) const
Returns the list of holidays and astronomical season dates (equinoxes and solstices) that occur between startDate and endDate.
This function was introduced in 5.95.
[since 4.5]
QString HolidayRegion::regionCode() const
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
This function was introduced in 4.5.
[static, since 4.5]
QStringList HolidayRegion::regionCodes()
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.
This function was introduced in 4.5.
See also name() and languageCode().