1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
4 *******************************************************************************
5 * Copyright (C) 2003 - 2008, International Business Machines Corporation and *
6 * others. All Rights Reserved. *
7 *******************************************************************************
13 #include "unicode/utypes.h"
15 #if !UCONFIG_NO_FORMATTING
17 #include "unicode/calendar.h"
22 * Base class for EthiopicCalendar and CopticCalendar.
25 class U_I18N_API CECalendar
: public Calendar
{
28 //-------------------------------------------------------------------------
30 //-------------------------------------------------------------------------
33 * Constructs a CECalendar based on the current time in the default time zone
34 * with the given locale with the Julian epoch offiset
36 * @param aLocale The given locale.
37 * @param success Indicates the status of CECalendar object construction.
38 * Returns U_ZERO_ERROR if constructed successfully.
41 CECalendar(const Locale
& aLocale
, UErrorCode
& success
);
47 CECalendar (const CECalendar
& other
);
53 virtual ~CECalendar();
56 * Default assignment operator
57 * @param right Calendar object to be copied
60 CECalendar
& operator=(const CECalendar
& right
);
63 //-------------------------------------------------------------------------
65 //-------------------------------------------------------------------------
68 * Return JD of start of given month/extended year
71 virtual int32_t handleComputeMonthStart(int32_t eyear
, int32_t month
, UBool useMonth
) const;
74 * Calculate the limit for a specified type of limit and field
77 virtual int32_t handleGetLimit(UCalendarDateFields field
, ELimitType limitType
) const;
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.
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,
88 virtual UBool
inDaylightTime(UErrorCode
&) const;
91 * Returns TRUE because Coptic/Ethiopic Calendar does have a default century
94 virtual UBool
haveDefaultCentury() const;
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
103 virtual int32_t getJDEpochOffset() const = 0;
106 * Convert an Coptic/Ethiopic year, month, and day to a Julian day.
108 * @param year the extended year
109 * @param month the month
111 * @param jdEpochOffset the epoch offset from Julian epoch
115 static int32_t ceToJD(int32_t year
, int32_t month
, int32_t date
,
116 int32_t jdEpochOffset
);
119 * Convert a Julian day to an Coptic/Ethiopic year, month and day
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
128 static void jdToCE(int32_t julianDay
, int32_t jdEpochOffset
,
129 int32_t& year
, int32_t& month
, int32_t& day
);
134 #endif /* #if !UCONFIG_NO_FORMATTING */