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 CopticCalendar* clone() const override; 149 150 /** 151 * return the calendar type, "coptic" 152 * @return calendar type 153 * @internal 154 */ 155 const char * getType() const override; 156 157 /** 158 * @return The related Gregorian year; will be obtained by modifying the value 159 * obtained by get from UCAL_EXTENDED_YEAR field 160 * @internal 161 */ 162 virtual int32_t getRelatedYear(UErrorCode &status) const override; 163 164 /** 165 * @param year The related Gregorian year to set; will be modified as necessary then 166 * set in UCAL_EXTENDED_YEAR field 167 * @internal 168 */ 169 virtual void setRelatedYear(int32_t year) override; 170 171 protected: 172 //------------------------------------------------------------------------- 173 // Calendar framework 174 //------------------------------------------------------------------------- 175 176 /** 177 * Return the extended year defined by the current fields. 178 * @internal 179 */ 180 virtual int32_t handleGetExtendedYear() override; 181 182 /** 183 * Compute fields from the JD 184 * @internal 185 */ 186 virtual void handleComputeFields(int32_t julianDay, UErrorCode &status) override; 187 188 /** 189 * Returns the date of the start of the default century 190 * @return start of century - in milliseconds since epoch, 1970 191 * @internal 192 */ 193 virtual UDate defaultCenturyStart() const override; 194 195 /** 196 * Returns the year in which the default century begins 197 * @internal 198 */ 199 virtual int32_t defaultCenturyStartYear() const override; 200 201 /** 202 * Return the date offset from Julian 203 * @internal 204 */ 205 virtual int32_t getJDEpochOffset() const override; 206 207 208 public: 209 /** 210 * Override Calendar Returns a unique class ID POLYMORPHICALLY. Pure virtual 211 * override. This method is to implement a simple version of RTTI, since not all C++ 212 * compilers support genuine RTTI. Polymorphic operator==() and clone() methods call 213 * this method. 214 * 215 * @return The class ID for this object. All objects of a given class have the 216 * same class ID. Objects of other classes have different class IDs. 217 * @internal 218 */ 219 virtual UClassID getDynamicClassID() const override; 220 221 /** 222 * Return the class ID for this class. This is useful only for comparing to a return 223 * value from getDynamicClassID(). For example: 224 * 225 * Base* polymorphic_pointer = createPolymorphicObject(); 226 * if (polymorphic_pointer->getDynamicClassID() == 227 * Derived::getStaticClassID()) ... 228 * 229 * @return The class ID for all objects of this class. 230 * @internal 231 */ 232 U_I18N_API static UClassID U_EXPORT2 getStaticClassID(); 233 234 #if 0 235 // We do not want to introduce this API in ICU4C. 236 // It was accidentally introduced in ICU4J as a public API. 237 public: 238 //------------------------------------------------------------------------- 239 // Calendar system Conversion methods... 240 //------------------------------------------------------------------------- 241 /** 242 * Convert an Coptic year, month, and day to a Julian day. 243 * 244 * @param year the extended year 245 * @param month the month 246 * @param day the day 247 * @return Julian day 248 * @internal 249 */ 250 static int32_t copticToJD(int32_t year, int32_t month, int32_t day); 251 #endif 252 }; 253 254 U_NAMESPACE_END 255 256 #endif /* #if !UCONFIG_NO_FORMATTING */ 257 #endif /* COPTCCAL_H */ 258 //eof 259