1/*
2 This file is part of the kholidays library.
3
4 Copyright (c) 2004,2007,3009 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
14 GNU 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 the
18 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA.
20*/
21
22#ifndef KHOLIDAYS_LUNARPHASE_H
23#define KHOLIDAYS_LUNARPHASE_H
24
25#include "kholidays_export.h"
26
27class QDate;
28class QString;
29
30namespace KHolidays {
31
32/**
33 Represents and manages a Lunar Phase
34
35 A Lunar Phase can be one of the following:
36
37 + "new": the moon is not visible; or traditionally: first visible
38 crescent of the Moon. For religious purposes, the new
39 month begins when the first crescent moon can be seen.
40 Thus, it is impossible to be certain in advance of when
41 months will begin; in particular, the exact date on which
42 Ramadan will begin is not known in advance. In Saudi Arabia,
43 observers are sent up in airplanes if the weather is cloudy
44 when the new moon is expected.
45 + "first quarter": the right 50% of the moon is visible.
46 + "full": the moon is fully visible.
47 + "last quarter": the left 50% of the moon is visible.
48
49 A very good description of the lunar phases can be read at the Wikipedia,
50 http://en.wikipedia.org/wiki/Lunar_phase
51
52 Note that crescent and gibbous phases are not currently supported.
53*/
54class KHOLIDAYS_EXPORT LunarPhase //krazy:exclude=dpointer
55{
56 public:
57 /**
58 Phases of the moon, in traditional English notation. The
59 phase @c None is used only as an error indicator, for instance
60 in phase().
61 */
62 enum Phase {
63 NewMoon, ///< New moon phase
64 FirstQuarter, ///< First quarter of moon phase
65 LastQuarter, ///< Last quarter of moon phase
66 FullMoon, ///< Full moon phase
67 None ///< Indication for error
68 };
69
70 /**
71 Return the lunar phase for the specified Gregorian date.
72 The enum 'None' is returned if one of the supported phases
73 does not occur on the date.
74
75 @param date compute the lunar phase for the specified Gregorian date.
76 */
77 static Phase phaseAtDate( const QDate &date );
78
79 /**
80 Return the lunar phase as a text string for the specified date.
81 A null string is returned if one of the supported phases does
82 not occur on the date.
83
84 @param date compute the lunar phase for the specified Gregorian date.
85 */
86 static QString phaseNameAtDate( const QDate &date );
87
88 /**
89 Return the string representation of phase.
90
91 @param phase the lunar phase.
92 */
93 static QString phaseName( Phase phase );
94};
95
96}
97
98#endif
99