1 /* 2 * Copyright (C) 2020 Georg Zotti 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public License 6 * as published by the Free Software Foundation; either version 2 7 * of the License, or (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. 17 */ 18 19 #ifndef ZOROASTRIANCALENDAR_HPP 20 #define ZOROASTRIANCALENDAR_HPP 21 22 #include "EgyptianCalendar.hpp" 23 24 //! The Zoroastrian calendar has the same structure as the Egyptian and Armenian calendars 25 //! Epoch is Jezdegerd, the last Persian ruler of A.D. 632 26 //! Source: CC.UE 1.11. 27 //! Month Names from Ginzel 1906, Vol1, §69. 28 29 class ZoroastrianCalendar: public EgyptianCalendar 30 { 31 Q_OBJECT 32 33 public: 34 ZoroastrianCalendar(double jd); 35 ~ZoroastrianCalendar()36 virtual ~ZoroastrianCalendar() Q_DECL_OVERRIDE {} 37 38 public slots: 39 virtual void retranslate() Q_DECL_OVERRIDE; 40 41 //! Set a calendar date from the Julian day number 42 virtual void setJD(double JD) Q_DECL_OVERRIDE; 43 44 //! set date from a vector of calendar date elements sorted from the largest to the smallest. 45 //! Year-Month[1...12]-Day[1...31] 46 virtual void setDate(QVector<int> parts) Q_DECL_OVERRIDE; 47 48 //! get a stringlist of calendar date elements sorted from the largest to the smallest. 49 //! Year, Month, MonthName, Day, DayName 50 virtual QStringList getDateStrings() const Q_DECL_OVERRIDE; 51 52 //! get a formatted complete string for a date 53 virtual QString getFormattedDateString() const Q_DECL_OVERRIDE; 54 55 public: 56 //! find RD number for date in the Zoroastrian calendar (may be used in other calendars!) 57 static int fixedFromZoroastrian(QVector<int> julian); 58 //! find date in the Zoroastrian calendar from RD number (may be used in other calendars!) 59 static QVector<int> zoroastrianFromFixed(int rd); 60 61 static const int zoroastrianEpoch; 62 63 protected: 64 static QMap<int, QString> monthNames; 65 static QMap<int, QString> dayNames; 66 static QMap<int, QString> epagomenaeNames; 67 }; 68 69 #endif 70