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