xref: /aosp_15_r20/external/icu/libicu/cts_headers/coptccal.h (revision 0e209d3975ff4a8c132096b14b0e9364a753506e)
1*0e209d39SAndroid Build Coastguard Worker // © 2016 and later: Unicode, Inc. and others.
2*0e209d39SAndroid Build Coastguard Worker // License & terms of use: http://www.unicode.org/copyright.html
3*0e209d39SAndroid Build Coastguard Worker /*
4*0e209d39SAndroid Build Coastguard Worker *******************************************************************************
5*0e209d39SAndroid Build Coastguard Worker * Copyright (C) 2003 - 2013, International Business Machines Corporation and  *
6*0e209d39SAndroid Build Coastguard Worker * others. All Rights Reserved.                                                *
7*0e209d39SAndroid Build Coastguard Worker *******************************************************************************
8*0e209d39SAndroid Build Coastguard Worker */
9*0e209d39SAndroid Build Coastguard Worker 
10*0e209d39SAndroid Build Coastguard Worker #ifndef COPTCCAL_H
11*0e209d39SAndroid Build Coastguard Worker #define COPTCCAL_H
12*0e209d39SAndroid Build Coastguard Worker 
13*0e209d39SAndroid Build Coastguard Worker #include "unicode/utypes.h"
14*0e209d39SAndroid Build Coastguard Worker 
15*0e209d39SAndroid Build Coastguard Worker #if !UCONFIG_NO_FORMATTING
16*0e209d39SAndroid Build Coastguard Worker 
17*0e209d39SAndroid Build Coastguard Worker #include "unicode/calendar.h"
18*0e209d39SAndroid Build Coastguard Worker #include "cecal.h"
19*0e209d39SAndroid Build Coastguard Worker 
20*0e209d39SAndroid Build Coastguard Worker U_NAMESPACE_BEGIN
21*0e209d39SAndroid Build Coastguard Worker 
22*0e209d39SAndroid Build Coastguard Worker /**
23*0e209d39SAndroid Build Coastguard Worker  * Implement the Coptic calendar system.
24*0e209d39SAndroid Build Coastguard Worker  * @internal
25*0e209d39SAndroid Build Coastguard Worker  */
26*0e209d39SAndroid Build Coastguard Worker class CopticCalendar : public CECalendar {
27*0e209d39SAndroid Build Coastguard Worker 
28*0e209d39SAndroid Build Coastguard Worker public:
29*0e209d39SAndroid Build Coastguard Worker     /**
30*0e209d39SAndroid Build Coastguard Worker      * Useful constants for CopticCalendar.
31*0e209d39SAndroid Build Coastguard Worker      * @internal
32*0e209d39SAndroid Build Coastguard Worker      */
33*0e209d39SAndroid Build Coastguard Worker     enum EMonths {
34*0e209d39SAndroid Build Coastguard Worker         /**
35*0e209d39SAndroid Build Coastguard Worker          * Constant for ωογτ/تﻮﺗ,
36*0e209d39SAndroid Build Coastguard Worker          * the 1st month of the Coptic year.
37*0e209d39SAndroid Build Coastguard Worker          */
38*0e209d39SAndroid Build Coastguard Worker         TOUT,
39*0e209d39SAndroid Build Coastguard Worker 
40*0e209d39SAndroid Build Coastguard Worker         /**
41*0e209d39SAndroid Build Coastguard Worker          * Constant for Παοπι/ﻪﺑﺎﺑ,
42*0e209d39SAndroid Build Coastguard Worker          * the 2nd month of the Coptic year.
43*0e209d39SAndroid Build Coastguard Worker          */
44*0e209d39SAndroid Build Coastguard Worker         BABA,
45*0e209d39SAndroid Build Coastguard Worker 
46*0e209d39SAndroid Build Coastguard Worker         /**
47*0e209d39SAndroid Build Coastguard Worker          * Constant for Αθορ/رﻮﺗﺎﻫ,
48*0e209d39SAndroid Build Coastguard Worker          * the 3rd month of the Coptic year.
49*0e209d39SAndroid Build Coastguard Worker          */
50*0e209d39SAndroid Build Coastguard Worker         HATOR,
51*0e209d39SAndroid Build Coastguard Worker 
52*0e209d39SAndroid Build Coastguard Worker         /**
53*0e209d39SAndroid Build Coastguard Worker          * Constant for Χοιακ/ﻚﻬﻴﻛ,
54*0e209d39SAndroid Build Coastguard Worker          * the 4th month of the Coptic year.
55*0e209d39SAndroid Build Coastguard Worker          */
56*0e209d39SAndroid Build Coastguard Worker         KIAHK,
57*0e209d39SAndroid Build Coastguard Worker 
58*0e209d39SAndroid Build Coastguard Worker         /**
59*0e209d39SAndroid Build Coastguard Worker          * Constant for Τωβι/طﻮﺒﻫ,
60*0e209d39SAndroid Build Coastguard Worker          * the 5th month of the Coptic year.
61*0e209d39SAndroid Build Coastguard Worker          */
62*0e209d39SAndroid Build Coastguard Worker         TOBA,
63*0e209d39SAndroid Build Coastguard Worker 
64*0e209d39SAndroid Build Coastguard Worker         /**
65*0e209d39SAndroid Build Coastguard Worker          * Constant for Μεϣιρ/ﺮﻴﺸﻣأ,
66*0e209d39SAndroid Build Coastguard Worker          * the 6th month of the Coptic year.
67*0e209d39SAndroid Build Coastguard Worker          */
68*0e209d39SAndroid Build Coastguard Worker         AMSHIR,
69*0e209d39SAndroid Build Coastguard Worker 
70*0e209d39SAndroid Build Coastguard Worker         /**
71*0e209d39SAndroid Build Coastguard Worker          * Constant for Παρεμϩατ/تﺎﻬﻣﺮﺑ,
72*0e209d39SAndroid Build Coastguard Worker          * the 7th month of the Coptic year.
73*0e209d39SAndroid Build Coastguard Worker          */
74*0e209d39SAndroid Build Coastguard Worker         BARAMHAT,
75*0e209d39SAndroid Build Coastguard Worker 
76*0e209d39SAndroid Build Coastguard Worker         /**
77*0e209d39SAndroid Build Coastguard Worker          * Constant for Φαρμοθι/هدﻮﻣﺮﺑ,
78*0e209d39SAndroid Build Coastguard Worker          * the 8th month of the Coptic year.
79*0e209d39SAndroid Build Coastguard Worker          */
80*0e209d39SAndroid Build Coastguard Worker         BARAMOUDA,
81*0e209d39SAndroid Build Coastguard Worker 
82*0e209d39SAndroid Build Coastguard Worker         /**
83*0e209d39SAndroid Build Coastguard Worker          * Constant for Παϣαν/ﺲﻨﺸﺑ,
84*0e209d39SAndroid Build Coastguard Worker          * the 9th month of the Coptic year.
85*0e209d39SAndroid Build Coastguard Worker          */
86*0e209d39SAndroid Build Coastguard Worker         BASHANS,
87*0e209d39SAndroid Build Coastguard Worker 
88*0e209d39SAndroid Build Coastguard Worker         /**
89*0e209d39SAndroid Build Coastguard Worker          * Constant for Παωνι/ﻪﻧؤﻮﺑ,
90*0e209d39SAndroid Build Coastguard Worker          * the 10th month of the Coptic year.
91*0e209d39SAndroid Build Coastguard Worker          */
92*0e209d39SAndroid Build Coastguard Worker         PAONA,
93*0e209d39SAndroid Build Coastguard Worker 
94*0e209d39SAndroid Build Coastguard Worker         /**
95*0e209d39SAndroid Build Coastguard Worker          * Constant for Επηπ/ﺐﻴﺑأ,
96*0e209d39SAndroid Build Coastguard Worker          * the 11th month of the Coptic year.
97*0e209d39SAndroid Build Coastguard Worker          */
98*0e209d39SAndroid Build Coastguard Worker         EPEP,
99*0e209d39SAndroid Build Coastguard Worker 
100*0e209d39SAndroid Build Coastguard Worker         /**
101*0e209d39SAndroid Build Coastguard Worker          * Constant for Μεϲωρη/ىﺮﺴﻣ,
102*0e209d39SAndroid Build Coastguard Worker          * the 12th month of the Coptic year.
103*0e209d39SAndroid Build Coastguard Worker          */
104*0e209d39SAndroid Build Coastguard Worker         MESRA,
105*0e209d39SAndroid Build Coastguard Worker 
106*0e209d39SAndroid Build Coastguard Worker         /**
107*0e209d39SAndroid Build Coastguard Worker          * Constant for Πικογϫι
108*0e209d39SAndroid Build Coastguard Worker          * μαβοτ/ﺮﻴﻐﺼﻟا
109*0e209d39SAndroid Build Coastguard Worker          * ﺮﻬﺸﻟا,
110*0e209d39SAndroid Build Coastguard Worker          * the 13th month of the Coptic year.
111*0e209d39SAndroid Build Coastguard Worker          */
112*0e209d39SAndroid Build Coastguard Worker         NASIE
113*0e209d39SAndroid Build Coastguard Worker     };
114*0e209d39SAndroid Build Coastguard Worker 
115*0e209d39SAndroid Build Coastguard Worker     enum EEras {
116*0e209d39SAndroid Build Coastguard Worker         BCE,    // Before the epoch
117*0e209d39SAndroid Build Coastguard Worker         CE      // After the epoch
118*0e209d39SAndroid Build Coastguard Worker     };
119*0e209d39SAndroid Build Coastguard Worker 
120*0e209d39SAndroid Build Coastguard Worker     /**
121*0e209d39SAndroid Build Coastguard Worker      * Constructs a CopticCalendar based on the current time in the default time zone
122*0e209d39SAndroid Build Coastguard Worker      * with the given locale.
123*0e209d39SAndroid Build Coastguard Worker      *
124*0e209d39SAndroid Build Coastguard Worker      * @param aLocale  The given locale.
125*0e209d39SAndroid Build Coastguard Worker      * @param success  Indicates the status of CopticCalendar object construction.
126*0e209d39SAndroid Build Coastguard Worker      *                 Returns U_ZERO_ERROR if constructed successfully.
127*0e209d39SAndroid Build Coastguard Worker      * @internal
128*0e209d39SAndroid Build Coastguard Worker      */
129*0e209d39SAndroid Build Coastguard Worker     CopticCalendar(const Locale& aLocale, UErrorCode& success);
130*0e209d39SAndroid Build Coastguard Worker 
131*0e209d39SAndroid Build Coastguard Worker     /**
132*0e209d39SAndroid Build Coastguard Worker      * Copy Constructor
133*0e209d39SAndroid Build Coastguard Worker      * @internal
134*0e209d39SAndroid Build Coastguard Worker      */
135*0e209d39SAndroid Build Coastguard Worker     CopticCalendar (const CopticCalendar& other);
136*0e209d39SAndroid Build Coastguard Worker 
137*0e209d39SAndroid Build Coastguard Worker     /**
138*0e209d39SAndroid Build Coastguard Worker      * Destructor.
139*0e209d39SAndroid Build Coastguard Worker      * @internal
140*0e209d39SAndroid Build Coastguard Worker      */
141*0e209d39SAndroid Build Coastguard Worker     virtual ~CopticCalendar();
142*0e209d39SAndroid Build Coastguard Worker 
143*0e209d39SAndroid Build Coastguard Worker     /**
144*0e209d39SAndroid Build Coastguard Worker      * Create and return a polymorphic copy of this calendar.
145*0e209d39SAndroid Build Coastguard Worker      * @return    return a polymorphic copy of this calendar.
146*0e209d39SAndroid Build Coastguard Worker      * @internal
147*0e209d39SAndroid Build Coastguard Worker      */
148*0e209d39SAndroid Build Coastguard Worker     virtual CopticCalendar* clone() const override;
149*0e209d39SAndroid Build Coastguard Worker 
150*0e209d39SAndroid Build Coastguard Worker     /**
151*0e209d39SAndroid Build Coastguard Worker      * return the calendar type, "coptic"
152*0e209d39SAndroid Build Coastguard Worker      * @return calendar type
153*0e209d39SAndroid Build Coastguard Worker      * @internal
154*0e209d39SAndroid Build Coastguard Worker      */
155*0e209d39SAndroid Build Coastguard Worker     const char * getType() const override;
156*0e209d39SAndroid Build Coastguard Worker 
157*0e209d39SAndroid Build Coastguard Worker     /**
158*0e209d39SAndroid Build Coastguard Worker      * @return      The related Gregorian year; will be obtained by modifying the value
159*0e209d39SAndroid Build Coastguard Worker      *              obtained by get from UCAL_EXTENDED_YEAR field
160*0e209d39SAndroid Build Coastguard Worker      * @internal
161*0e209d39SAndroid Build Coastguard Worker      */
162*0e209d39SAndroid Build Coastguard Worker     virtual int32_t getRelatedYear(UErrorCode &status) const override;
163*0e209d39SAndroid Build Coastguard Worker 
164*0e209d39SAndroid Build Coastguard Worker     /**
165*0e209d39SAndroid Build Coastguard Worker      * @param year  The related Gregorian year to set; will be modified as necessary then
166*0e209d39SAndroid Build Coastguard Worker      *              set in UCAL_EXTENDED_YEAR field
167*0e209d39SAndroid Build Coastguard Worker      * @internal
168*0e209d39SAndroid Build Coastguard Worker      */
169*0e209d39SAndroid Build Coastguard Worker     virtual void setRelatedYear(int32_t year) override;
170*0e209d39SAndroid Build Coastguard Worker 
171*0e209d39SAndroid Build Coastguard Worker protected:
172*0e209d39SAndroid Build Coastguard Worker     //-------------------------------------------------------------------------
173*0e209d39SAndroid Build Coastguard Worker     // Calendar framework
174*0e209d39SAndroid Build Coastguard Worker     //-------------------------------------------------------------------------
175*0e209d39SAndroid Build Coastguard Worker 
176*0e209d39SAndroid Build Coastguard Worker     /**
177*0e209d39SAndroid Build Coastguard Worker      * Return the extended year defined by the current fields.
178*0e209d39SAndroid Build Coastguard Worker      * @internal
179*0e209d39SAndroid Build Coastguard Worker      */
180*0e209d39SAndroid Build Coastguard Worker     virtual int32_t handleGetExtendedYear(UErrorCode& status) override;
181*0e209d39SAndroid Build Coastguard Worker 
182*0e209d39SAndroid Build Coastguard Worker     /**
183*0e209d39SAndroid Build Coastguard Worker      * Compute fields from the JD
184*0e209d39SAndroid Build Coastguard Worker      * @internal
185*0e209d39SAndroid Build Coastguard Worker      */
186*0e209d39SAndroid Build Coastguard Worker     virtual void handleComputeFields(int32_t julianDay, UErrorCode &status) override;
187*0e209d39SAndroid Build Coastguard Worker 
188*0e209d39SAndroid Build Coastguard Worker     DECLARE_OVERRIDE_SYSTEM_DEFAULT_CENTURY
189*0e209d39SAndroid Build Coastguard Worker 
190*0e209d39SAndroid Build Coastguard Worker     /**
191*0e209d39SAndroid Build Coastguard Worker      * Return the date offset from Julian
192*0e209d39SAndroid Build Coastguard Worker      * @internal
193*0e209d39SAndroid Build Coastguard Worker      */
194*0e209d39SAndroid Build Coastguard Worker     virtual int32_t getJDEpochOffset() const override;
195*0e209d39SAndroid Build Coastguard Worker 
isEra0CountingBackward()196*0e209d39SAndroid Build Coastguard Worker     virtual bool isEra0CountingBackward() const override { return true; }
197*0e209d39SAndroid Build Coastguard Worker public:
198*0e209d39SAndroid Build Coastguard Worker     /**
199*0e209d39SAndroid Build Coastguard Worker      * Override Calendar Returns a unique class ID POLYMORPHICALLY. Pure virtual
200*0e209d39SAndroid Build Coastguard Worker      * override. This method is to implement a simple version of RTTI, since not all C++
201*0e209d39SAndroid Build Coastguard Worker      * compilers support genuine RTTI. Polymorphic operator==() and clone() methods call
202*0e209d39SAndroid Build Coastguard Worker      * this method.
203*0e209d39SAndroid Build Coastguard Worker      *
204*0e209d39SAndroid Build Coastguard Worker      * @return   The class ID for this object. All objects of a given class have the
205*0e209d39SAndroid Build Coastguard Worker      *           same class ID. Objects of other classes have different class IDs.
206*0e209d39SAndroid Build Coastguard Worker      * @internal
207*0e209d39SAndroid Build Coastguard Worker      */
208*0e209d39SAndroid Build Coastguard Worker     virtual UClassID getDynamicClassID() const override;
209*0e209d39SAndroid Build Coastguard Worker 
210*0e209d39SAndroid Build Coastguard Worker     /**
211*0e209d39SAndroid Build Coastguard Worker      * Return the class ID for this class. This is useful only for comparing to a return
212*0e209d39SAndroid Build Coastguard Worker      * value from getDynamicClassID(). For example:
213*0e209d39SAndroid Build Coastguard Worker      *
214*0e209d39SAndroid Build Coastguard Worker      *      Base* polymorphic_pointer = createPolymorphicObject();
215*0e209d39SAndroid Build Coastguard Worker      *      if (polymorphic_pointer->getDynamicClassID() ==
216*0e209d39SAndroid Build Coastguard Worker      *          Derived::getStaticClassID()) ...
217*0e209d39SAndroid Build Coastguard Worker      *
218*0e209d39SAndroid Build Coastguard Worker      * @return   The class ID for all objects of this class.
219*0e209d39SAndroid Build Coastguard Worker      * @internal
220*0e209d39SAndroid Build Coastguard Worker      */
221*0e209d39SAndroid Build Coastguard Worker     U_I18N_API static UClassID U_EXPORT2 getStaticClassID();
222*0e209d39SAndroid Build Coastguard Worker 
223*0e209d39SAndroid Build Coastguard Worker #if 0
224*0e209d39SAndroid Build Coastguard Worker     // We do not want to introduce this API in ICU4C.
225*0e209d39SAndroid Build Coastguard Worker     // It was accidentally introduced in ICU4J as a public API.
226*0e209d39SAndroid Build Coastguard Worker public:
227*0e209d39SAndroid Build Coastguard Worker     //-------------------------------------------------------------------------
228*0e209d39SAndroid Build Coastguard Worker     // Calendar system Conversion methods...
229*0e209d39SAndroid Build Coastguard Worker     //-------------------------------------------------------------------------
230*0e209d39SAndroid Build Coastguard Worker     /**
231*0e209d39SAndroid Build Coastguard Worker      * Convert an Coptic year, month, and day to a Julian day.
232*0e209d39SAndroid Build Coastguard Worker      *
233*0e209d39SAndroid Build Coastguard Worker      * @param year the extended year
234*0e209d39SAndroid Build Coastguard Worker      * @param month the month
235*0e209d39SAndroid Build Coastguard Worker      * @param day the day
236*0e209d39SAndroid Build Coastguard Worker      * @return Julian day
237*0e209d39SAndroid Build Coastguard Worker      * @internal
238*0e209d39SAndroid Build Coastguard Worker      */
239*0e209d39SAndroid Build Coastguard Worker     static int32_t copticToJD(int32_t year, int32_t month, int32_t day);
240*0e209d39SAndroid Build Coastguard Worker #endif
241*0e209d39SAndroid Build Coastguard Worker };
242*0e209d39SAndroid Build Coastguard Worker 
243*0e209d39SAndroid Build Coastguard Worker U_NAMESPACE_END
244*0e209d39SAndroid Build Coastguard Worker 
245*0e209d39SAndroid Build Coastguard Worker #endif /* #if !UCONFIG_NO_FORMATTING */
246*0e209d39SAndroid Build Coastguard Worker #endif /* COPTCCAL_H */
247*0e209d39SAndroid Build Coastguard Worker //eof
248