1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
4 ********************************************************************************
5 * Copyright (C) 2003-2013, International Business Machines Corporation
6 * and others. All Rights Reserved.
7 ********************************************************************************
11 * Modification History:
13 * Date Name Description
14 * 05/13/2003 srl copied from gregocal.h
15 * 06/29/2007 srl copied from buddhcal.h
16 ********************************************************************************
22 #include "unicode/utypes.h"
24 #if !UCONFIG_NO_FORMATTING
26 #include "unicode/calendar.h"
27 #include "unicode/gregocal.h"
32 * Concrete class which provides the Taiwan calendar.
34 * <code>TaiwanCalendar</code> is a subclass of <code>GregorianCalendar</code>
35 * that numbers years since 1912
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.
41 * The Taiwan Calendar has two eras: <code>BEFORE_MINGUO</code> and <code>MINGUO</code>.
45 class TaiwanCalendar
: public GregorianCalendar
{
49 * Useful constants for TaiwanCalendar. Only one Era.
58 * Constructs a TaiwanCalendar based on the current time in the default time zone
59 * with the given locale.
61 * @param aLocale The given locale.
62 * @param success Indicates the status of TaiwanCalendar object construction.
63 * Returns U_ZERO_ERROR if constructed successfully.
66 TaiwanCalendar(const Locale
& aLocale
, UErrorCode
& success
);
73 virtual ~TaiwanCalendar();
77 * @param source the object to be copied.
80 TaiwanCalendar(const TaiwanCalendar
& source
);
83 * Default assignment operator
84 * @param right the object to be copied.
87 TaiwanCalendar
& operator=(const TaiwanCalendar
& right
);
90 * Create and return a polymorphic copy of this calendar.
91 * @return return a polymorphic copy of this calendar.
94 virtual TaiwanCalendar
* clone() const;
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
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.
107 virtual UClassID
getDynamicClassID(void) const;
110 * Return the class ID for this class. This is useful only for comparing to a return
111 * value from getDynamicClassID(). For example:
113 * Base* polymorphic_pointer = createPolymorphicObject();
114 * if (polymorphic_pointer->getDynamicClassID() ==
115 * Derived::getStaticClassID()) ...
117 * @return The class ID for all objects of this class.
120 U_I18N_API
static UClassID U_EXPORT2
getStaticClassID(void);
123 * return the calendar type, "Taiwan".
125 * @return calendar type
128 virtual const char * getType() const;
131 TaiwanCalendar(); // default constructor not implemented
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
139 * @return the extended year
142 virtual int32_t handleGetExtendedYear();
144 * Subclasses may override this method to compute several fields
145 * specific to each calendar system.
148 virtual void handleComputeFields(int32_t julianDay
, UErrorCode
& status
);
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>
156 virtual int32_t handleGetLimit(UCalendarDateFields field
, ELimitType limitType
) const;
159 * Returns TRUE because the Taiwan Calendar does have a default century
162 virtual UBool
haveDefaultCentury() const;
165 * Returns the date of the start of the default century
166 * @return start of century - in milliseconds since epoch, 1970
169 virtual UDate
defaultCenturyStart() const;
172 * Returns the year in which the default century begins
175 virtual int32_t defaultCenturyStartYear() const;
180 #endif /* #if !UCONFIG_NO_FORMATTING */