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 - 2008, International Business Machines Corporation and * 6 * others. All Rights Reserved. * 7 ******************************************************************************* 8 */ 9 10 #ifndef CECAL_H 11 #define CECAL_H 12 13 #include "unicode/utypes.h" 14 15 #if !UCONFIG_NO_FORMATTING 16 17 #include "unicode/calendar.h" 18 19 U_NAMESPACE_BEGIN 20 21 /** 22 * Base class for EthiopicCalendar and CopticCalendar. 23 * @internal 24 */ 25 class U_I18N_API CECalendar : public Calendar { 26 27 public: 28 29 /** 30 * Gets The Temporal monthCode value corresponding to the month for the date. 31 * The value is a string identifier that starts with the literal grapheme 32 * "M" followed by two graphemes representing the zero-padded month number 33 * of the current month in a normal (non-leap) year. For the short thirteen 34 * month in each year in the CECalendar, the value is "M13". 35 * 36 * @param status ICU Error Code 37 * @return One of 13 possible strings in {"M01".. "M12", "M13"}. 38 * @draft ICU 73 39 */ 40 virtual const char* getTemporalMonthCode(UErrorCode& status) const override; 41 42 /** 43 * Sets The Temporal monthCode which is a string identifier that starts 44 * with the literal grapheme "M" followed by two graphemes representing 45 * the zero-padded month number of the current month in a normal 46 * (non-leap) year. For CECalendar calendar, the values 47 * are "M01" .. "M13" while the "M13" is represent the short thirteen month 48 * in each year. 49 * 50 * @param temporalMonth The value to be set for temporal monthCode. 51 * @param status ICU Error Code 52 * 53 * @draft ICU 73 54 */ 55 virtual void setTemporalMonthCode(const char* code, UErrorCode& status) override; 56 57 protected: 58 //------------------------------------------------------------------------- 59 // Constructors... 60 //------------------------------------------------------------------------- 61 62 /** 63 * Constructs a CECalendar based on the current time in the default time zone 64 * with the given locale with the Julian epoch offiset 65 * 66 * @param aLocale The given locale. 67 * @param success Indicates the status of CECalendar object construction. 68 * Returns U_ZERO_ERROR if constructed successfully. 69 * @internal 70 */ 71 CECalendar(const Locale& aLocale, UErrorCode& success); 72 73 /** 74 * Copy Constructor 75 * @internal 76 */ 77 CECalendar (const CECalendar& other); 78 79 /** 80 * Destructor. 81 * @internal 82 */ 83 virtual ~CECalendar(); 84 85 /** 86 * Default assignment operator 87 * @param right Calendar object to be copied 88 * @internal 89 */ 90 CECalendar& operator=(const CECalendar& right); 91 92 protected: 93 //------------------------------------------------------------------------- 94 // Calendar framework 95 //------------------------------------------------------------------------- 96 97 /** 98 * Return JD of start of given month/extended year 99 * @internal 100 */ 101 virtual int32_t handleComputeMonthStart(int32_t eyear, int32_t month, UBool useMonth) const override; 102 103 /** 104 * Calculate the limit for a specified type of limit and field 105 * @internal 106 */ 107 virtual int32_t handleGetLimit(UCalendarDateFields field, ELimitType limitType) const override; 108 109 /** 110 * Returns true because Coptic/Ethiopic Calendar does have a default century 111 * @internal 112 */ 113 virtual UBool haveDefaultCentury() const override; 114 115 protected: 116 /** 117 * The Coptic and Ethiopic calendars differ only in their epochs. 118 * This method must be implemented by CECalendar subclasses to 119 * return the date offset from Julian 120 * @internal 121 */ 122 virtual int32_t getJDEpochOffset() const = 0; 123 124 /** 125 * Convert an Coptic/Ethiopic year, month, and day to a Julian day. 126 * 127 * @param year the extended year 128 * @param month the month 129 * @param day the day 130 * @param jdEpochOffset the epoch offset from Julian epoch 131 * @return Julian day 132 * @internal 133 */ 134 static int32_t ceToJD(int32_t year, int32_t month, int32_t date, 135 int32_t jdEpochOffset); 136 137 /** 138 * Convert a Julian day to an Coptic/Ethiopic year, month and day 139 * 140 * @param julianDay the Julian day 141 * @param jdEpochOffset the epoch offset from Julian epoch 142 * @param year receives the extended year 143 * @param month receives the month 144 * @param date receives the day 145 * @internal 146 */ 147 static void jdToCE(int32_t julianDay, int32_t jdEpochOffset, 148 int32_t& year, int32_t& month, int32_t& day); 149 }; 150 151 U_NAMESPACE_END 152 153 #endif /* #if !UCONFIG_NO_FORMATTING */ 154 #endif 155 //eof 156