2 *******************************************************************************
3 * Copyright (C) 2003 - 2008, International Business Machines Corporation and *
4 * others. All Rights Reserved. *
5 *******************************************************************************
11 #include "unicode/utypes.h"
13 #if !UCONFIG_NO_FORMATTING
15 #include "unicode/calendar.h"
21 * Implement the Coptic calendar system.
24 class CopticCalendar
: public CECalendar
{
28 * Useful constants for CopticCalendar.
33 * Constant for ωογτ/تﻮﺗ,
34 * the 1st month of the Coptic year.
39 * Constant for Παοπι/ﻪﺑﺎﺑ,
40 * the 2nd month of the Coptic year.
45 * Constant for Αθορ/رﻮﺗﺎﻫ,
46 * the 3rd month of the Coptic year.
51 * Constant for Χοιακ/ﻚﻬﻴﻛ,
52 * the 4th month of the Coptic year.
57 * Constant for Τωβι/طﻮﺒﻫ,
58 * the 5th month of the Coptic year.
63 * Constant for Μεϣιρ/ﺮﻴﺸﻣأ,
64 * the 6th month of the Coptic year.
69 * Constant for Παρεμϩατ/تﺎﻬﻣﺮﺑ,
70 * the 7th month of the Coptic year.
75 * Constant for Φαρμοθι/هدﻮﻣﺮﺑ,
76 * the 8th month of the Coptic year.
81 * Constant for Παϣαν/ﺲﻨﺸﺑ,
82 * the 9th month of the Coptic year.
87 * Constant for Παωνι/ﻪﻧؤﻮﺑ,
88 * the 10th month of the Coptic year.
93 * Constant for Επηπ/ﺐﻴﺑأ,
94 * the 11th month of the Coptic year.
99 * Constant for Μεϲωρη/ىﺮﺴﻣ,
100 * the 12th month of the Coptic year.
105 * Constant for Πικογϫι
106 * μαβοτ/ﺮﻴﻐﺼﻟا
107 * ﺮﻬﺸﻟا,
108 * the 13th month of the Coptic year.
114 BCE
, // Before the epoch
115 CE
// After the epoch
119 * Constructs a CopticCalendar based on the current time in the default time zone
120 * with the given locale.
122 * @param aLocale The given locale.
123 * @param success Indicates the status of CopticCalendar object construction.
124 * Returns U_ZERO_ERROR if constructed successfully.
127 CopticCalendar(const Locale
& aLocale
, UErrorCode
& success
);
133 CopticCalendar (const CopticCalendar
& other
);
139 virtual ~CopticCalendar();
142 * Create and return a polymorphic copy of this calendar.
143 * @return return a polymorphic copy of this calendar.
146 virtual Calendar
* clone(void) const;
149 * return the calendar type, "coptic"
150 * @return calendar type
153 const char * getType() const;
156 //-------------------------------------------------------------------------
157 // Calendar framework
158 //-------------------------------------------------------------------------
161 * Return the extended year defined by the current fields.
164 virtual int32_t handleGetExtendedYear();
167 * Compute fields from the JD
170 virtual void handleComputeFields(int32_t julianDay
, UErrorCode
&status
);
173 * Returns the date of the start of the default century
174 * @return start of century - in milliseconds since epoch, 1970
177 virtual UDate
defaultCenturyStart() const;
180 * Returns the year in which the default century begins
183 virtual int32_t defaultCenturyStartYear() const;
186 * Return the date offset from Julian
189 virtual int32_t getJDEpochOffset() const;
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.
198 static UDate fgSystemDefaultCenturyStart
;
201 * See documentation for systemDefaultCenturyStart.
203 static int32_t fgSystemDefaultCenturyStartYear
;
206 * Default value that indicates the defaultCenturyStartYear is unitialized
208 static const int32_t fgSystemDefaultCenturyYear
;
211 * start of default century, as a date
213 static const UDate fgSystemDefaultCentury
;
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.
220 static void initializeSystemDefaultCentury(void);
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
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.
233 virtual UClassID
getDynamicClassID(void) const;
236 * Return the class ID for this class. This is useful only for comparing to a return
237 * value from getDynamicClassID(). For example:
239 * Base* polymorphic_pointer = createPolymorphicObject();
240 * if (polymorphic_pointer->getDynamicClassID() ==
241 * Derived::getStaticClassID()) ...
243 * @return The class ID for all objects of this class.
246 U_I18N_API
static UClassID U_EXPORT2
getStaticClassID(void);
249 // We do not want to introduce this API in ICU4C.
250 // It was accidentally introduced in ICU4J as a public API.
252 //-------------------------------------------------------------------------
253 // Calendar system Conversion methods...
254 //-------------------------------------------------------------------------
256 * Convert an Coptic year, month, and day to a Julian day.
258 * @param year the extended year
259 * @param month the month
264 static int32_t copticToJD(int32_t year
, int32_t month
, int32_t day
);
270 #endif /* #if !UCONFIG_NO_FORMATTING */
271 #endif /* COPTCCAL_H */