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