1 | /* |
2 | This file is part of the kholidays library. |
3 | |
4 | Copyright (c) 2004,2006-2007 Allen Winter <winter@kde.org> |
5 | |
6 | This library is free software; you can redistribute it and/or |
7 | modify it under the terms of the GNU Library General Public |
8 | License as published by the Free Software Foundation; either |
9 | version 2 of the License, or (at your option) any later version. |
10 | |
11 | This library is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | Library General Public License for more details. |
15 | |
16 | You should have received a copy of the GNU Library General Public License |
17 | along with this library; see the file COPYING.LIB. If not, write to |
18 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
19 | Boston, MA 02110-1301, USA. |
20 | */ |
21 | |
22 | #ifndef KHOLIDAYS_ASTROSEASONS_H |
23 | #define KHOLIDAYS_ASTROSEASONS_H |
24 | |
25 | /** |
26 | Represents and manages the Astronomical Seasons (solstices and equinoxes). |
27 | For the purposes of this class, we sometimes use the shorthand of "Season" |
28 | where we really mean "Astronomical Season". |
29 | |
30 | An Astronomical Season can be one of the following: |
31 | |
32 | - June solstice |
33 | - December solstice |
34 | - March equinox |
35 | - September equinox |
36 | |
37 | A very good description of the astronomical seasons can be read at the |
38 | Wikipedia, |
39 | http://en.wikipedia.org/wiki/Seasons |
40 | |
41 | Note that this class represents the "Astronomical Seasons" and not |
42 | the traditional "Seasons" which vary widely by culture. |
43 | */ |
44 | |
45 | #include "kholidays_export.h" |
46 | |
47 | class QDate; |
48 | class QString; |
49 | |
50 | namespace KHolidays { |
51 | |
52 | class KHOLIDAYS_EXPORT AstroSeasons //krazy:exclude=dpointer |
53 | { |
54 | public: |
55 | |
56 | enum Season { |
57 | JuneSolstice, |
58 | DecemberSolstice, |
59 | MarchEquinox, |
60 | SeptemberEquinox, |
61 | None |
62 | }; |
63 | |
64 | /** |
65 | Return the season for the specified Gregorian date. |
66 | The enum 'None' is returned if one of the supported seasons |
67 | does not occur on the date. |
68 | |
69 | @param date compute the season for the specified Gregorian date. |
70 | */ |
71 | static Season seasonAtDate( const QDate &date ); |
72 | |
73 | /** |
74 | Return the season as a text string for the specified date. |
75 | A null string is returned if one of the supported seasons does |
76 | not occur on the date. |
77 | |
78 | @param date compute the season for the specified Gregorian date. |
79 | */ |
80 | static QString seasonNameAtDate( const QDate &date ); |
81 | |
82 | /** |
83 | Return the string representation of season. |
84 | |
85 | @param season astronomical season. |
86 | */ |
87 | static QString seasonName( Season season ); |
88 | }; |
89 | |
90 | } |
91 | |
92 | #endif |
93 | |
94 | |