Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* |
michael@0 | 2 | ******************************************************************************* |
michael@0 | 3 | * Copyright (C) 2003 - 2008, International Business Machines Corporation and * |
michael@0 | 4 | * others. All Rights Reserved. * |
michael@0 | 5 | ******************************************************************************* |
michael@0 | 6 | */ |
michael@0 | 7 | |
michael@0 | 8 | #ifndef CECAL_H |
michael@0 | 9 | #define CECAL_H |
michael@0 | 10 | |
michael@0 | 11 | #include "unicode/utypes.h" |
michael@0 | 12 | |
michael@0 | 13 | #if !UCONFIG_NO_FORMATTING |
michael@0 | 14 | |
michael@0 | 15 | #include "unicode/calendar.h" |
michael@0 | 16 | |
michael@0 | 17 | U_NAMESPACE_BEGIN |
michael@0 | 18 | |
michael@0 | 19 | /** |
michael@0 | 20 | * Base class for EthiopicCalendar and CopticCalendar. |
michael@0 | 21 | * @internal |
michael@0 | 22 | */ |
michael@0 | 23 | class U_I18N_API CECalendar : public Calendar { |
michael@0 | 24 | |
michael@0 | 25 | protected: |
michael@0 | 26 | //------------------------------------------------------------------------- |
michael@0 | 27 | // Constructors... |
michael@0 | 28 | //------------------------------------------------------------------------- |
michael@0 | 29 | |
michael@0 | 30 | /** |
michael@0 | 31 | * Constructs a CECalendar based on the current time in the default time zone |
michael@0 | 32 | * with the given locale with the Julian epoch offiset |
michael@0 | 33 | * |
michael@0 | 34 | * @param aLocale The given locale. |
michael@0 | 35 | * @param success Indicates the status of CECalendar object construction. |
michael@0 | 36 | * Returns U_ZERO_ERROR if constructed successfully. |
michael@0 | 37 | * @internal |
michael@0 | 38 | */ |
michael@0 | 39 | CECalendar(const Locale& aLocale, UErrorCode& success); |
michael@0 | 40 | |
michael@0 | 41 | /** |
michael@0 | 42 | * Copy Constructor |
michael@0 | 43 | * @internal |
michael@0 | 44 | */ |
michael@0 | 45 | CECalendar (const CECalendar& other); |
michael@0 | 46 | |
michael@0 | 47 | /** |
michael@0 | 48 | * Destructor. |
michael@0 | 49 | * @internal |
michael@0 | 50 | */ |
michael@0 | 51 | virtual ~CECalendar(); |
michael@0 | 52 | |
michael@0 | 53 | /** |
michael@0 | 54 | * Default assignment operator |
michael@0 | 55 | * @param right Calendar object to be copied |
michael@0 | 56 | * @internal |
michael@0 | 57 | */ |
michael@0 | 58 | CECalendar& operator=(const CECalendar& right); |
michael@0 | 59 | |
michael@0 | 60 | protected: |
michael@0 | 61 | //------------------------------------------------------------------------- |
michael@0 | 62 | // Calendar framework |
michael@0 | 63 | //------------------------------------------------------------------------- |
michael@0 | 64 | |
michael@0 | 65 | /** |
michael@0 | 66 | * Return JD of start of given month/extended year |
michael@0 | 67 | * @internal |
michael@0 | 68 | */ |
michael@0 | 69 | virtual int32_t handleComputeMonthStart(int32_t eyear, int32_t month, UBool useMonth) const; |
michael@0 | 70 | |
michael@0 | 71 | /** |
michael@0 | 72 | * Calculate the limit for a specified type of limit and field |
michael@0 | 73 | * @internal |
michael@0 | 74 | */ |
michael@0 | 75 | virtual int32_t handleGetLimit(UCalendarDateFields field, ELimitType limitType) const; |
michael@0 | 76 | |
michael@0 | 77 | /** |
michael@0 | 78 | * (Overrides Calendar) Return true if the current date for this Calendar is in |
michael@0 | 79 | * Daylight Savings Time. Recognizes DST_OFFSET, if it is set. |
michael@0 | 80 | * |
michael@0 | 81 | * @param status Fill-in parameter which receives the status of this operation. |
michael@0 | 82 | * @return True if the current date for this Calendar is in Daylight Savings Time, |
michael@0 | 83 | * false, otherwise. |
michael@0 | 84 | * @internal |
michael@0 | 85 | */ |
michael@0 | 86 | virtual UBool inDaylightTime(UErrorCode&) const; |
michael@0 | 87 | |
michael@0 | 88 | /** |
michael@0 | 89 | * Returns TRUE because Coptic/Ethiopic Calendar does have a default century |
michael@0 | 90 | * @internal |
michael@0 | 91 | */ |
michael@0 | 92 | virtual UBool haveDefaultCentury() const; |
michael@0 | 93 | |
michael@0 | 94 | protected: |
michael@0 | 95 | /** |
michael@0 | 96 | * The Coptic and Ethiopic calendars differ only in their epochs. |
michael@0 | 97 | * This method must be implemented by CECalendar subclasses to |
michael@0 | 98 | * return the date offset from Julian |
michael@0 | 99 | * @internal |
michael@0 | 100 | */ |
michael@0 | 101 | virtual int32_t getJDEpochOffset() const = 0; |
michael@0 | 102 | |
michael@0 | 103 | /** |
michael@0 | 104 | * Convert an Coptic/Ethiopic year, month, and day to a Julian day. |
michael@0 | 105 | * |
michael@0 | 106 | * @param year the extended year |
michael@0 | 107 | * @param month the month |
michael@0 | 108 | * @param day the day |
michael@0 | 109 | * @param jdEpochOffset the epoch offset from Julian epoch |
michael@0 | 110 | * @return Julian day |
michael@0 | 111 | * @internal |
michael@0 | 112 | */ |
michael@0 | 113 | static int32_t ceToJD(int32_t year, int32_t month, int32_t date, |
michael@0 | 114 | int32_t jdEpochOffset); |
michael@0 | 115 | |
michael@0 | 116 | /** |
michael@0 | 117 | * Convert a Julian day to an Coptic/Ethiopic year, month and day |
michael@0 | 118 | * |
michael@0 | 119 | * @param julianDay the Julian day |
michael@0 | 120 | * @param jdEpochOffset the epoch offset from Julian epoch |
michael@0 | 121 | * @param year receives the extended year |
michael@0 | 122 | * @param month receives the month |
michael@0 | 123 | * @param date receives the day |
michael@0 | 124 | * @internal |
michael@0 | 125 | */ |
michael@0 | 126 | static void jdToCE(int32_t julianDay, int32_t jdEpochOffset, |
michael@0 | 127 | int32_t& year, int32_t& month, int32_t& day); |
michael@0 | 128 | }; |
michael@0 | 129 | |
michael@0 | 130 | U_NAMESPACE_END |
michael@0 | 131 | |
michael@0 | 132 | #endif /* #if !UCONFIG_NO_FORMATTING */ |
michael@0 | 133 | #endif |
michael@0 | 134 | //eof |