michael@0: /* michael@0: ******************************************************************************* michael@0: * Copyright (C) 2003 - 2008, International Business Machines Corporation and * michael@0: * others. All Rights Reserved. * michael@0: ******************************************************************************* michael@0: */ michael@0: michael@0: #ifndef CECAL_H michael@0: #define CECAL_H michael@0: michael@0: #include "unicode/utypes.h" michael@0: michael@0: #if !UCONFIG_NO_FORMATTING michael@0: michael@0: #include "unicode/calendar.h" michael@0: michael@0: U_NAMESPACE_BEGIN michael@0: michael@0: /** michael@0: * Base class for EthiopicCalendar and CopticCalendar. michael@0: * @internal michael@0: */ michael@0: class U_I18N_API CECalendar : public Calendar { michael@0: michael@0: protected: michael@0: //------------------------------------------------------------------------- michael@0: // Constructors... michael@0: //------------------------------------------------------------------------- michael@0: michael@0: /** michael@0: * Constructs a CECalendar based on the current time in the default time zone michael@0: * with the given locale with the Julian epoch offiset michael@0: * michael@0: * @param aLocale The given locale. michael@0: * @param success Indicates the status of CECalendar object construction. michael@0: * Returns U_ZERO_ERROR if constructed successfully. michael@0: * @internal michael@0: */ michael@0: CECalendar(const Locale& aLocale, UErrorCode& success); michael@0: michael@0: /** michael@0: * Copy Constructor michael@0: * @internal michael@0: */ michael@0: CECalendar (const CECalendar& other); michael@0: michael@0: /** michael@0: * Destructor. michael@0: * @internal michael@0: */ michael@0: virtual ~CECalendar(); michael@0: michael@0: /** michael@0: * Default assignment operator michael@0: * @param right Calendar object to be copied michael@0: * @internal michael@0: */ michael@0: CECalendar& operator=(const CECalendar& right); michael@0: michael@0: protected: michael@0: //------------------------------------------------------------------------- michael@0: // Calendar framework michael@0: //------------------------------------------------------------------------- michael@0: michael@0: /** michael@0: * Return JD of start of given month/extended year michael@0: * @internal michael@0: */ michael@0: virtual int32_t handleComputeMonthStart(int32_t eyear, int32_t month, UBool useMonth) const; michael@0: michael@0: /** michael@0: * Calculate the limit for a specified type of limit and field michael@0: * @internal michael@0: */ michael@0: virtual int32_t handleGetLimit(UCalendarDateFields field, ELimitType limitType) const; michael@0: michael@0: /** michael@0: * (Overrides Calendar) Return true if the current date for this Calendar is in michael@0: * Daylight Savings Time. Recognizes DST_OFFSET, if it is set. michael@0: * michael@0: * @param status Fill-in parameter which receives the status of this operation. michael@0: * @return True if the current date for this Calendar is in Daylight Savings Time, michael@0: * false, otherwise. michael@0: * @internal michael@0: */ michael@0: virtual UBool inDaylightTime(UErrorCode&) const; michael@0: michael@0: /** michael@0: * Returns TRUE because Coptic/Ethiopic Calendar does have a default century michael@0: * @internal michael@0: */ michael@0: virtual UBool haveDefaultCentury() const; michael@0: michael@0: protected: michael@0: /** michael@0: * The Coptic and Ethiopic calendars differ only in their epochs. michael@0: * This method must be implemented by CECalendar subclasses to michael@0: * return the date offset from Julian michael@0: * @internal michael@0: */ michael@0: virtual int32_t getJDEpochOffset() const = 0; michael@0: michael@0: /** michael@0: * Convert an Coptic/Ethiopic year, month, and day to a Julian day. michael@0: * michael@0: * @param year the extended year michael@0: * @param month the month michael@0: * @param day the day michael@0: * @param jdEpochOffset the epoch offset from Julian epoch michael@0: * @return Julian day michael@0: * @internal michael@0: */ michael@0: static int32_t ceToJD(int32_t year, int32_t month, int32_t date, michael@0: int32_t jdEpochOffset); michael@0: michael@0: /** michael@0: * Convert a Julian day to an Coptic/Ethiopic year, month and day michael@0: * michael@0: * @param julianDay the Julian day michael@0: * @param jdEpochOffset the epoch offset from Julian epoch michael@0: * @param year receives the extended year michael@0: * @param month receives the month michael@0: * @param date receives the day michael@0: * @internal michael@0: */ michael@0: static void jdToCE(int32_t julianDay, int32_t jdEpochOffset, michael@0: int32_t& year, int32_t& month, int32_t& day); michael@0: }; michael@0: michael@0: U_NAMESPACE_END michael@0: michael@0: #endif /* #if !UCONFIG_NO_FORMATTING */ michael@0: #endif michael@0: //eof