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(UErrorCode& status) override; 181 182 /** 183 * Compute fields from the JD 184 * @internal 185 */ 186 virtual void handleComputeFields(int32_t julianDay, UErrorCode &status) override; 187 188 DECLARE_OVERRIDE_SYSTEM_DEFAULT_CENTURY 189 190 /** 191 * Return the date offset from Julian 192 * @internal 193 */ 194 virtual int32_t getJDEpochOffset() const override; 195 isEra0CountingBackward()196 virtual bool isEra0CountingBackward() const override { return true; } 197 public: 198 /** 199 * Override Calendar Returns a unique class ID POLYMORPHICALLY. Pure virtual 200 * override. This method is to implement a simple version of RTTI, since not all C++ 201 * compilers support genuine RTTI. Polymorphic operator==() and clone() methods call 202 * this method. 203 * 204 * @return The class ID for this object. All objects of a given class have the 205 * same class ID. Objects of other classes have different class IDs. 206 * @internal 207 */ 208 virtual UClassID getDynamicClassID() const override; 209 210 /** 211 * Return the class ID for this class. This is useful only for comparing to a return 212 * value from getDynamicClassID(). For example: 213 * 214 * Base* polymorphic_pointer = createPolymorphicObject(); 215 * if (polymorphic_pointer->getDynamicClassID() == 216 * Derived::getStaticClassID()) ... 217 * 218 * @return The class ID for all objects of this class. 219 * @internal 220 */ 221 U_I18N_API static UClassID U_EXPORT2 getStaticClassID(); 222 223 #if 0 224 // We do not want to introduce this API in ICU4C. 225 // It was accidentally introduced in ICU4J as a public API. 226 public: 227 //------------------------------------------------------------------------- 228 // Calendar system Conversion methods... 229 //------------------------------------------------------------------------- 230 /** 231 * Convert an Coptic year, month, and day to a Julian day. 232 * 233 * @param year the extended year 234 * @param month the month 235 * @param day the day 236 * @return Julian day 237 * @internal 238 */ 239 static int32_t copticToJD(int32_t year, int32_t month, int32_t day); 240 #endif 241 }; 242 243 U_NAMESPACE_END 244 245 #endif /* #if !UCONFIG_NO_FORMATTING */ 246 #endif /* COPTCCAL_H */ 247 //eof 248