Wed, 31 Dec 2014 07:22:50 +0100
Correct previous dual key logic pending first delivery installment.
michael@0 | 1 | /* |
michael@0 | 2 | ******************************************************************************** |
michael@0 | 3 | * Copyright (C) 2003-2013, International Business Machines Corporation |
michael@0 | 4 | * and others. All Rights Reserved. |
michael@0 | 5 | ******************************************************************************** |
michael@0 | 6 | * |
michael@0 | 7 | * File BUDDHCAL.H |
michael@0 | 8 | * |
michael@0 | 9 | * Modification History: |
michael@0 | 10 | * |
michael@0 | 11 | * Date Name Description |
michael@0 | 12 | * 05/13/2003 srl copied from gregocal.h |
michael@0 | 13 | * 06/29/2007 srl copied from buddhcal.h |
michael@0 | 14 | ******************************************************************************** |
michael@0 | 15 | */ |
michael@0 | 16 | |
michael@0 | 17 | #ifndef TAIWNCAL_H |
michael@0 | 18 | #define TAIWNCAL_H |
michael@0 | 19 | |
michael@0 | 20 | #include "unicode/utypes.h" |
michael@0 | 21 | |
michael@0 | 22 | #if !UCONFIG_NO_FORMATTING |
michael@0 | 23 | |
michael@0 | 24 | #include "unicode/calendar.h" |
michael@0 | 25 | #include "unicode/gregocal.h" |
michael@0 | 26 | |
michael@0 | 27 | U_NAMESPACE_BEGIN |
michael@0 | 28 | |
michael@0 | 29 | /** |
michael@0 | 30 | * Concrete class which provides the Taiwan calendar. |
michael@0 | 31 | * <P> |
michael@0 | 32 | * <code>TaiwanCalendar</code> is a subclass of <code>GregorianCalendar</code> |
michael@0 | 33 | * that numbers years since 1912 |
michael@0 | 34 | * <p> |
michael@0 | 35 | * The Taiwan calendar is identical to the Gregorian calendar in all respects |
michael@0 | 36 | * except for the year and era. Years are numbered since 1912 AD (Gregorian), |
michael@0 | 37 | * so that 1912 AD (Gregorian) is equivalent to 1 MINGUO (Minguo Era) and 1998 AD is 87 MINGUO. |
michael@0 | 38 | * <p> |
michael@0 | 39 | * The Taiwan Calendar has two eras: <code>BEFORE_MINGUO</code> and <code>MINGUO</code>. |
michael@0 | 40 | * <p> |
michael@0 | 41 | * @internal |
michael@0 | 42 | */ |
michael@0 | 43 | class TaiwanCalendar : public GregorianCalendar { |
michael@0 | 44 | public: |
michael@0 | 45 | |
michael@0 | 46 | /** |
michael@0 | 47 | * Useful constants for TaiwanCalendar. Only one Era. |
michael@0 | 48 | * @internal |
michael@0 | 49 | */ |
michael@0 | 50 | enum EEras { |
michael@0 | 51 | BEFORE_MINGUO = 0, |
michael@0 | 52 | MINGUO = 1 |
michael@0 | 53 | }; |
michael@0 | 54 | |
michael@0 | 55 | /** |
michael@0 | 56 | * Constructs a TaiwanCalendar based on the current time in the default time zone |
michael@0 | 57 | * with the given locale. |
michael@0 | 58 | * |
michael@0 | 59 | * @param aLocale The given locale. |
michael@0 | 60 | * @param success Indicates the status of TaiwanCalendar object construction. |
michael@0 | 61 | * Returns U_ZERO_ERROR if constructed successfully. |
michael@0 | 62 | * @internal |
michael@0 | 63 | */ |
michael@0 | 64 | TaiwanCalendar(const Locale& aLocale, UErrorCode& success); |
michael@0 | 65 | |
michael@0 | 66 | |
michael@0 | 67 | /** |
michael@0 | 68 | * Destructor |
michael@0 | 69 | * @internal |
michael@0 | 70 | */ |
michael@0 | 71 | virtual ~TaiwanCalendar(); |
michael@0 | 72 | |
michael@0 | 73 | /** |
michael@0 | 74 | * Copy constructor |
michael@0 | 75 | * @param source the object to be copied. |
michael@0 | 76 | * @internal |
michael@0 | 77 | */ |
michael@0 | 78 | TaiwanCalendar(const TaiwanCalendar& source); |
michael@0 | 79 | |
michael@0 | 80 | /** |
michael@0 | 81 | * Default assignment operator |
michael@0 | 82 | * @param right the object to be copied. |
michael@0 | 83 | * @internal |
michael@0 | 84 | */ |
michael@0 | 85 | TaiwanCalendar& operator=(const TaiwanCalendar& right); |
michael@0 | 86 | |
michael@0 | 87 | /** |
michael@0 | 88 | * Create and return a polymorphic copy of this calendar. |
michael@0 | 89 | * @return return a polymorphic copy of this calendar. |
michael@0 | 90 | * @internal |
michael@0 | 91 | */ |
michael@0 | 92 | virtual Calendar* clone(void) const; |
michael@0 | 93 | |
michael@0 | 94 | public: |
michael@0 | 95 | /** |
michael@0 | 96 | * Override Calendar Returns a unique class ID POLYMORPHICALLY. Pure virtual |
michael@0 | 97 | * override. This method is to implement a simple version of RTTI, since not all C++ |
michael@0 | 98 | * compilers support genuine RTTI. Polymorphic operator==() and clone() methods call |
michael@0 | 99 | * this method. |
michael@0 | 100 | * |
michael@0 | 101 | * @return The class ID for this object. All objects of a given class have the |
michael@0 | 102 | * same class ID. Objects of other classes have different class IDs. |
michael@0 | 103 | * @internal |
michael@0 | 104 | */ |
michael@0 | 105 | virtual UClassID getDynamicClassID(void) const; |
michael@0 | 106 | |
michael@0 | 107 | /** |
michael@0 | 108 | * Return the class ID for this class. This is useful only for comparing to a return |
michael@0 | 109 | * value from getDynamicClassID(). For example: |
michael@0 | 110 | * |
michael@0 | 111 | * Base* polymorphic_pointer = createPolymorphicObject(); |
michael@0 | 112 | * if (polymorphic_pointer->getDynamicClassID() == |
michael@0 | 113 | * Derived::getStaticClassID()) ... |
michael@0 | 114 | * |
michael@0 | 115 | * @return The class ID for all objects of this class. |
michael@0 | 116 | * @internal |
michael@0 | 117 | */ |
michael@0 | 118 | U_I18N_API static UClassID U_EXPORT2 getStaticClassID(void); |
michael@0 | 119 | |
michael@0 | 120 | /** |
michael@0 | 121 | * return the calendar type, "Taiwan". |
michael@0 | 122 | * |
michael@0 | 123 | * @return calendar type |
michael@0 | 124 | * @internal |
michael@0 | 125 | */ |
michael@0 | 126 | virtual const char * getType() const; |
michael@0 | 127 | |
michael@0 | 128 | private: |
michael@0 | 129 | TaiwanCalendar(); // default constructor not implemented |
michael@0 | 130 | |
michael@0 | 131 | protected: |
michael@0 | 132 | /** |
michael@0 | 133 | * Return the extended year defined by the current fields. This will |
michael@0 | 134 | * use the UCAL_EXTENDED_YEAR field or the UCAL_YEAR and supra-year fields (such |
michael@0 | 135 | * as UCAL_ERA) specific to the calendar system, depending on which set of |
michael@0 | 136 | * fields is newer. |
michael@0 | 137 | * @return the extended year |
michael@0 | 138 | * @internal |
michael@0 | 139 | */ |
michael@0 | 140 | virtual int32_t handleGetExtendedYear(); |
michael@0 | 141 | /** |
michael@0 | 142 | * Subclasses may override this method to compute several fields |
michael@0 | 143 | * specific to each calendar system. |
michael@0 | 144 | * @internal |
michael@0 | 145 | */ |
michael@0 | 146 | virtual void handleComputeFields(int32_t julianDay, UErrorCode& status); |
michael@0 | 147 | /** |
michael@0 | 148 | * Subclass API for defining limits of different types. |
michael@0 | 149 | * @param field one of the field numbers |
michael@0 | 150 | * @param limitType one of <code>MINIMUM</code>, <code>GREATEST_MINIMUM</code>, |
michael@0 | 151 | * <code>LEAST_MAXIMUM</code>, or <code>MAXIMUM</code> |
michael@0 | 152 | * @internal |
michael@0 | 153 | */ |
michael@0 | 154 | virtual int32_t handleGetLimit(UCalendarDateFields field, ELimitType limitType) const; |
michael@0 | 155 | |
michael@0 | 156 | /** |
michael@0 | 157 | * Returns TRUE because the Taiwan Calendar does have a default century |
michael@0 | 158 | * @internal |
michael@0 | 159 | */ |
michael@0 | 160 | virtual UBool haveDefaultCentury() const; |
michael@0 | 161 | |
michael@0 | 162 | /** |
michael@0 | 163 | * Returns the date of the start of the default century |
michael@0 | 164 | * @return start of century - in milliseconds since epoch, 1970 |
michael@0 | 165 | * @internal |
michael@0 | 166 | */ |
michael@0 | 167 | virtual UDate defaultCenturyStart() const; |
michael@0 | 168 | |
michael@0 | 169 | /** |
michael@0 | 170 | * Returns the year in which the default century begins |
michael@0 | 171 | * @internal |
michael@0 | 172 | */ |
michael@0 | 173 | virtual int32_t defaultCenturyStartYear() const; |
michael@0 | 174 | }; |
michael@0 | 175 | |
michael@0 | 176 | U_NAMESPACE_END |
michael@0 | 177 | |
michael@0 | 178 | #endif /* #if !UCONFIG_NO_FORMATTING */ |
michael@0 | 179 | |
michael@0 | 180 | #endif // _TAIWNCAL |
michael@0 | 181 | //eof |
michael@0 | 182 |