File indexing completed on 2024-12-08 09:38:10

0001 /*
0002     This file is part of the kholidays library.
0003 
0004     SPDX-FileCopyrightText: 2004, 2006-2007 Allen Winter <winter@kde.org>
0005 
0006     SPDX-License-Identifier: LGPL-2.0-or-later
0007 */
0008 
0009 #ifndef KHOLIDAYS_ASTROSEASONS_H
0010 #define KHOLIDAYS_ASTROSEASONS_H
0011 
0012 #include "kholidays_export.h"
0013 
0014 class QDate;
0015 class QString;
0016 
0017 namespace KHolidays
0018 {
0019 /**
0020   Represents and manages the Astronomical Seasons (solstices and equinoxes).
0021   For the purposes of this class, we sometimes use the shorthand of "Season"
0022   where we really mean "Astronomical Season".
0023 
0024   An Astronomical Season can be one of the following:
0025 
0026    - June solstice
0027    - December solstice
0028    - March equinox
0029    - September equinox
0030 
0031    A very good description of the astronomical seasons can be read at the
0032    Wikipedia,
0033      https://en.wikipedia.org/wiki/Seasons
0034 
0035    Note that this class represents the "Astronomical Seasons" and not
0036    the traditional "Seasons" which vary widely by culture.
0037 */
0038 class KHOLIDAYS_EXPORT AstroSeasons // krazy:exclude=dpointer
0039 {
0040 public:
0041     enum Season {
0042         JuneSolstice,
0043         DecemberSolstice,
0044         MarchEquinox,
0045         SeptemberEquinox,
0046         None,
0047     };
0048 
0049     /**
0050      * Return the Gregorian date on which the season occurs in given year.
0051      *
0052      * @param season Season to return a date for
0053      * @param year Year for which to return the date
0054      * @since 5.50
0055      */
0056     static QDate seasonDate(Season season, int year);
0057 
0058     /**
0059        Return the season for the specified Gregorian date.
0060        The enum 'None' is returned if one of the supported seasons
0061        does not occur on the date.
0062 
0063        @param date compute the season for the specified Gregorian date.
0064     */
0065     static Season seasonAtDate(const QDate &date);
0066 
0067     /**
0068        Return the season as a text string for the specified date.
0069        A null string is returned if one of the supported seasons does
0070        not occur on the date.
0071 
0072        @param date compute the season for the specified Gregorian date.
0073     */
0074     static QString seasonNameAtDate(const QDate &date);
0075 
0076     /**
0077        Return the string representation of season.
0078 
0079        @param season astronomical season.
0080     */
0081     static QString seasonName(Season season);
0082 };
0083 
0084 }
0085 
0086 #endif