KHolidays

lunarphase.h
1/*
2 This file is part of the kholidays library.
3
4 SPDX-FileCopyrightText: 2004, 2007, 2009 Allen Winter <winter@kde.org>
5
6 SPDX-License-Identifier: LGPL-2.0-or-later
7*/
8
9#ifndef KHOLIDAYS_LUNARPHASE_H
10#define KHOLIDAYS_LUNARPHASE_H
11
12#include "kholidays_export.h"
13
14#include <qobjectdefs.h>
15
16class QDate;
17class QString;
18
19namespace KHolidays
20{
21/**
22 Represents and manages a Lunar Phase
23
24 A Lunar Phase can be one of the following:
25
26 + "new": the moon is not visible; or traditionally: first visible
27 crescent of the Moon. For religious purposes, the new
28 month begins when the first crescent moon can be seen.
29 Thus, it is impossible to be certain in advance of when
30 months will begin; in particular, the exact date on which
31 Ramadan will begin is not known in advance. In Saudi Arabia,
32 observers are sent up in airplanes if the weather is cloudy
33 when the new moon is expected.
34 + "waxing crescent": between "new" and "first quarter".
35 + "first quarter": the right 50% of the moon is visible.
36 + "waxing gibbous": between "first quarter" and "full".
37 + "full": the moon is fully visible.
38 + "waning gibbous": between "full" and "last quarter".
39 + "last quarter": the left 50% of the moon is visible.
40 + "waning crescent": between "last quarter" and "new".
41
42 A very good description of the lunar phases can be read at the Wikipedia,
43 https://en.wikipedia.org/wiki/Lunar_phase
44*/
45class KHOLIDAYS_EXPORT LunarPhase // krazy:exclude=dpointer
46{
47 Q_GADGET
48public:
49 /**
50 Phases of the moon, in traditional English notation. The
51 phase @c None is used only as an error indicator, for instance
52 in phase().
53 */
54 enum Phase {
55 NewMoon, ///< New moon phase
56 FirstQuarter, ///< First quarter of moon phase
57 LastQuarter, ///< Last quarter of moon phase
58 FullMoon, ///< Full moon phase
59 None, ///< Indication for error
60 WaxingCrescent, ///< @since 5.94
61 WaxingGibbous, ///< @since 5.94
62 WaningGibbous, ///< @since 5.94
63 WaningCrescent, ///< @since 5.94
64 };
65 Q_ENUM(Phase)
66
67 /**
68 Return the lunar phase for the specified Gregorian date.
69 The enum 'None' is returned if one of the supported phases
70 does not occur on the date.
71
72 @param date compute the lunar phase for the specified Gregorian date.
73 */
74 static Phase phaseAtDate(const QDate &date);
75
76 /**
77 Return the lunar phase as a text string for the specified date.
78 A null string is returned if one of the supported phases does
79 not occur on the date.
80
81 @param date compute the lunar phase for the specified Gregorian date.
82 */
83 static QString phaseNameAtDate(const QDate &date);
84
85 /**
86 Return the string representation of phase.
87
88 @param phase the lunar phase.
89 */
90 static QString phaseName(Phase phase);
91};
92
93}
94
95#endif
Represents and manages a Lunar Phase.
Definition lunarphase.h:46
Phase
Phases of the moon, in traditional English notation.
Definition lunarphase.h:54
@ FullMoon
Full moon phase.
Definition lunarphase.h:58
@ FirstQuarter
First quarter of moon phase.
Definition lunarphase.h:56
@ None
Indication for error.
Definition lunarphase.h:59
@ LastQuarter
Last quarter of moon phase.
Definition lunarphase.h:57
@ NewMoon
New moon phase.
Definition lunarphase.h:55
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:11:11 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.