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 ARMENIANCALENDAR_HPP
20 #define ARMENIANCALENDAR_HPP
21 
22 #include "EgyptianCalendar.hpp"
23 
24 //! The Armenian calendar has the same structure as the Egyptian calendar
25 //! Epoch is 552 C.E.
26 
27 class ArmenianCalendar: public EgyptianCalendar
28 {
29 	Q_OBJECT
30 
31 public:
32 	ArmenianCalendar(double jd);
33 
~ArmenianCalendar()34 	virtual ~ArmenianCalendar() Q_DECL_OVERRIDE {}
35 
36 public slots:
37 	virtual void retranslate() Q_DECL_OVERRIDE;
38 
39 	//! Set a calendar date from the Julian day number
40 	virtual void setJD(double JD) Q_DECL_OVERRIDE;
41 
42 	//! set date from a vector of calendar date elements sorted from the largest to the smallest.
43 	//! Year-Month[1...12]-Day[1...31]
44 	virtual void setDate(QVector<int> parts) Q_DECL_OVERRIDE;
45 
46 	//! get a stringlist of calendar date elements sorted from the largest to the smallest.
47 	//! Year, Month, MonthName, Day, DayName
48 	virtual QStringList getDateStrings() const Q_DECL_OVERRIDE;
49 
50 	//! get a formatted complete string for a date
51 	virtual QString getFormattedDateString() const Q_DECL_OVERRIDE;
52 
53 public:
54 	//! find RD number for date in the Armenian calendar (may be used in other calendars!)
55 	static int fixedFromArmenian(QVector<int> julian);
56 	//! find date in the Armenian calendar from RD number (may be used in other calendars!)
57 	static QVector<int> armenianFromFixed(int rd);
58 
59 	static const int armenianEpoch;
60 
61 protected:
62 	static QMap<int, QString> monthNames;
63 };
64 
65 #endif
66