diff --git a/src/astroseasons.h b/src/astroseasons.h index af7fdda..ae14199 100644 --- a/src/astroseasons.h +++ b/src/astroseasons.h @@ -1,94 +1,93 @@ /* This file is part of the kholidays library. Copyright (c) 2004,2006-2007 Allen Winter This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KHOLIDAYS_ASTROSEASONS_H #define KHOLIDAYS_ASTROSEASONS_H +#include "kholidays_export.h" + +class QDate; +class QString; + +namespace KHolidays +{ + /** Represents and manages the Astronomical Seasons (solstices and equinoxes). For the purposes of this class, we sometimes use the shorthand of "Season" where we really mean "Astronomical Season". An Astronomical Season can be one of the following: - June solstice - December solstice - March equinox - September equinox A very good description of the astronomical seasons can be read at the Wikipedia, http://en.wikipedia.org/wiki/Seasons Note that this class represents the "Astronomical Seasons" and not the traditional "Seasons" which vary widely by culture. */ - -#include "kholidays_export.h" - -class QDate; -class QString; - -namespace KHolidays -{ - class KHOLIDAYS_EXPORT AstroSeasons //krazy:exclude=dpointer { public: enum Season { JuneSolstice, DecemberSolstice, MarchEquinox, SeptemberEquinox, None }; /** Return the season for the specified Gregorian date. The enum 'None' is returned if one of the supported seasons does not occur on the date. @param date compute the season for the specified Gregorian date. */ static Season seasonAtDate(const QDate &date); /** Return the season as a text string for the specified date. A null string is returned if one of the supported seasons does not occur on the date. @param date compute the season for the specified Gregorian date. */ static QString seasonNameAtDate(const QDate &date); /** Return the string representation of season. @param season astronomical season. */ static QString seasonName(Season season); }; } #endif diff --git a/src/holiday.h b/src/holiday.h index afadb27..c922ecb 100644 --- a/src/holiday.h +++ b/src/holiday.h @@ -1,152 +1,153 @@ /* This file is part of the kholidays library. Copyright (c) 2001 Cornelius Schumacher Copyright (c) 2004 Allen Winter Copyright (c) 2008 David Jarvie Copyright 2010 John Layt This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KHOLIDAYS_HOLIDAY_H #define KHOLIDAYS_HOLIDAY_H #include "kholidays_export.h" #include #include class QDate; class QString; namespace KHolidays { class HolidayPrivate; class HolidayRegion; +/** Represents a holiday event. */ class KHOLIDAYS_EXPORT Holiday { friend class HolidayRegion; friend class HolidayParserDriver; friend class HolidayParserDriverPlan; friend class HolidayParserDriverPlanOld; public: /** * A list of holiday descriptions. */ typedef QList List; /** * Describes the date type of the holiday. * If any of the holidays on a date are non-workdays types, then the entire day is non-working. */ enum DayType { Workday, ///< The holiday is a workday NonWorkday ///< The holiday is a real holiday }; /** * Creates an empty holiday. */ Holiday(); /** * Creates a holiday from an @p other holiday. */ Holiday(const Holiday &other); /** * Destroys the holiday object. */ ~Holiday(); /** * */ Holiday &operator=(const Holiday &other); /** * */ bool operator<(const Holiday &rhs) const; /** * */ bool operator>(const Holiday &rhs) const; /** * @since 4.6 * * Returns the observed start date of the holiday. */ QDate observedStartDate() const; /** * @since 4.6 * * Returns the observed end date of the holiday. */ QDate observedEndDate() const; /** * @since 4.6 * * Returns the duration of the holiday in days. */ int duration() const; /** * @since 5.0 * * Returns the name of the Holiday. * * @return the name of the Holiday */ QString name() const; /** * @since 5.0 * * Returns the description of the Holiday if available * * @return the description of the Holiday */ QString description() const; /** * Returns the day type of the holiday. */ DayType dayType() const; /** * @since 5.8 * * Returns a QStringList of categories for the Holiday. * If the Holiday has no categories then an empty list is returned. */ QStringList categoryList() const; private: QSharedDataPointer d; }; } #endif // KHOLIDAYS_HOLIDAY_H diff --git a/src/holidayregion.h b/src/holidayregion.h index 4b61b41..9e49558 100644 --- a/src/holidayregion.h +++ b/src/holidayregion.h @@ -1,246 +1,247 @@ /* This file is part of the kholidays library. Copyright (c) 2001 Cornelius Schumacher Copyright (c) 2004 Allen Winter Copyright (c) 2008 David Jarvie Copyright 2010 John Layt This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KHOLIDAYS_HOLIDAYREGION_H #define KHOLIDAYS_HOLIDAYREGION_H #include "kholidays_export.h" #include #include #include #include "holiday.h" class QDate; class QStringList; class QFileInfo; namespace KHolidays { +/** Represents a holiday region. */ class KHOLIDAYS_EXPORT HolidayRegion { public: /** * Creates a new Holiday Region object for a given standard Region Code. * * @param regionCode The code for the Holiday Region. * If null or unknown, an empty instance will be created. */ explicit HolidayRegion(const QString ®ionCode = QString()); /** * Creates a new Holiday Region object from a given holiday file. * If file doesn't exist, an empty instance will be created. * * @param regionFile The code for the Holiday Region. */ explicit HolidayRegion(const QFileInfo ®ionFile); /** * Destroys the holidays object. */ ~HolidayRegion(); /** * @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 name() * @see languageCode() */ static QStringList regionCodes(); /** * @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. * * @param country The country to find a default Holiday Region for * @param language The lanaguage to find a default Holiday Region for * @return the full region code of the default file */ static QString defaultRegionCode(const QString &country = QString(), const QString &language = QString()); /** * @since 4.5 * * Returns the unique Holiday Region code. * * Clients should not infer any meaning from the format of the code. * * @return region code, or null if the instance was constructed with * an unknown region */ QString regionCode() 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 http://en.wikipedia.org/wiki/ISO_3166-2 * * @return the full region code of the file */ QString countryCode() const; /** * @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 http://en.wikipedia.org/wiki/ISO_3166-2 * * @param regionCode The code for the Holiday Region. * @return the full region code of the file */ static QString countryCode(const QString ®ionCode); /** * @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). * * @return the language code of the file */ QString languageCode() const; /** * @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). * * @param regionCode The code for the Holiday Region. * @return the language code of the file */ static QString languageCode(const QString ®ionCode); /** * @since 4.5 * * Return the name of the Holiday Region. * This may be a country, region, or type. * * @return the short name code of the file */ QString name() const; /** * @since 4.5 * * Return the name of a given Holiday Region * * @param regionCode The code for the Holiday Region. * @return the name of the Holiday Region */ static QString name(const QString ®ionCode); /** * @since 4.5 * * Return the description of the Holiday Region if available * * @return the description of the Holiday Region */ QString description() const; /** * @since 4.5 * * Return the description of a given Holiday Region if available * * @return the description of the Holiday Region */ static QString description(const QString ®ionCode); /** * @since 4.6 * * Returns the list of holidays that occur between @p startDate and @p endDate. */ Holiday::List holidays(const QDate &startDate, const QDate &endDate) const; /** * @since 4.6 * * Returns the list of holidays that occur on a @p date. */ Holiday::List holidays(const QDate &date) const; /** * @since 4.6 * * Returns the list of holidays that occur in a Gregorian calendar year @p calendarYear. */ Holiday::List holidays(int calendarYear) const; /** * Checks whether there is any holiday defined for a @p date. */ bool isHoliday(const QDate &date) const; /** * Returns whether the instance contains any holiday data. */ bool isValid() const; /** * @since 4.5 * * Returns whether the Region Code is valid. */ static bool isValid(const QString ®ionCode); private: Q_DISABLE_COPY(HolidayRegion) class HolidayRegionPrivate; HolidayRegionPrivate *const d; }; } #endif // KHOLIDAYS_HOLIDAYREGION_H diff --git a/src/zodiac.h b/src/zodiac.h index 2c5e067..e2ec6bf 100644 --- a/src/zodiac.h +++ b/src/zodiac.h @@ -1,132 +1,131 @@ /* This file is part of the kholidays library. Copyright (c) 2005-2007 Allen Winter This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KHOLIDAYS_ZODIAC_H #define KHOLIDAYS_ZODIAC_H +#include "kholidays_export.h" + +#include + +class QDate; +class QString; + +namespace KHolidays +{ + +class ZodiacPrivate; + /** Represents and manages the Zodiac calendar. The Tropical and Sidereal Zodiacs are supported. A very good description of the Zodiac calendars can be read at the Wikipedia, http://en.wikipedia.org/wiki/Zodiac Disclaimer: I am by no means a Zodiac expert. I put together this software based on some quick scanning of documents I found on the WWW. Feel free to contact me about this code if you have improvements. Sign Symbol Birthdates Tropical Sidereal Aries ram Mar 21 - Apr 19 Apr 14 - May 14 Taurus bull Apr 20 - May 20 May 15 - Jun 14 Gemini twins May 21 - Jun 20 Jun 15 - Jul 16 Cancer crab Jun 21 - Jul 22 Jul 17 - Aug 16 Leo lion Jul 23 - Aug 22 Aug 17 - Sep 16 Virgo virgin Aug 23 - Sep 22 Sep 17 - Oct 17 Libra scale Sep 23 - Oct 22 Oct 18 - Nov 16 Scorpio scorpion Oct 23 - Nov 21 Nov 17 - Dec 15 Sagittarius archer Nov 22 - Dec 21 Dec 16 - Jan 14 Capricorn goat Dec 22 - Jan 19 Jan 15 - Feb 12 Aquarius water Jan 20 - Feb 18 Feb 13 - Mar 14 Pisces fish Feb 19 - Mar 20 Mar 15 - Apr 13 */ - -#include "kholidays_export.h" - -#include - -class QDate; -class QString; - -namespace KHolidays -{ - -class ZodiacPrivate; - class KHOLIDAYS_EXPORT Zodiac { public: enum ZodiacType { Tropical, Sidereal }; enum ZodiacSigns { Aries, Taurus, Gemini, Cancer, Leo, Virgo, Libra, Scorpio, Sagittarius, Capricorn, Aquarius, Pisces, None }; explicit Zodiac(ZodiacType type); Zodiac(const Zodiac &other); ~Zodiac(); Zodiac &operator=(const Zodiac &other); /** Return the Zodiac sign for the specified Gregorian date. The enum 'None' is returned if one of the supported signs does not occur on the date. @param date compute the Zodiac sign for the specified Gregorian date. */ ZodiacSigns signAtDate(const QDate &date) const; /** Return the Zodiac sign as a text string for the specified date. A null string is returned if one of the supported Zodiac signs does not occur on the date. @param date compute the Zodiac sign for the specified Gregorian date. */ QString signNameAtDate(const QDate &date) const; /** Return the string representation of Zodiac sign. @param sign Zodiac sign. */ static QString signName(ZodiacSigns sign); /** Convert the Zodiac sign to a Zodiac symbol. */ static QString signSymbol(ZodiacSigns sign); private: QSharedDataPointer d; }; } #endif