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 protected: 28 //------------------------------------------------------------------------- 29 // Constructors... 30 //------------------------------------------------------------------------- 31 32 /** 33 * Constructs a CECalendar based on the current time in the default time zone 34 * with the given locale with the Julian epoch offiset 35 * 36 * @param aLocale The given locale. 37 * @param success Indicates the status of CECalendar object construction. 38 * Returns U_ZERO_ERROR if constructed successfully. 39 * @internal 40 */ 41 CECalendar(const Locale& aLocale, UErrorCode& success); 42 43 /** 44 * Copy Constructor 45 * @internal 46 */ 47 CECalendar (const CECalendar& other); 48 49 /** 50 * Destructor. 51 * @internal 52 */ 53 virtual ~CECalendar(); 54 55 /** 56 * Default assignment operator 57 * @param right Calendar object to be copied 58 * @internal 59 */ 60 CECalendar& operator=(const CECalendar& right); 61 62 protected: 63 //------------------------------------------------------------------------- 64 // Calendar framework 65 //------------------------------------------------------------------------- 66 67 /** 68 * Return JD of start of given month/extended year 69 * @internal 70 */ 71 virtual int32_t handleComputeMonthStart(int32_t eyear, int32_t month, UBool useMonth) const override; 72 73 /** 74 * Calculate the limit for a specified type of limit and field 75 * @internal 76 */ 77 virtual int32_t handleGetLimit(UCalendarDateFields field, ELimitType limitType) const override; 78 79 /** 80 * (Overrides Calendar) Return true if the current date for this Calendar is in 81 * Daylight Savings Time. Recognizes DST_OFFSET, if it is set. 82 * 83 * @param status Fill-in parameter which receives the status of this operation. 84 * @return True if the current date for this Calendar is in Daylight Savings Time, 85 * false, otherwise. 86 * @internal 87 */ 88 virtual UBool inDaylightTime(UErrorCode&) const override; 89 90 /** 91 * Returns true because Coptic/Ethiopic Calendar does have a default century 92 * @internal 93 */ 94 virtual UBool haveDefaultCentury() const override; 95 96 protected: 97 /** 98 * The Coptic and Ethiopic calendars differ only in their epochs. 99 * This method must be implemented by CECalendar subclasses to 100 * return the date offset from Julian 101 * @internal 102 */ 103 virtual int32_t getJDEpochOffset() const = 0; 104 105 /** 106 * Convert an Coptic/Ethiopic year, month, and day to a Julian day. 107 * 108 * @param year the extended year 109 * @param month the month 110 * @param day the day 111 * @param jdEpochOffset the epoch offset from Julian epoch 112 * @return Julian day 113 * @internal 114 */ 115 static int32_t ceToJD(int32_t year, int32_t month, int32_t date, 116 int32_t jdEpochOffset); 117 118 /** 119 * Convert a Julian day to an Coptic/Ethiopic year, month and day 120 * 121 * @param julianDay the Julian day 122 * @param jdEpochOffset the epoch offset from Julian epoch 123 * @param year receives the extended year 124 * @param month receives the month 125 * @param date receives the day 126 * @internal 127 */ 128 static void jdToCE(int32_t julianDay, int32_t jdEpochOffset, 129 int32_t& year, int32_t& month, int32_t& day); 130 }; 131 132 U_NAMESPACE_END 133 134 #endif /* #if !UCONFIG_NO_FORMATTING */ 135 #endif 136 //eof 137