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