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()) | |
QString | countryCode() const |
QString | description() const |
bool | isHoliday(const QDate &date) const |
bool | isValid() const |
QString | languageCode() const |
QString | name() const |
KHolidays::Holiday::List | rawHolidays(const QDate &startDate, const QDate &endDate) const |
KHolidays::Holiday::List | rawHolidays(const QDate &startDate, const QDate &endDate, const QString &category) const |
KHolidays::Holiday::List | rawHolidaysWithAstroSeasons(const QDate &date) const |
KHolidays::Holiday::List | rawHolidaysWithAstroSeasons(int calendarYear) const |
KHolidays::Holiday::List | rawHolidaysWithAstroSeasons(const QDate &startDate, const QDate &endDate) const |
QString | regionCode() const |
Static Public Members
QString | countryCode(const QString ®ionCode) |
QString | defaultRegionCode(const QString &country = QString(), const QString &language = QString()) |
QString | description(const QString ®ionCode) |
bool | isValid(const QString ®ionCode) |
QString | languageCode(const QString ®ionCode) |
QString | name(const QString ®ionCode) |
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.
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
[static]
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().
[static]
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.
QString HolidayRegion::description() const
Return the description of the Holiday Region if available
[static]
QString HolidayRegion::description(const QString ®ionCode)
Return the description of a given Holiday Region if available
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]
bool HolidayRegion::isValid(const QString ®ionCode)
Returns whether the Region Code is valid.
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).
[static]
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().
QString HolidayRegion::name() const
Return the name of the Holiday Region. This may be a country, region, or type.
[static]
QString HolidayRegion::name(const QString ®ionCode)
Return the name of a given Holiday Region
regionCode The code for the Holiday Region.
KHolidays::Holiday::List HolidayRegion::rawHolidays(const QDate &startDate, const QDate &endDate) const
Returns the list of holidays that occur between startDate and endDate.
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.
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.
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.
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.
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
[static]
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.
See also name() and languageCode().