coptccal.h (6773B)
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 protected: 158 //------------------------------------------------------------------------- 159 // Calendar framework 160 //------------------------------------------------------------------------- 161 162 /** 163 * @internal 164 */ 165 int32_t getRelatedYearDifference() const override; 166 167 /** 168 * Return the extended year defined by the current fields. 169 * @internal 170 */ 171 virtual int32_t handleGetExtendedYear(UErrorCode& status) override; 172 173 /** 174 * Calculate the limit for a specified type of limit and field 175 * @internal 176 */ 177 virtual int32_t handleGetLimit(UCalendarDateFields field, ELimitType limitType) const override; 178 179 DECLARE_OVERRIDE_SYSTEM_DEFAULT_CENTURY 180 181 /** 182 * Return the date offset from Julian 183 * @internal 184 */ 185 int32_t getJDEpochOffset() const override; 186 187 /** 188 * Compute the era from extended year. 189 * @internal 190 */ 191 int32_t extendedYearToEra(int32_t extendedYear) const override; 192 193 /** 194 * Compute the year from extended year. 195 * @internal 196 */ 197 int32_t extendedYearToYear(int32_t extendedYear) const override; 198 public: 199 /** 200 * Override Calendar Returns a unique class ID POLYMORPHICALLY. Pure virtual 201 * override. This method is to implement a simple version of RTTI, since not all C++ 202 * compilers support genuine RTTI. Polymorphic operator==() and clone() methods call 203 * this method. 204 * 205 * @return The class ID for this object. All objects of a given class have the 206 * same class ID. Objects of other classes have different class IDs. 207 * @internal 208 */ 209 virtual UClassID getDynamicClassID() const override; 210 211 /** 212 * Return the class ID for this class. This is useful only for comparing to a return 213 * value from getDynamicClassID(). For example: 214 * 215 * Base* polymorphic_pointer = createPolymorphicObject(); 216 * if (polymorphic_pointer->getDynamicClassID() == 217 * Derived::getStaticClassID()) ... 218 * 219 * @return The class ID for all objects of this class. 220 * @internal 221 */ 222 U_I18N_API static UClassID U_EXPORT2 getStaticClassID(); 223 224 }; 225 226 U_NAMESPACE_END 227 228 #endif /* #if !UCONFIG_NO_FORMATTING */ 229 #endif /* COPTCCAL_H */ 230 //eof