cecal.h (4190B)
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 protected: 86 //------------------------------------------------------------------------- 87 // Calendar framework 88 //------------------------------------------------------------------------- 89 90 /** 91 * Return JD of start of given month/extended year 92 * @internal 93 */ 94 virtual int64_t handleComputeMonthStart(int32_t eyear, int32_t month, UBool useMonth, UErrorCode& status) const override; 95 96 /** 97 * Calculate the limit for a specified type of limit and field 98 * @internal 99 */ 100 virtual int32_t handleGetLimit(UCalendarDateFields field, ELimitType limitType) const override; 101 102 /** 103 * Compute fields from the JD 104 * @internal 105 */ 106 virtual void handleComputeFields(int32_t julianDay, UErrorCode &status) override; 107 108 protected: 109 /** 110 * The Coptic and Ethiopic calendars differ only in their epochs. 111 * This method must be implemented by CECalendar subclasses to 112 * return the date offset from Julian 113 * @internal 114 */ 115 virtual int32_t getJDEpochOffset() const = 0; 116 117 /** 118 * Compute the era from extended year. 119 * @internal 120 */ 121 virtual int32_t extendedYearToEra(int32_t extendedYear) const = 0; 122 123 /** 124 * Compute the year from extended year. 125 * @internal 126 */ 127 virtual int32_t extendedYearToYear(int32_t extendedYear) const = 0; 128 }; 129 130 U_NAMESPACE_END 131 132 #endif /* #if !UCONFIG_NO_FORMATTING */ 133 #endif 134 //eof