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