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

0001 /*
0002     This file is part of the kholidays library.
0003 
0004     SPDX-FileCopyrightText: 2005-2007 Allen Winter <winter@kde.org>
0005 
0006     SPDX-License-Identifier: LGPL-2.0-or-later
0007 */
0008 
0009 #ifndef KHOLIDAYS_ZODIAC_H
0010 #define KHOLIDAYS_ZODIAC_H
0011 
0012 #include "kholidays_export.h"
0013 
0014 #include <QSharedDataPointer>
0015 
0016 class QDate;
0017 class QString;
0018 
0019 namespace KHolidays
0020 {
0021 class ZodiacPrivate;
0022 
0023 /**
0024    Represents and manages the Zodiac calendar.
0025    The Tropical and Sidereal Zodiacs are supported.
0026 
0027    A very good description of the Zodiac calendars can be read at the
0028    Wikipedia,
0029      https://en.wikipedia.org/wiki/Zodiac
0030 
0031    Disclaimer: I am by no means a Zodiac expert.  I put together this software
0032    based on some quick scanning of documents I found on the WWW.  Feel free
0033    to contact me about this code if you have improvements.
0034 
0035    Sign         Symbol               Birthdates
0036                           Tropical              Sidereal
0037    Aries        ram       Mar 21 - Apr 19       Apr 14 - May 14
0038    Taurus       bull      Apr 20 - May 20       May 15 - Jun 14
0039    Gemini       twins     May 21 - Jun 20       Jun 15 - Jul 16
0040    Cancer       crab      Jun 21 - Jul 22       Jul 17 - Aug 16
0041    Leo          lion      Jul 23 - Aug 22       Aug 17 - Sep 16
0042    Virgo        virgin    Aug 23 - Sep 22       Sep 17 - Oct 17
0043    Libra        scale     Sep 23 - Oct 22       Oct 18 - Nov 16
0044    Scorpio      scorpion  Oct 23 - Nov 21       Nov 17 - Dec 15
0045    Sagittarius  archer    Nov 22 - Dec 21       Dec 16 - Jan 14
0046    Capricorn    goat      Dec 22 - Jan 19       Jan 15 - Feb 12
0047    Aquarius     water     Jan 20 - Feb 18       Feb 13 - Mar 14
0048    Pisces       fish      Feb 19 - Mar 20       Mar 15 - Apr 13
0049 
0050 */
0051 class KHOLIDAYS_EXPORT Zodiac
0052 {
0053 public:
0054     enum ZodiacType {
0055         Tropical,
0056         Sidereal,
0057     };
0058 
0059     enum ZodiacSigns {
0060         Aries,
0061         Taurus,
0062         Gemini,
0063         Cancer,
0064         Leo,
0065         Virgo,
0066         Libra,
0067         Scorpio,
0068         Sagittarius,
0069         Capricorn,
0070         Aquarius,
0071         Pisces,
0072         None,
0073     };
0074 
0075     explicit Zodiac(ZodiacType type);
0076     Zodiac(const Zodiac &other);
0077     ~Zodiac();
0078 
0079     Zodiac &operator=(const Zodiac &other);
0080 
0081     /**
0082        Return the Zodiac sign for the specified Gregorian date.
0083        The enum 'None' is returned if one of the supported signs
0084        does not occur on the date.
0085 
0086        @param date compute the Zodiac sign for the specified Gregorian date.
0087     */
0088     ZodiacSigns signAtDate(const QDate &date) const;
0089 
0090     /**
0091        Return the Zodiac sign as a text string for the specified date.
0092        A null string is returned if one of the supported Zodiac signs does
0093        not occur on the date.
0094 
0095        @param date compute the Zodiac sign for the specified Gregorian date.
0096     */
0097     QString signNameAtDate(const QDate &date) const;
0098 
0099     /**
0100        Return the string representation of Zodiac sign.
0101 
0102        @param sign Zodiac sign.
0103     */
0104     static QString signName(ZodiacSigns sign);
0105 
0106     /**
0107        Convert the Zodiac sign to a Zodiac symbol.
0108     */
0109     static QString signSymbol(ZodiacSigns sign);
0110 
0111 private:
0112     QSharedDataPointer<ZodiacPrivate> d;
0113 };
0114 
0115 }
0116 
0117 #endif