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