2 *******************************************************************************
3 * Copyright (C) 2003 - 2008, International Business Machines Corporation and *
4 * others. All Rights Reserved. *
5 *******************************************************************************
11 #include "unicode/utypes.h"
13 #if !UCONFIG_NO_FORMATTING
15 #include "unicode/calendar.h"
20 * Base class for EthiopicCalendar and CopticCalendar.
23 class U_I18N_API CECalendar
: public Calendar
{
26 //-------------------------------------------------------------------------
28 //-------------------------------------------------------------------------
31 * Constructs a CECalendar based on the current time in the default time zone
32 * with the given locale with the Julian epoch offiset
34 * @param aLocale The given locale.
35 * @param success Indicates the status of CECalendar object construction.
36 * Returns U_ZERO_ERROR if constructed successfully.
39 CECalendar(const Locale
& aLocale
, UErrorCode
& success
);
45 CECalendar (const CECalendar
& other
);
51 virtual ~CECalendar();
54 * Default assignment operator
55 * @param right Calendar object to be copied
58 CECalendar
& operator=(const CECalendar
& right
);
61 //-------------------------------------------------------------------------
63 //-------------------------------------------------------------------------
66 * Return JD of start of given month/extended year
69 virtual int32_t handleComputeMonthStart(int32_t eyear
, int32_t month
, UBool useMonth
) const;
72 * Calculate the limit for a specified type of limit and field
75 virtual int32_t handleGetLimit(UCalendarDateFields field
, ELimitType limitType
) const;
78 * (Overrides Calendar) Return true if the current date for this Calendar is in
79 * Daylight Savings Time. Recognizes DST_OFFSET, if it is set.
81 * @param status Fill-in parameter which receives the status of this operation.
82 * @return True if the current date for this Calendar is in Daylight Savings Time,
86 virtual UBool
inDaylightTime(UErrorCode
&) const;
89 * Returns TRUE because Coptic/Ethiopic Calendar does have a default century
92 virtual UBool
haveDefaultCentury() const;
96 * The Coptic and Ethiopic calendars differ only in their epochs.
97 * This method must be implemented by CECalendar subclasses to
98 * return the date offset from Julian
101 virtual int32_t getJDEpochOffset() const = 0;
104 * Convert an Coptic/Ethiopic year, month, and day to a Julian day.
106 * @param year the extended year
107 * @param month the month
109 * @param jdEpochOffset the epoch offset from Julian epoch
113 static int32_t ceToJD(int32_t year
, int32_t month
, int32_t date
,
114 int32_t jdEpochOffset
);
117 * Convert a Julian day to an Coptic/Ethiopic year, month and day
119 * @param julianDay the Julian day
120 * @param jdEpochOffset the epoch offset from Julian epoch
121 * @param year receives the extended year
122 * @param month receives the month
123 * @param date receives the day
126 static void jdToCE(int32_t julianDay
, int32_t jdEpochOffset
,
127 int32_t& year
, int32_t& month
, int32_t& day
);
132 #endif /* #if !UCONFIG_NO_FORMATTING */