xref: /aosp_15_r20/external/icu/libicu/cts_headers/unicode/simpletz.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) 1997-2013, International Business Machines                     *
6*0e209d39SAndroid Build Coastguard Worker  * Corporation and others. All Rights Reserved.                                 *
7*0e209d39SAndroid Build Coastguard Worker  ********************************************************************************
8*0e209d39SAndroid Build Coastguard Worker  *
9*0e209d39SAndroid Build Coastguard Worker  * File SIMPLETZ.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  *   04/21/97    aliu        Overhauled header.
15*0e209d39SAndroid Build Coastguard Worker  *   08/10/98    stephen     JDK 1.2 sync
16*0e209d39SAndroid Build Coastguard Worker  *                           Added setStartRule() / setEndRule() overloads
17*0e209d39SAndroid Build Coastguard Worker  *                           Added hasSameRules()
18*0e209d39SAndroid Build Coastguard Worker  *   09/02/98    stephen     Added getOffset(monthLen)
19*0e209d39SAndroid Build Coastguard Worker  *                           Changed getOffset() to take UErrorCode
20*0e209d39SAndroid Build Coastguard Worker  *   07/09/99    stephen     Removed millisPerHour (unused, for HP compiler)
21*0e209d39SAndroid Build Coastguard Worker  *   12/02/99    aliu        Added TimeMode and constructor and setStart/EndRule
22*0e209d39SAndroid Build Coastguard Worker  *                           methods that take TimeMode. Added to docs.
23*0e209d39SAndroid Build Coastguard Worker  ********************************************************************************
24*0e209d39SAndroid Build Coastguard Worker  */
25*0e209d39SAndroid Build Coastguard Worker 
26*0e209d39SAndroid Build Coastguard Worker #ifndef SIMPLETZ_H
27*0e209d39SAndroid Build Coastguard Worker #define SIMPLETZ_H
28*0e209d39SAndroid Build Coastguard Worker 
29*0e209d39SAndroid Build Coastguard Worker #include "unicode/utypes.h"
30*0e209d39SAndroid Build Coastguard Worker 
31*0e209d39SAndroid Build Coastguard Worker #if U_SHOW_CPLUSPLUS_API
32*0e209d39SAndroid Build Coastguard Worker 
33*0e209d39SAndroid Build Coastguard Worker /**
34*0e209d39SAndroid Build Coastguard Worker  * \file
35*0e209d39SAndroid Build Coastguard Worker  * \brief C++ API: SimpleTimeZone is a concrete subclass of TimeZone.
36*0e209d39SAndroid Build Coastguard Worker  */
37*0e209d39SAndroid Build Coastguard Worker 
38*0e209d39SAndroid Build Coastguard Worker #if !UCONFIG_NO_FORMATTING
39*0e209d39SAndroid Build Coastguard Worker 
40*0e209d39SAndroid Build Coastguard Worker #include "unicode/basictz.h"
41*0e209d39SAndroid Build Coastguard Worker 
42*0e209d39SAndroid Build Coastguard Worker U_NAMESPACE_BEGIN
43*0e209d39SAndroid Build Coastguard Worker 
44*0e209d39SAndroid Build Coastguard Worker // forward declaration
45*0e209d39SAndroid Build Coastguard Worker class InitialTimeZoneRule;
46*0e209d39SAndroid Build Coastguard Worker class TimeZoneTransition;
47*0e209d39SAndroid Build Coastguard Worker class AnnualTimeZoneRule;
48*0e209d39SAndroid Build Coastguard Worker 
49*0e209d39SAndroid Build Coastguard Worker /**
50*0e209d39SAndroid Build Coastguard Worker  * <code>SimpleTimeZone</code> is a concrete subclass of <code>TimeZone</code>
51*0e209d39SAndroid Build Coastguard Worker  * that represents a time zone for use with a Gregorian calendar. This
52*0e209d39SAndroid Build Coastguard Worker  * class does not handle historical changes.
53*0e209d39SAndroid Build Coastguard Worker  * <P>
54*0e209d39SAndroid Build Coastguard Worker  * When specifying daylight-savings-time begin and end dates, use a negative value for
55*0e209d39SAndroid Build Coastguard Worker  * <code>dayOfWeekInMonth</code> to indicate that <code>SimpleTimeZone</code> should
56*0e209d39SAndroid Build Coastguard Worker  * count from the end of the month backwards. For example, if Daylight Savings
57*0e209d39SAndroid Build Coastguard Worker  * Time starts or ends at the last Sunday a month, use <code>dayOfWeekInMonth = -1</code>
58*0e209d39SAndroid Build Coastguard Worker  * along with <code>dayOfWeek = UCAL_SUNDAY</code> to specify the rule.
59*0e209d39SAndroid Build Coastguard Worker  *
60*0e209d39SAndroid Build Coastguard Worker  * @see      Calendar
61*0e209d39SAndroid Build Coastguard Worker  * @see      GregorianCalendar
62*0e209d39SAndroid Build Coastguard Worker  * @see      TimeZone
63*0e209d39SAndroid Build Coastguard Worker  * @author   D. Goldsmith, Mark Davis, Chen-Lieh Huang, Alan Liu
64*0e209d39SAndroid Build Coastguard Worker  */
65*0e209d39SAndroid Build Coastguard Worker class U_I18N_API SimpleTimeZone: public BasicTimeZone {
66*0e209d39SAndroid Build Coastguard Worker public:
67*0e209d39SAndroid Build Coastguard Worker 
68*0e209d39SAndroid Build Coastguard Worker     /**
69*0e209d39SAndroid Build Coastguard Worker      * TimeMode is used, together with a millisecond offset after
70*0e209d39SAndroid Build Coastguard Worker      * midnight, to specify a rule transition time.  Most rules
71*0e209d39SAndroid Build Coastguard Worker      * transition at a local wall time, that is, according to the
72*0e209d39SAndroid Build Coastguard Worker      * current time in effect, either standard, or DST.  However, some
73*0e209d39SAndroid Build Coastguard Worker      * rules transition at local standard time, and some at a specific
74*0e209d39SAndroid Build Coastguard Worker      * UTC time.  Although it might seem that all times could be
75*0e209d39SAndroid Build Coastguard Worker      * converted to wall time, thus eliminating the need for this
76*0e209d39SAndroid Build Coastguard Worker      * parameter, this is not the case.
77*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
78*0e209d39SAndroid Build Coastguard Worker      */
79*0e209d39SAndroid Build Coastguard Worker     enum TimeMode {
80*0e209d39SAndroid Build Coastguard Worker         WALL_TIME = 0,
81*0e209d39SAndroid Build Coastguard Worker         STANDARD_TIME,
82*0e209d39SAndroid Build Coastguard Worker         UTC_TIME
83*0e209d39SAndroid Build Coastguard Worker     };
84*0e209d39SAndroid Build Coastguard Worker 
85*0e209d39SAndroid Build Coastguard Worker     /**
86*0e209d39SAndroid Build Coastguard Worker      * Copy constructor
87*0e209d39SAndroid Build Coastguard Worker      * @param source the object to be copied.
88*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
89*0e209d39SAndroid Build Coastguard Worker      */
90*0e209d39SAndroid Build Coastguard Worker     SimpleTimeZone(const SimpleTimeZone& source);
91*0e209d39SAndroid Build Coastguard Worker 
92*0e209d39SAndroid Build Coastguard Worker     /**
93*0e209d39SAndroid Build Coastguard Worker      * Default assignment operator
94*0e209d39SAndroid Build Coastguard Worker      * @param right    the object to be copied.
95*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
96*0e209d39SAndroid Build Coastguard Worker      */
97*0e209d39SAndroid Build Coastguard Worker     SimpleTimeZone& operator=(const SimpleTimeZone& right);
98*0e209d39SAndroid Build Coastguard Worker 
99*0e209d39SAndroid Build Coastguard Worker     /**
100*0e209d39SAndroid Build Coastguard Worker      * Destructor
101*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
102*0e209d39SAndroid Build Coastguard Worker      */
103*0e209d39SAndroid Build Coastguard Worker     virtual ~SimpleTimeZone();
104*0e209d39SAndroid Build Coastguard Worker 
105*0e209d39SAndroid Build Coastguard Worker     /**
106*0e209d39SAndroid Build Coastguard Worker      * Returns true if the two TimeZone objects are equal; that is, they have
107*0e209d39SAndroid Build Coastguard Worker      * the same ID, raw GMT offset, and DST rules.
108*0e209d39SAndroid Build Coastguard Worker      *
109*0e209d39SAndroid Build Coastguard Worker      * @param that  The SimpleTimeZone object to be compared with.
110*0e209d39SAndroid Build Coastguard Worker      * @return      true if the given time zone is equal to this time zone; false
111*0e209d39SAndroid Build Coastguard Worker      *              otherwise.
112*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
113*0e209d39SAndroid Build Coastguard Worker      */
114*0e209d39SAndroid Build Coastguard Worker     virtual bool operator==(const TimeZone& that) const override;
115*0e209d39SAndroid Build Coastguard Worker 
116*0e209d39SAndroid Build Coastguard Worker     /**
117*0e209d39SAndroid Build Coastguard Worker      * Constructs a SimpleTimeZone with the given raw GMT offset and time zone ID,
118*0e209d39SAndroid Build Coastguard Worker      * and which doesn't observe daylight savings time.  Normally you should use
119*0e209d39SAndroid Build Coastguard Worker      * TimeZone::createInstance() to create a TimeZone instead of creating a
120*0e209d39SAndroid Build Coastguard Worker      * SimpleTimeZone directly with this constructor.
121*0e209d39SAndroid Build Coastguard Worker      *
122*0e209d39SAndroid Build Coastguard Worker      * @param rawOffsetGMT  The given base time zone offset to GMT.
123*0e209d39SAndroid Build Coastguard Worker      * @param ID         The timezone ID which is obtained from
124*0e209d39SAndroid Build Coastguard Worker      *                   TimeZone.getAvailableIDs.
125*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
126*0e209d39SAndroid Build Coastguard Worker      */
127*0e209d39SAndroid Build Coastguard Worker     SimpleTimeZone(int32_t rawOffsetGMT, const UnicodeString& ID);
128*0e209d39SAndroid Build Coastguard Worker 
129*0e209d39SAndroid Build Coastguard Worker     /**
130*0e209d39SAndroid Build Coastguard Worker      * Construct a SimpleTimeZone with the given raw GMT offset, time zone ID,
131*0e209d39SAndroid Build Coastguard Worker      * and times to start and end daylight savings time. To create a TimeZone that
132*0e209d39SAndroid Build Coastguard Worker      * doesn't observe daylight savings time, don't use this constructor; use
133*0e209d39SAndroid Build Coastguard Worker      * SimpleTimeZone(rawOffset, ID) instead. Normally, you should use
134*0e209d39SAndroid Build Coastguard Worker      * TimeZone.createInstance() to create a TimeZone instead of creating a
135*0e209d39SAndroid Build Coastguard Worker      * SimpleTimeZone directly with this constructor.
136*0e209d39SAndroid Build Coastguard Worker      * <P>
137*0e209d39SAndroid Build Coastguard Worker      * Various types of daylight-savings time rules can be specified by using different
138*0e209d39SAndroid Build Coastguard Worker      * values for startDay and startDayOfWeek and endDay and endDayOfWeek.  For a
139*0e209d39SAndroid Build Coastguard Worker      * complete explanation of how these parameters work, see the documentation for
140*0e209d39SAndroid Build Coastguard Worker      * setStartRule().
141*0e209d39SAndroid Build Coastguard Worker      *
142*0e209d39SAndroid Build Coastguard Worker      * @param rawOffsetGMT      The new SimpleTimeZone's raw GMT offset
143*0e209d39SAndroid Build Coastguard Worker      * @param ID                The new SimpleTimeZone's time zone ID.
144*0e209d39SAndroid Build Coastguard Worker      * @param savingsStartMonth The daylight savings starting month. Month is
145*0e209d39SAndroid Build Coastguard Worker      *                          0-based. eg, 0 for January.
146*0e209d39SAndroid Build Coastguard Worker      * @param savingsStartDayOfWeekInMonth   The daylight savings starting
147*0e209d39SAndroid Build Coastguard Worker      *                          day-of-week-in-month. See setStartRule() for a
148*0e209d39SAndroid Build Coastguard Worker      *                          complete explanation.
149*0e209d39SAndroid Build Coastguard Worker      * @param savingsStartDayOfWeek The daylight savings starting day-of-week.
150*0e209d39SAndroid Build Coastguard Worker      *                          See setStartRule() for a complete explanation.
151*0e209d39SAndroid Build Coastguard Worker      * @param savingsStartTime  The daylight savings starting time, expressed as the
152*0e209d39SAndroid Build Coastguard Worker      *                          number of milliseconds after midnight.
153*0e209d39SAndroid Build Coastguard Worker      * @param savingsEndMonth   The daylight savings ending month. Month is
154*0e209d39SAndroid Build Coastguard Worker      *                          0-based. eg, 0 for January.
155*0e209d39SAndroid Build Coastguard Worker      * @param savingsEndDayOfWeekInMonth     The daylight savings ending day-of-week-in-month.
156*0e209d39SAndroid Build Coastguard Worker      *                          See setStartRule() for a complete explanation.
157*0e209d39SAndroid Build Coastguard Worker      * @param savingsEndDayOfWeek The daylight savings ending day-of-week.
158*0e209d39SAndroid Build Coastguard Worker      *                          See setStartRule() for a complete explanation.
159*0e209d39SAndroid Build Coastguard Worker      * @param savingsEndTime    The daylight savings ending time, expressed as the
160*0e209d39SAndroid Build Coastguard Worker      *                          number of milliseconds after midnight.
161*0e209d39SAndroid Build Coastguard Worker      * @param status            An UErrorCode to receive the status.
162*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
163*0e209d39SAndroid Build Coastguard Worker      */
164*0e209d39SAndroid Build Coastguard Worker     SimpleTimeZone(int32_t rawOffsetGMT, const UnicodeString& ID,
165*0e209d39SAndroid Build Coastguard Worker         int8_t savingsStartMonth, int8_t savingsStartDayOfWeekInMonth,
166*0e209d39SAndroid Build Coastguard Worker         int8_t savingsStartDayOfWeek, int32_t savingsStartTime,
167*0e209d39SAndroid Build Coastguard Worker         int8_t savingsEndMonth, int8_t savingsEndDayOfWeekInMonth,
168*0e209d39SAndroid Build Coastguard Worker         int8_t savingsEndDayOfWeek, int32_t savingsEndTime,
169*0e209d39SAndroid Build Coastguard Worker         UErrorCode& status);
170*0e209d39SAndroid Build Coastguard Worker     /**
171*0e209d39SAndroid Build Coastguard Worker      * Construct a SimpleTimeZone with the given raw GMT offset, time zone ID,
172*0e209d39SAndroid Build Coastguard Worker      * and times to start and end daylight savings time. To create a TimeZone that
173*0e209d39SAndroid Build Coastguard Worker      * doesn't observe daylight savings time, don't use this constructor; use
174*0e209d39SAndroid Build Coastguard Worker      * SimpleTimeZone(rawOffset, ID) instead. Normally, you should use
175*0e209d39SAndroid Build Coastguard Worker      * TimeZone.createInstance() to create a TimeZone instead of creating a
176*0e209d39SAndroid Build Coastguard Worker      * SimpleTimeZone directly with this constructor.
177*0e209d39SAndroid Build Coastguard Worker      * <P>
178*0e209d39SAndroid Build Coastguard Worker      * Various types of daylight-savings time rules can be specified by using different
179*0e209d39SAndroid Build Coastguard Worker      * values for startDay and startDayOfWeek and endDay and endDayOfWeek.  For a
180*0e209d39SAndroid Build Coastguard Worker      * complete explanation of how these parameters work, see the documentation for
181*0e209d39SAndroid Build Coastguard Worker      * setStartRule().
182*0e209d39SAndroid Build Coastguard Worker      *
183*0e209d39SAndroid Build Coastguard Worker      * @param rawOffsetGMT      The new SimpleTimeZone's raw GMT offset
184*0e209d39SAndroid Build Coastguard Worker      * @param ID                The new SimpleTimeZone's time zone ID.
185*0e209d39SAndroid Build Coastguard Worker      * @param savingsStartMonth The daylight savings starting month. Month is
186*0e209d39SAndroid Build Coastguard Worker      *                          0-based. eg, 0 for January.
187*0e209d39SAndroid Build Coastguard Worker      * @param savingsStartDayOfWeekInMonth   The daylight savings starting
188*0e209d39SAndroid Build Coastguard Worker      *                          day-of-week-in-month. See setStartRule() for a
189*0e209d39SAndroid Build Coastguard Worker      *                          complete explanation.
190*0e209d39SAndroid Build Coastguard Worker      * @param savingsStartDayOfWeek The daylight savings starting day-of-week.
191*0e209d39SAndroid Build Coastguard Worker      *                          See setStartRule() for a complete explanation.
192*0e209d39SAndroid Build Coastguard Worker      * @param savingsStartTime  The daylight savings starting time, expressed as the
193*0e209d39SAndroid Build Coastguard Worker      *                          number of milliseconds after midnight.
194*0e209d39SAndroid Build Coastguard Worker      * @param savingsEndMonth   The daylight savings ending month. Month is
195*0e209d39SAndroid Build Coastguard Worker      *                          0-based. eg, 0 for January.
196*0e209d39SAndroid Build Coastguard Worker      * @param savingsEndDayOfWeekInMonth     The daylight savings ending day-of-week-in-month.
197*0e209d39SAndroid Build Coastguard Worker      *                          See setStartRule() for a complete explanation.
198*0e209d39SAndroid Build Coastguard Worker      * @param savingsEndDayOfWeek The daylight savings ending day-of-week.
199*0e209d39SAndroid Build Coastguard Worker      *                          See setStartRule() for a complete explanation.
200*0e209d39SAndroid Build Coastguard Worker      * @param savingsEndTime    The daylight savings ending time, expressed as the
201*0e209d39SAndroid Build Coastguard Worker      *                          number of milliseconds after midnight.
202*0e209d39SAndroid Build Coastguard Worker      * @param savingsDST        The number of milliseconds added to standard time
203*0e209d39SAndroid Build Coastguard Worker      *                          to get DST time. Default is one hour.
204*0e209d39SAndroid Build Coastguard Worker      * @param status            An UErrorCode to receive the status.
205*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
206*0e209d39SAndroid Build Coastguard Worker      */
207*0e209d39SAndroid Build Coastguard Worker     SimpleTimeZone(int32_t rawOffsetGMT, const UnicodeString& ID,
208*0e209d39SAndroid Build Coastguard Worker         int8_t savingsStartMonth, int8_t savingsStartDayOfWeekInMonth,
209*0e209d39SAndroid Build Coastguard Worker         int8_t savingsStartDayOfWeek, int32_t savingsStartTime,
210*0e209d39SAndroid Build Coastguard Worker         int8_t savingsEndMonth, int8_t savingsEndDayOfWeekInMonth,
211*0e209d39SAndroid Build Coastguard Worker         int8_t savingsEndDayOfWeek, int32_t savingsEndTime,
212*0e209d39SAndroid Build Coastguard Worker         int32_t savingsDST, UErrorCode& status);
213*0e209d39SAndroid Build Coastguard Worker 
214*0e209d39SAndroid Build Coastguard Worker     /**
215*0e209d39SAndroid Build Coastguard Worker      * Construct a SimpleTimeZone with the given raw GMT offset, time zone ID,
216*0e209d39SAndroid Build Coastguard Worker      * and times to start and end daylight savings time. To create a TimeZone that
217*0e209d39SAndroid Build Coastguard Worker      * doesn't observe daylight savings time, don't use this constructor; use
218*0e209d39SAndroid Build Coastguard Worker      * SimpleTimeZone(rawOffset, ID) instead. Normally, you should use
219*0e209d39SAndroid Build Coastguard Worker      * TimeZone.createInstance() to create a TimeZone instead of creating a
220*0e209d39SAndroid Build Coastguard Worker      * SimpleTimeZone directly with this constructor.
221*0e209d39SAndroid Build Coastguard Worker      * <P>
222*0e209d39SAndroid Build Coastguard Worker      * Various types of daylight-savings time rules can be specified by using different
223*0e209d39SAndroid Build Coastguard Worker      * values for startDay and startDayOfWeek and endDay and endDayOfWeek.  For a
224*0e209d39SAndroid Build Coastguard Worker      * complete explanation of how these parameters work, see the documentation for
225*0e209d39SAndroid Build Coastguard Worker      * setStartRule().
226*0e209d39SAndroid Build Coastguard Worker      *
227*0e209d39SAndroid Build Coastguard Worker      * @param rawOffsetGMT      The new SimpleTimeZone's raw GMT offset
228*0e209d39SAndroid Build Coastguard Worker      * @param ID                The new SimpleTimeZone's time zone ID.
229*0e209d39SAndroid Build Coastguard Worker      * @param savingsStartMonth The daylight savings starting month. Month is
230*0e209d39SAndroid Build Coastguard Worker      *                          0-based. eg, 0 for January.
231*0e209d39SAndroid Build Coastguard Worker      * @param savingsStartDayOfWeekInMonth   The daylight savings starting
232*0e209d39SAndroid Build Coastguard Worker      *                          day-of-week-in-month. See setStartRule() for a
233*0e209d39SAndroid Build Coastguard Worker      *                          complete explanation.
234*0e209d39SAndroid Build Coastguard Worker      * @param savingsStartDayOfWeek The daylight savings starting day-of-week.
235*0e209d39SAndroid Build Coastguard Worker      *                          See setStartRule() for a complete explanation.
236*0e209d39SAndroid Build Coastguard Worker      * @param savingsStartTime  The daylight savings starting time, expressed as the
237*0e209d39SAndroid Build Coastguard Worker      *                          number of milliseconds after midnight.
238*0e209d39SAndroid Build Coastguard Worker      * @param savingsStartTimeMode Whether the start time is local wall time, local
239*0e209d39SAndroid Build Coastguard Worker      *                          standard time, or UTC time. Default is local wall time.
240*0e209d39SAndroid Build Coastguard Worker      * @param savingsEndMonth   The daylight savings ending month. Month is
241*0e209d39SAndroid Build Coastguard Worker      *                          0-based. eg, 0 for January.
242*0e209d39SAndroid Build Coastguard Worker      * @param savingsEndDayOfWeekInMonth     The daylight savings ending day-of-week-in-month.
243*0e209d39SAndroid Build Coastguard Worker      *                          See setStartRule() for a complete explanation.
244*0e209d39SAndroid Build Coastguard Worker      * @param savingsEndDayOfWeek The daylight savings ending day-of-week.
245*0e209d39SAndroid Build Coastguard Worker      *                          See setStartRule() for a complete explanation.
246*0e209d39SAndroid Build Coastguard Worker      * @param savingsEndTime    The daylight savings ending time, expressed as the
247*0e209d39SAndroid Build Coastguard Worker      *                          number of milliseconds after midnight.
248*0e209d39SAndroid Build Coastguard Worker      * @param savingsEndTimeMode Whether the end time is local wall time, local
249*0e209d39SAndroid Build Coastguard Worker      *                          standard time, or UTC time. Default is local wall time.
250*0e209d39SAndroid Build Coastguard Worker      * @param savingsDST        The number of milliseconds added to standard time
251*0e209d39SAndroid Build Coastguard Worker      *                          to get DST time. Default is one hour.
252*0e209d39SAndroid Build Coastguard Worker      * @param status            An UErrorCode to receive the status.
253*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
254*0e209d39SAndroid Build Coastguard Worker      */
255*0e209d39SAndroid Build Coastguard Worker     SimpleTimeZone(int32_t rawOffsetGMT, const UnicodeString& ID,
256*0e209d39SAndroid Build Coastguard Worker         int8_t savingsStartMonth, int8_t savingsStartDayOfWeekInMonth,
257*0e209d39SAndroid Build Coastguard Worker         int8_t savingsStartDayOfWeek, int32_t savingsStartTime,
258*0e209d39SAndroid Build Coastguard Worker         TimeMode savingsStartTimeMode,
259*0e209d39SAndroid Build Coastguard Worker         int8_t savingsEndMonth, int8_t savingsEndDayOfWeekInMonth,
260*0e209d39SAndroid Build Coastguard Worker         int8_t savingsEndDayOfWeek, int32_t savingsEndTime, TimeMode savingsEndTimeMode,
261*0e209d39SAndroid Build Coastguard Worker         int32_t savingsDST, UErrorCode& status);
262*0e209d39SAndroid Build Coastguard Worker 
263*0e209d39SAndroid Build Coastguard Worker     /**
264*0e209d39SAndroid Build Coastguard Worker      * Sets the daylight savings starting year, that is, the year this time zone began
265*0e209d39SAndroid Build Coastguard Worker      * observing its specified daylight savings time rules.  The time zone is considered
266*0e209d39SAndroid Build Coastguard Worker      * not to observe daylight savings time prior to that year; SimpleTimeZone doesn't
267*0e209d39SAndroid Build Coastguard Worker      * support historical daylight-savings-time rules.
268*0e209d39SAndroid Build Coastguard Worker      * @param year the daylight savings starting year.
269*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
270*0e209d39SAndroid Build Coastguard Worker      */
271*0e209d39SAndroid Build Coastguard Worker     void setStartYear(int32_t year);
272*0e209d39SAndroid Build Coastguard Worker 
273*0e209d39SAndroid Build Coastguard Worker     /**
274*0e209d39SAndroid Build Coastguard Worker      * Sets the daylight savings starting rule. For example, in the U.S., Daylight Savings
275*0e209d39SAndroid Build Coastguard Worker      * Time starts at the second Sunday in March, at 2 AM in standard time.
276*0e209d39SAndroid Build Coastguard Worker      * Therefore, you can set the start rule by calling:
277*0e209d39SAndroid Build Coastguard Worker      * setStartRule(UCAL_MARCH, 2, UCAL_SUNDAY, 2*60*60*1000);
278*0e209d39SAndroid Build Coastguard Worker      * The dayOfWeekInMonth and dayOfWeek parameters together specify how to calculate
279*0e209d39SAndroid Build Coastguard Worker      * the exact starting date.  Their exact meaning depend on their respective signs,
280*0e209d39SAndroid Build Coastguard Worker      * allowing various types of rules to be constructed, as follows:
281*0e209d39SAndroid Build Coastguard Worker      * <ul>
282*0e209d39SAndroid Build Coastguard Worker      *   <li>If both dayOfWeekInMonth and dayOfWeek are positive, they specify the
283*0e209d39SAndroid Build Coastguard Worker      *       day of week in the month (e.g., (2, WEDNESDAY) is the second Wednesday
284*0e209d39SAndroid Build Coastguard Worker      *       of the month).</li>
285*0e209d39SAndroid Build Coastguard Worker      *   <li>If dayOfWeek is positive and dayOfWeekInMonth is negative, they specify
286*0e209d39SAndroid Build Coastguard Worker      *       the day of week in the month counting backward from the end of the month.
287*0e209d39SAndroid Build Coastguard Worker      *       (e.g., (-1, MONDAY) is the last Monday in the month)</li>
288*0e209d39SAndroid Build Coastguard Worker      *   <li>If dayOfWeek is zero and dayOfWeekInMonth is positive, dayOfWeekInMonth
289*0e209d39SAndroid Build Coastguard Worker      *       specifies the day of the month, regardless of what day of the week it is.
290*0e209d39SAndroid Build Coastguard Worker      *       (e.g., (10, 0) is the tenth day of the month)</li>
291*0e209d39SAndroid Build Coastguard Worker      *   <li>If dayOfWeek is zero and dayOfWeekInMonth is negative, dayOfWeekInMonth
292*0e209d39SAndroid Build Coastguard Worker      *       specifies the day of the month counting backward from the end of the
293*0e209d39SAndroid Build Coastguard Worker      *       month, regardless of what day of the week it is (e.g., (-2, 0) is the
294*0e209d39SAndroid Build Coastguard Worker      *       next-to-last day of the month).</li>
295*0e209d39SAndroid Build Coastguard Worker      *   <li>If dayOfWeek is negative and dayOfWeekInMonth is positive, they specify the
296*0e209d39SAndroid Build Coastguard Worker      *       first specified day of the week on or after the specified day of the month.
297*0e209d39SAndroid Build Coastguard Worker      *       (e.g., (15, -SUNDAY) is the first Sunday after the 15th of the month
298*0e209d39SAndroid Build Coastguard Worker      *       [or the 15th itself if the 15th is a Sunday].)</li>
299*0e209d39SAndroid Build Coastguard Worker      *   <li>If dayOfWeek and DayOfWeekInMonth are both negative, they specify the
300*0e209d39SAndroid Build Coastguard Worker      *       last specified day of the week on or before the specified day of the month.
301*0e209d39SAndroid Build Coastguard Worker      *       (e.g., (-20, -TUESDAY) is the last Tuesday before the 20th of the month
302*0e209d39SAndroid Build Coastguard Worker      *       [or the 20th itself if the 20th is a Tuesday].)</li>
303*0e209d39SAndroid Build Coastguard Worker      * </ul>
304*0e209d39SAndroid Build Coastguard Worker      * @param month the daylight savings starting month. Month is 0-based.
305*0e209d39SAndroid Build Coastguard Worker      * eg, 0 for January.
306*0e209d39SAndroid Build Coastguard Worker      * @param dayOfWeekInMonth the daylight savings starting
307*0e209d39SAndroid Build Coastguard Worker      * day-of-week-in-month. Please see the member description for an example.
308*0e209d39SAndroid Build Coastguard Worker      * @param dayOfWeek the daylight savings starting day-of-week. Please see
309*0e209d39SAndroid Build Coastguard Worker      * the member description for an example.
310*0e209d39SAndroid Build Coastguard Worker      * @param time the daylight savings starting time. Please see the member
311*0e209d39SAndroid Build Coastguard Worker      * description for an example.
312*0e209d39SAndroid Build Coastguard Worker      * @param status An UErrorCode
313*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
314*0e209d39SAndroid Build Coastguard Worker      */
315*0e209d39SAndroid Build Coastguard Worker     void setStartRule(int32_t month, int32_t dayOfWeekInMonth, int32_t dayOfWeek,
316*0e209d39SAndroid Build Coastguard Worker                       int32_t time, UErrorCode& status);
317*0e209d39SAndroid Build Coastguard Worker     /**
318*0e209d39SAndroid Build Coastguard Worker      * Sets the daylight savings starting rule. For example, in the U.S., Daylight Savings
319*0e209d39SAndroid Build Coastguard Worker      * Time starts at the second Sunday in March, at 2 AM in standard time.
320*0e209d39SAndroid Build Coastguard Worker      * Therefore, you can set the start rule by calling:
321*0e209d39SAndroid Build Coastguard Worker      * setStartRule(UCAL_MARCH, 2, UCAL_SUNDAY, 2*60*60*1000);
322*0e209d39SAndroid Build Coastguard Worker      * The dayOfWeekInMonth and dayOfWeek parameters together specify how to calculate
323*0e209d39SAndroid Build Coastguard Worker      * the exact starting date.  Their exact meaning depend on their respective signs,
324*0e209d39SAndroid Build Coastguard Worker      * allowing various types of rules to be constructed, as follows:
325*0e209d39SAndroid Build Coastguard Worker      * <ul>
326*0e209d39SAndroid Build Coastguard Worker      *   <li>If both dayOfWeekInMonth and dayOfWeek are positive, they specify the
327*0e209d39SAndroid Build Coastguard Worker      *       day of week in the month (e.g., (2, WEDNESDAY) is the second Wednesday
328*0e209d39SAndroid Build Coastguard Worker      *       of the month).</li>
329*0e209d39SAndroid Build Coastguard Worker      *   <li>If dayOfWeek is positive and dayOfWeekInMonth is negative, they specify
330*0e209d39SAndroid Build Coastguard Worker      *       the day of week in the month counting backward from the end of the month.
331*0e209d39SAndroid Build Coastguard Worker      *       (e.g., (-1, MONDAY) is the last Monday in the month)</li>
332*0e209d39SAndroid Build Coastguard Worker      *   <li>If dayOfWeek is zero and dayOfWeekInMonth is positive, dayOfWeekInMonth
333*0e209d39SAndroid Build Coastguard Worker      *       specifies the day of the month, regardless of what day of the week it is.
334*0e209d39SAndroid Build Coastguard Worker      *       (e.g., (10, 0) is the tenth day of the month)</li>
335*0e209d39SAndroid Build Coastguard Worker      *   <li>If dayOfWeek is zero and dayOfWeekInMonth is negative, dayOfWeekInMonth
336*0e209d39SAndroid Build Coastguard Worker      *       specifies the day of the month counting backward from the end of the
337*0e209d39SAndroid Build Coastguard Worker      *       month, regardless of what day of the week it is (e.g., (-2, 0) is the
338*0e209d39SAndroid Build Coastguard Worker      *       next-to-last day of the month).</li>
339*0e209d39SAndroid Build Coastguard Worker      *   <li>If dayOfWeek is negative and dayOfWeekInMonth is positive, they specify the
340*0e209d39SAndroid Build Coastguard Worker      *       first specified day of the week on or after the specified day of the month.
341*0e209d39SAndroid Build Coastguard Worker      *       (e.g., (15, -SUNDAY) is the first Sunday after the 15th of the month
342*0e209d39SAndroid Build Coastguard Worker      *       [or the 15th itself if the 15th is a Sunday].)</li>
343*0e209d39SAndroid Build Coastguard Worker      *   <li>If dayOfWeek and DayOfWeekInMonth are both negative, they specify the
344*0e209d39SAndroid Build Coastguard Worker      *       last specified day of the week on or before the specified day of the month.
345*0e209d39SAndroid Build Coastguard Worker      *       (e.g., (-20, -TUESDAY) is the last Tuesday before the 20th of the month
346*0e209d39SAndroid Build Coastguard Worker      *       [or the 20th itself if the 20th is a Tuesday].)</li>
347*0e209d39SAndroid Build Coastguard Worker      * </ul>
348*0e209d39SAndroid Build Coastguard Worker      * @param month the daylight savings starting month. Month is 0-based.
349*0e209d39SAndroid Build Coastguard Worker      * eg, 0 for January.
350*0e209d39SAndroid Build Coastguard Worker      * @param dayOfWeekInMonth the daylight savings starting
351*0e209d39SAndroid Build Coastguard Worker      * day-of-week-in-month. Please see the member description for an example.
352*0e209d39SAndroid Build Coastguard Worker      * @param dayOfWeek the daylight savings starting day-of-week. Please see
353*0e209d39SAndroid Build Coastguard Worker      * the member description for an example.
354*0e209d39SAndroid Build Coastguard Worker      * @param time the daylight savings starting time. Please see the member
355*0e209d39SAndroid Build Coastguard Worker      * description for an example.
356*0e209d39SAndroid Build Coastguard Worker      * @param mode whether the time is local wall time, local standard time,
357*0e209d39SAndroid Build Coastguard Worker      * or UTC time. Default is local wall time.
358*0e209d39SAndroid Build Coastguard Worker      * @param status An UErrorCode
359*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
360*0e209d39SAndroid Build Coastguard Worker      */
361*0e209d39SAndroid Build Coastguard Worker     void setStartRule(int32_t month, int32_t dayOfWeekInMonth, int32_t dayOfWeek,
362*0e209d39SAndroid Build Coastguard Worker                       int32_t time, TimeMode mode, UErrorCode& status);
363*0e209d39SAndroid Build Coastguard Worker 
364*0e209d39SAndroid Build Coastguard Worker     /**
365*0e209d39SAndroid Build Coastguard Worker      * Sets the DST start rule to a fixed date within a month.
366*0e209d39SAndroid Build Coastguard Worker      *
367*0e209d39SAndroid Build Coastguard Worker      * @param month         The month in which this rule occurs (0-based).
368*0e209d39SAndroid Build Coastguard Worker      * @param dayOfMonth    The date in that month (1-based).
369*0e209d39SAndroid Build Coastguard Worker      * @param time          The time of that day (number of millis after midnight)
370*0e209d39SAndroid Build Coastguard Worker      *                      when DST takes effect in local wall time, which is
371*0e209d39SAndroid Build Coastguard Worker      *                      standard time in this case.
372*0e209d39SAndroid Build Coastguard Worker      * @param status An UErrorCode
373*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
374*0e209d39SAndroid Build Coastguard Worker      */
375*0e209d39SAndroid Build Coastguard Worker     void setStartRule(int32_t month, int32_t dayOfMonth, int32_t time,
376*0e209d39SAndroid Build Coastguard Worker                       UErrorCode& status);
377*0e209d39SAndroid Build Coastguard Worker     /**
378*0e209d39SAndroid Build Coastguard Worker      * Sets the DST start rule to a fixed date within a month.
379*0e209d39SAndroid Build Coastguard Worker      *
380*0e209d39SAndroid Build Coastguard Worker      * @param month         The month in which this rule occurs (0-based).
381*0e209d39SAndroid Build Coastguard Worker      * @param dayOfMonth    The date in that month (1-based).
382*0e209d39SAndroid Build Coastguard Worker      * @param time          The time of that day (number of millis after midnight)
383*0e209d39SAndroid Build Coastguard Worker      *                      when DST takes effect in local wall time, which is
384*0e209d39SAndroid Build Coastguard Worker      *                      standard time in this case.
385*0e209d39SAndroid Build Coastguard Worker      * @param mode whether the time is local wall time, local standard time,
386*0e209d39SAndroid Build Coastguard Worker      * or UTC time. Default is local wall time.
387*0e209d39SAndroid Build Coastguard Worker      * @param status An UErrorCode
388*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
389*0e209d39SAndroid Build Coastguard Worker      */
390*0e209d39SAndroid Build Coastguard Worker     void setStartRule(int32_t month, int32_t dayOfMonth, int32_t time,
391*0e209d39SAndroid Build Coastguard Worker                       TimeMode mode, UErrorCode& status);
392*0e209d39SAndroid Build Coastguard Worker 
393*0e209d39SAndroid Build Coastguard Worker     /**
394*0e209d39SAndroid Build Coastguard Worker      * Sets the DST start rule to a weekday before or after a give date within
395*0e209d39SAndroid Build Coastguard Worker      * a month, e.g., the first Monday on or after the 8th.
396*0e209d39SAndroid Build Coastguard Worker      *
397*0e209d39SAndroid Build Coastguard Worker      * @param month         The month in which this rule occurs (0-based).
398*0e209d39SAndroid Build Coastguard Worker      * @param dayOfMonth    A date within that month (1-based).
399*0e209d39SAndroid Build Coastguard Worker      * @param dayOfWeek     The day of the week on which this rule occurs.
400*0e209d39SAndroid Build Coastguard Worker      * @param time          The time of that day (number of millis after midnight)
401*0e209d39SAndroid Build Coastguard Worker      *                      when DST takes effect in local wall time, which is
402*0e209d39SAndroid Build Coastguard Worker      *                      standard time in this case.
403*0e209d39SAndroid Build Coastguard Worker      * @param after         If true, this rule selects the first dayOfWeek on
404*0e209d39SAndroid Build Coastguard Worker      *                      or after dayOfMonth.  If false, this rule selects
405*0e209d39SAndroid Build Coastguard Worker      *                      the last dayOfWeek on or before dayOfMonth.
406*0e209d39SAndroid Build Coastguard Worker      * @param status An UErrorCode
407*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
408*0e209d39SAndroid Build Coastguard Worker      */
409*0e209d39SAndroid Build Coastguard Worker     void setStartRule(int32_t month, int32_t dayOfMonth, int32_t dayOfWeek,
410*0e209d39SAndroid Build Coastguard Worker                       int32_t time, UBool after, UErrorCode& status);
411*0e209d39SAndroid Build Coastguard Worker     /**
412*0e209d39SAndroid Build Coastguard Worker      * Sets the DST start rule to a weekday before or after a give date within
413*0e209d39SAndroid Build Coastguard Worker      * a month, e.g., the first Monday on or after the 8th.
414*0e209d39SAndroid Build Coastguard Worker      *
415*0e209d39SAndroid Build Coastguard Worker      * @param month         The month in which this rule occurs (0-based).
416*0e209d39SAndroid Build Coastguard Worker      * @param dayOfMonth    A date within that month (1-based).
417*0e209d39SAndroid Build Coastguard Worker      * @param dayOfWeek     The day of the week on which this rule occurs.
418*0e209d39SAndroid Build Coastguard Worker      * @param time          The time of that day (number of millis after midnight)
419*0e209d39SAndroid Build Coastguard Worker      *                      when DST takes effect in local wall time, which is
420*0e209d39SAndroid Build Coastguard Worker      *                      standard time in this case.
421*0e209d39SAndroid Build Coastguard Worker      * @param mode whether the time is local wall time, local standard time,
422*0e209d39SAndroid Build Coastguard Worker      * or UTC time. Default is local wall time.
423*0e209d39SAndroid Build Coastguard Worker      * @param after         If true, this rule selects the first dayOfWeek on
424*0e209d39SAndroid Build Coastguard Worker      *                      or after dayOfMonth.  If false, this rule selects
425*0e209d39SAndroid Build Coastguard Worker      *                      the last dayOfWeek on or before dayOfMonth.
426*0e209d39SAndroid Build Coastguard Worker      * @param status An UErrorCode
427*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
428*0e209d39SAndroid Build Coastguard Worker      */
429*0e209d39SAndroid Build Coastguard Worker     void setStartRule(int32_t month, int32_t dayOfMonth, int32_t dayOfWeek,
430*0e209d39SAndroid Build Coastguard Worker                       int32_t time, TimeMode mode, UBool after, UErrorCode& status);
431*0e209d39SAndroid Build Coastguard Worker 
432*0e209d39SAndroid Build Coastguard Worker     /**
433*0e209d39SAndroid Build Coastguard Worker      * Sets the daylight savings ending rule. For example, if Daylight
434*0e209d39SAndroid Build Coastguard Worker      * Savings Time ends at the last (-1) Sunday in October, at 2 AM in standard time.
435*0e209d39SAndroid Build Coastguard Worker      * Therefore, you can set the end rule by calling:
436*0e209d39SAndroid Build Coastguard Worker      * <pre>
437*0e209d39SAndroid Build Coastguard Worker      *    setEndRule(UCAL_OCTOBER, -1, UCAL_SUNDAY, 2*60*60*1000);
438*0e209d39SAndroid Build Coastguard Worker      * </pre>
439*0e209d39SAndroid Build Coastguard Worker      * Various other types of rules can be specified by manipulating the dayOfWeek
440*0e209d39SAndroid Build Coastguard Worker      * and dayOfWeekInMonth parameters.  For complete details, see the documentation
441*0e209d39SAndroid Build Coastguard Worker      * for setStartRule().
442*0e209d39SAndroid Build Coastguard Worker      *
443*0e209d39SAndroid Build Coastguard Worker      * @param month the daylight savings ending month. Month is 0-based.
444*0e209d39SAndroid Build Coastguard Worker      * eg, 0 for January.
445*0e209d39SAndroid Build Coastguard Worker      * @param dayOfWeekInMonth the daylight savings ending
446*0e209d39SAndroid Build Coastguard Worker      * day-of-week-in-month. See setStartRule() for a complete explanation.
447*0e209d39SAndroid Build Coastguard Worker      * @param dayOfWeek the daylight savings ending day-of-week. See setStartRule()
448*0e209d39SAndroid Build Coastguard Worker      * for a complete explanation.
449*0e209d39SAndroid Build Coastguard Worker      * @param time the daylight savings ending time. Please see the member
450*0e209d39SAndroid Build Coastguard Worker      * description for an example.
451*0e209d39SAndroid Build Coastguard Worker      * @param status An UErrorCode
452*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
453*0e209d39SAndroid Build Coastguard Worker      */
454*0e209d39SAndroid Build Coastguard Worker     void setEndRule(int32_t month, int32_t dayOfWeekInMonth, int32_t dayOfWeek,
455*0e209d39SAndroid Build Coastguard Worker                     int32_t time, UErrorCode& status);
456*0e209d39SAndroid Build Coastguard Worker 
457*0e209d39SAndroid Build Coastguard Worker     /**
458*0e209d39SAndroid Build Coastguard Worker      * Sets the daylight savings ending rule. For example, if Daylight
459*0e209d39SAndroid Build Coastguard Worker      * Savings Time ends at the last (-1) Sunday in October, at 2 AM in standard time.
460*0e209d39SAndroid Build Coastguard Worker      * Therefore, you can set the end rule by calling:
461*0e209d39SAndroid Build Coastguard Worker      * <pre>
462*0e209d39SAndroid Build Coastguard Worker      *    setEndRule(UCAL_OCTOBER, -1, UCAL_SUNDAY, 2*60*60*1000);
463*0e209d39SAndroid Build Coastguard Worker      * </pre>
464*0e209d39SAndroid Build Coastguard Worker      * Various other types of rules can be specified by manipulating the dayOfWeek
465*0e209d39SAndroid Build Coastguard Worker      * and dayOfWeekInMonth parameters.  For complete details, see the documentation
466*0e209d39SAndroid Build Coastguard Worker      * for setStartRule().
467*0e209d39SAndroid Build Coastguard Worker      *
468*0e209d39SAndroid Build Coastguard Worker      * @param month the daylight savings ending month. Month is 0-based.
469*0e209d39SAndroid Build Coastguard Worker      * eg, 0 for January.
470*0e209d39SAndroid Build Coastguard Worker      * @param dayOfWeekInMonth the daylight savings ending
471*0e209d39SAndroid Build Coastguard Worker      * day-of-week-in-month. See setStartRule() for a complete explanation.
472*0e209d39SAndroid Build Coastguard Worker      * @param dayOfWeek the daylight savings ending day-of-week. See setStartRule()
473*0e209d39SAndroid Build Coastguard Worker      * for a complete explanation.
474*0e209d39SAndroid Build Coastguard Worker      * @param time the daylight savings ending time. Please see the member
475*0e209d39SAndroid Build Coastguard Worker      * description for an example.
476*0e209d39SAndroid Build Coastguard Worker      * @param mode whether the time is local wall time, local standard time,
477*0e209d39SAndroid Build Coastguard Worker      * or UTC time. Default is local wall time.
478*0e209d39SAndroid Build Coastguard Worker      * @param status An UErrorCode
479*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
480*0e209d39SAndroid Build Coastguard Worker      */
481*0e209d39SAndroid Build Coastguard Worker     void setEndRule(int32_t month, int32_t dayOfWeekInMonth, int32_t dayOfWeek,
482*0e209d39SAndroid Build Coastguard Worker                     int32_t time, TimeMode mode, UErrorCode& status);
483*0e209d39SAndroid Build Coastguard Worker 
484*0e209d39SAndroid Build Coastguard Worker     /**
485*0e209d39SAndroid Build Coastguard Worker      * Sets the DST end rule to a fixed date within a month.
486*0e209d39SAndroid Build Coastguard Worker      *
487*0e209d39SAndroid Build Coastguard Worker      * @param month         The month in which this rule occurs (0-based).
488*0e209d39SAndroid Build Coastguard Worker      * @param dayOfMonth    The date in that month (1-based).
489*0e209d39SAndroid Build Coastguard Worker      * @param time          The time of that day (number of millis after midnight)
490*0e209d39SAndroid Build Coastguard Worker      *                      when DST ends in local wall time, which is daylight
491*0e209d39SAndroid Build Coastguard Worker      *                      time in this case.
492*0e209d39SAndroid Build Coastguard Worker      * @param status An UErrorCode
493*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
494*0e209d39SAndroid Build Coastguard Worker      */
495*0e209d39SAndroid Build Coastguard Worker     void setEndRule(int32_t month, int32_t dayOfMonth, int32_t time, UErrorCode& status);
496*0e209d39SAndroid Build Coastguard Worker 
497*0e209d39SAndroid Build Coastguard Worker     /**
498*0e209d39SAndroid Build Coastguard Worker      * Sets the DST end rule to a fixed date within a month.
499*0e209d39SAndroid Build Coastguard Worker      *
500*0e209d39SAndroid Build Coastguard Worker      * @param month         The month in which this rule occurs (0-based).
501*0e209d39SAndroid Build Coastguard Worker      * @param dayOfMonth    The date in that month (1-based).
502*0e209d39SAndroid Build Coastguard Worker      * @param time          The time of that day (number of millis after midnight)
503*0e209d39SAndroid Build Coastguard Worker      *                      when DST ends in local wall time, which is daylight
504*0e209d39SAndroid Build Coastguard Worker      *                      time in this case.
505*0e209d39SAndroid Build Coastguard Worker      * @param mode whether the time is local wall time, local standard time,
506*0e209d39SAndroid Build Coastguard Worker      * or UTC time. Default is local wall time.
507*0e209d39SAndroid Build Coastguard Worker      * @param status An UErrorCode
508*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
509*0e209d39SAndroid Build Coastguard Worker      */
510*0e209d39SAndroid Build Coastguard Worker     void setEndRule(int32_t month, int32_t dayOfMonth, int32_t time,
511*0e209d39SAndroid Build Coastguard Worker                     TimeMode mode, UErrorCode& status);
512*0e209d39SAndroid Build Coastguard Worker 
513*0e209d39SAndroid Build Coastguard Worker     /**
514*0e209d39SAndroid Build Coastguard Worker      * Sets the DST end rule to a weekday before or after a give date within
515*0e209d39SAndroid Build Coastguard Worker      * a month, e.g., the first Monday on or after the 8th.
516*0e209d39SAndroid Build Coastguard Worker      *
517*0e209d39SAndroid Build Coastguard Worker      * @param month         The month in which this rule occurs (0-based).
518*0e209d39SAndroid Build Coastguard Worker      * @param dayOfMonth    A date within that month (1-based).
519*0e209d39SAndroid Build Coastguard Worker      * @param dayOfWeek     The day of the week on which this rule occurs.
520*0e209d39SAndroid Build Coastguard Worker      * @param time          The time of that day (number of millis after midnight)
521*0e209d39SAndroid Build Coastguard Worker      *                      when DST ends in local wall time, which is daylight
522*0e209d39SAndroid Build Coastguard Worker      *                      time in this case.
523*0e209d39SAndroid Build Coastguard Worker      * @param after         If true, this rule selects the first dayOfWeek on
524*0e209d39SAndroid Build Coastguard Worker      *                      or after dayOfMonth.  If false, this rule selects
525*0e209d39SAndroid Build Coastguard Worker      *                      the last dayOfWeek on or before dayOfMonth.
526*0e209d39SAndroid Build Coastguard Worker      * @param status An UErrorCode
527*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
528*0e209d39SAndroid Build Coastguard Worker      */
529*0e209d39SAndroid Build Coastguard Worker     void setEndRule(int32_t month, int32_t dayOfMonth, int32_t dayOfWeek,
530*0e209d39SAndroid Build Coastguard Worker                     int32_t time, UBool after, UErrorCode& status);
531*0e209d39SAndroid Build Coastguard Worker 
532*0e209d39SAndroid Build Coastguard Worker     /**
533*0e209d39SAndroid Build Coastguard Worker      * Sets the DST end rule to a weekday before or after a give date within
534*0e209d39SAndroid Build Coastguard Worker      * a month, e.g., the first Monday on or after the 8th.
535*0e209d39SAndroid Build Coastguard Worker      *
536*0e209d39SAndroid Build Coastguard Worker      * @param month         The month in which this rule occurs (0-based).
537*0e209d39SAndroid Build Coastguard Worker      * @param dayOfMonth    A date within that month (1-based).
538*0e209d39SAndroid Build Coastguard Worker      * @param dayOfWeek     The day of the week on which this rule occurs.
539*0e209d39SAndroid Build Coastguard Worker      * @param time          The time of that day (number of millis after midnight)
540*0e209d39SAndroid Build Coastguard Worker      *                      when DST ends in local wall time, which is daylight
541*0e209d39SAndroid Build Coastguard Worker      *                      time in this case.
542*0e209d39SAndroid Build Coastguard Worker      * @param mode whether the time is local wall time, local standard time,
543*0e209d39SAndroid Build Coastguard Worker      * or UTC time. Default is local wall time.
544*0e209d39SAndroid Build Coastguard Worker      * @param after         If true, this rule selects the first dayOfWeek on
545*0e209d39SAndroid Build Coastguard Worker      *                      or after dayOfMonth.  If false, this rule selects
546*0e209d39SAndroid Build Coastguard Worker      *                      the last dayOfWeek on or before dayOfMonth.
547*0e209d39SAndroid Build Coastguard Worker      * @param status An UErrorCode
548*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
549*0e209d39SAndroid Build Coastguard Worker      */
550*0e209d39SAndroid Build Coastguard Worker     void setEndRule(int32_t month, int32_t dayOfMonth, int32_t dayOfWeek,
551*0e209d39SAndroid Build Coastguard Worker                     int32_t time, TimeMode mode, UBool after, UErrorCode& status);
552*0e209d39SAndroid Build Coastguard Worker 
553*0e209d39SAndroid Build Coastguard Worker     /**
554*0e209d39SAndroid Build Coastguard Worker      * Returns the TimeZone's adjusted GMT offset (i.e., the number of milliseconds to add
555*0e209d39SAndroid Build Coastguard Worker      * to GMT to get local time in this time zone, taking daylight savings time into
556*0e209d39SAndroid Build Coastguard Worker      * account) as of a particular reference date.  The reference date is used to determine
557*0e209d39SAndroid Build Coastguard Worker      * whether daylight savings time is in effect and needs to be figured into the offset
558*0e209d39SAndroid Build Coastguard Worker      * that is returned (in other words, what is the adjusted GMT offset in this time zone
559*0e209d39SAndroid Build Coastguard Worker      * at this particular date and time?).  For the time zones produced by createTimeZone(),
560*0e209d39SAndroid Build Coastguard Worker      * the reference data is specified according to the Gregorian calendar, and the date
561*0e209d39SAndroid Build Coastguard Worker      * and time fields are in GMT, NOT local time.
562*0e209d39SAndroid Build Coastguard Worker      *
563*0e209d39SAndroid Build Coastguard Worker      * @param era        The reference date's era
564*0e209d39SAndroid Build Coastguard Worker      * @param year       The reference date's year
565*0e209d39SAndroid Build Coastguard Worker      * @param month      The reference date's month (0-based; 0 is January)
566*0e209d39SAndroid Build Coastguard Worker      * @param day        The reference date's day-in-month (1-based)
567*0e209d39SAndroid Build Coastguard Worker      * @param dayOfWeek  The reference date's day-of-week (1-based; 1 is Sunday)
568*0e209d39SAndroid Build Coastguard Worker      * @param millis     The reference date's milliseconds in day, UTT (NOT local time).
569*0e209d39SAndroid Build Coastguard Worker      * @param status     An UErrorCode to receive the status.
570*0e209d39SAndroid Build Coastguard Worker      * @return           The offset in milliseconds to add to GMT to get local time.
571*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
572*0e209d39SAndroid Build Coastguard Worker      */
573*0e209d39SAndroid Build Coastguard Worker     virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day,
574*0e209d39SAndroid Build Coastguard Worker                               uint8_t dayOfWeek, int32_t millis, UErrorCode& status) const override;
575*0e209d39SAndroid Build Coastguard Worker 
576*0e209d39SAndroid Build Coastguard Worker     /**
577*0e209d39SAndroid Build Coastguard Worker      * Gets the time zone offset, for current date, modified in case of
578*0e209d39SAndroid Build Coastguard Worker      * daylight savings. This is the offset to add *to* UTC to get local time.
579*0e209d39SAndroid Build Coastguard Worker      * @param era the era of the given date.
580*0e209d39SAndroid Build Coastguard Worker      * @param year the year in the given date.
581*0e209d39SAndroid Build Coastguard Worker      * @param month the month in the given date.
582*0e209d39SAndroid Build Coastguard Worker      * Month is 0-based. e.g., 0 for January.
583*0e209d39SAndroid Build Coastguard Worker      * @param day the day-in-month of the given date.
584*0e209d39SAndroid Build Coastguard Worker      * @param dayOfWeek the day-of-week of the given date.
585*0e209d39SAndroid Build Coastguard Worker      * @param milliseconds the millis in day in <em>standard</em> local time.
586*0e209d39SAndroid Build Coastguard Worker      * @param monthLength the length of the given month in days.
587*0e209d39SAndroid Build Coastguard Worker      * @param status     An UErrorCode to receive the status.
588*0e209d39SAndroid Build Coastguard Worker      * @return the offset to add *to* GMT to get local time.
589*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
590*0e209d39SAndroid Build Coastguard Worker      */
591*0e209d39SAndroid Build Coastguard Worker     virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day,
592*0e209d39SAndroid Build Coastguard Worker                            uint8_t dayOfWeek, int32_t milliseconds,
593*0e209d39SAndroid Build Coastguard Worker                            int32_t monthLength, UErrorCode& status) const override;
594*0e209d39SAndroid Build Coastguard Worker     /**
595*0e209d39SAndroid Build Coastguard Worker      * Gets the time zone offset, for current date, modified in case of
596*0e209d39SAndroid Build Coastguard Worker      * daylight savings. This is the offset to add *to* UTC to get local time.
597*0e209d39SAndroid Build Coastguard Worker      * @param era the era of the given date.
598*0e209d39SAndroid Build Coastguard Worker      * @param year the year in the given date.
599*0e209d39SAndroid Build Coastguard Worker      * @param month the month in the given date.
600*0e209d39SAndroid Build Coastguard Worker      * Month is 0-based. e.g., 0 for January.
601*0e209d39SAndroid Build Coastguard Worker      * @param day the day-in-month of the given date.
602*0e209d39SAndroid Build Coastguard Worker      * @param dayOfWeek the day-of-week of the given date.
603*0e209d39SAndroid Build Coastguard Worker      * @param milliseconds the millis in day in <em>standard</em> local time.
604*0e209d39SAndroid Build Coastguard Worker      * @param monthLength the length of the given month in days.
605*0e209d39SAndroid Build Coastguard Worker      * @param prevMonthLength length of the previous month in days.
606*0e209d39SAndroid Build Coastguard Worker      * @param status     An UErrorCode to receive the status.
607*0e209d39SAndroid Build Coastguard Worker      * @return the offset to add *to* GMT to get local time.
608*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
609*0e209d39SAndroid Build Coastguard Worker      */
610*0e209d39SAndroid Build Coastguard Worker     virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day,
611*0e209d39SAndroid Build Coastguard Worker                               uint8_t dayOfWeek, int32_t milliseconds,
612*0e209d39SAndroid Build Coastguard Worker                               int32_t monthLength, int32_t prevMonthLength,
613*0e209d39SAndroid Build Coastguard Worker                               UErrorCode& status) const;
614*0e209d39SAndroid Build Coastguard Worker 
615*0e209d39SAndroid Build Coastguard Worker     /**
616*0e209d39SAndroid Build Coastguard Worker      * Redeclared TimeZone method.  This implementation simply calls
617*0e209d39SAndroid Build Coastguard Worker      * the base class method, which otherwise would be hidden.
618*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.8
619*0e209d39SAndroid Build Coastguard Worker      */
620*0e209d39SAndroid Build Coastguard Worker     virtual void getOffset(UDate date, UBool local, int32_t& rawOffset,
621*0e209d39SAndroid Build Coastguard Worker                            int32_t& dstOffset, UErrorCode& ec) const override;
622*0e209d39SAndroid Build Coastguard Worker 
623*0e209d39SAndroid Build Coastguard Worker     /**
624*0e209d39SAndroid Build Coastguard Worker      * Get time zone offsets from local wall time.
625*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 69
626*0e209d39SAndroid Build Coastguard Worker      */
627*0e209d39SAndroid Build Coastguard Worker     virtual void getOffsetFromLocal(
628*0e209d39SAndroid Build Coastguard Worker         UDate date, UTimeZoneLocalOption nonExistingTimeOpt,
629*0e209d39SAndroid Build Coastguard Worker         UTimeZoneLocalOption duplicatedTimeOpt,
630*0e209d39SAndroid Build Coastguard Worker         int32_t& rawOffset, int32_t& dstOffset, UErrorCode& status) const override;
631*0e209d39SAndroid Build Coastguard Worker 
632*0e209d39SAndroid Build Coastguard Worker     /**
633*0e209d39SAndroid Build Coastguard Worker      * Returns the TimeZone's raw GMT offset (i.e., the number of milliseconds to add
634*0e209d39SAndroid Build Coastguard Worker      * to GMT to get local time, before taking daylight savings time into account).
635*0e209d39SAndroid Build Coastguard Worker      *
636*0e209d39SAndroid Build Coastguard Worker      * @return   The TimeZone's raw GMT offset.
637*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
638*0e209d39SAndroid Build Coastguard Worker      */
639*0e209d39SAndroid Build Coastguard Worker     virtual int32_t getRawOffset() const override;
640*0e209d39SAndroid Build Coastguard Worker 
641*0e209d39SAndroid Build Coastguard Worker     /**
642*0e209d39SAndroid Build Coastguard Worker      * Sets the TimeZone's raw GMT offset (i.e., the number of milliseconds to add
643*0e209d39SAndroid Build Coastguard Worker      * to GMT to get local time, before taking daylight savings time into account).
644*0e209d39SAndroid Build Coastguard Worker      *
645*0e209d39SAndroid Build Coastguard Worker      * @param offsetMillis  The new raw GMT offset for this time zone.
646*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
647*0e209d39SAndroid Build Coastguard Worker      */
648*0e209d39SAndroid Build Coastguard Worker     virtual void setRawOffset(int32_t offsetMillis) override;
649*0e209d39SAndroid Build Coastguard Worker 
650*0e209d39SAndroid Build Coastguard Worker     /**
651*0e209d39SAndroid Build Coastguard Worker      * Sets the amount of time in ms that the clock is advanced during DST.
652*0e209d39SAndroid Build Coastguard Worker      * @param millisSavedDuringDST the number of milliseconds the time is
653*0e209d39SAndroid Build Coastguard Worker      * advanced with respect to standard time when the daylight savings rules
654*0e209d39SAndroid Build Coastguard Worker      * are in effect. Typically one hour (+3600000). The amount could be negative,
655*0e209d39SAndroid Build Coastguard Worker      * but not 0.
656*0e209d39SAndroid Build Coastguard Worker      * @param status  An UErrorCode to receive the status.
657*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
658*0e209d39SAndroid Build Coastguard Worker      */
659*0e209d39SAndroid Build Coastguard Worker     void setDSTSavings(int32_t millisSavedDuringDST, UErrorCode& status);
660*0e209d39SAndroid Build Coastguard Worker 
661*0e209d39SAndroid Build Coastguard Worker     /**
662*0e209d39SAndroid Build Coastguard Worker      * Returns the amount of time in ms that the clock is advanced during DST.
663*0e209d39SAndroid Build Coastguard Worker      * @return the number of milliseconds the time is
664*0e209d39SAndroid Build Coastguard Worker      * advanced with respect to standard time when the daylight savings rules
665*0e209d39SAndroid Build Coastguard Worker      * are in effect. Typically one hour (+3600000). The amount could be negative,
666*0e209d39SAndroid Build Coastguard Worker      * but not 0.
667*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
668*0e209d39SAndroid Build Coastguard Worker      */
669*0e209d39SAndroid Build Coastguard Worker     virtual int32_t getDSTSavings() const override;
670*0e209d39SAndroid Build Coastguard Worker 
671*0e209d39SAndroid Build Coastguard Worker     /**
672*0e209d39SAndroid Build Coastguard Worker      * Queries if this TimeZone uses Daylight Savings Time.
673*0e209d39SAndroid Build Coastguard Worker      *
674*0e209d39SAndroid Build Coastguard Worker      * @return   True if this TimeZone uses Daylight Savings Time; false otherwise.
675*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
676*0e209d39SAndroid Build Coastguard Worker      */
677*0e209d39SAndroid Build Coastguard Worker     virtual UBool useDaylightTime() const override;
678*0e209d39SAndroid Build Coastguard Worker 
679*0e209d39SAndroid Build Coastguard Worker #ifndef U_FORCE_HIDE_DEPRECATED_API
680*0e209d39SAndroid Build Coastguard Worker     /**
681*0e209d39SAndroid Build Coastguard Worker      * Returns true if the given date is within the period when daylight savings time
682*0e209d39SAndroid Build Coastguard Worker      * is in effect; false otherwise.  If the TimeZone doesn't observe daylight savings
683*0e209d39SAndroid Build Coastguard Worker      * time, this functions always returns false.
684*0e209d39SAndroid Build Coastguard Worker      * This method is wasteful since it creates a new GregorianCalendar and
685*0e209d39SAndroid Build Coastguard Worker      * deletes it each time it is called. This is a deprecated method
686*0e209d39SAndroid Build Coastguard Worker      * and provided only for Java compatibility.
687*0e209d39SAndroid Build Coastguard Worker      *
688*0e209d39SAndroid Build Coastguard Worker      * @param date The date to test.
689*0e209d39SAndroid Build Coastguard Worker      * @param status  An UErrorCode to receive the status.
690*0e209d39SAndroid Build Coastguard Worker      * @return true if the given date is in Daylight Savings Time;
691*0e209d39SAndroid Build Coastguard Worker      * false otherwise.
692*0e209d39SAndroid Build Coastguard Worker      * @deprecated ICU 2.4. Use Calendar::inDaylightTime() instead.
693*0e209d39SAndroid Build Coastguard Worker      */
694*0e209d39SAndroid Build Coastguard Worker     virtual UBool inDaylightTime(UDate date, UErrorCode& status) const override;
695*0e209d39SAndroid Build Coastguard Worker #endif  // U_FORCE_HIDE_DEPRECATED_API
696*0e209d39SAndroid Build Coastguard Worker 
697*0e209d39SAndroid Build Coastguard Worker     /**
698*0e209d39SAndroid Build Coastguard Worker      * Return true if this zone has the same rules and offset as another zone.
699*0e209d39SAndroid Build Coastguard Worker      * @param other the TimeZone object to be compared with
700*0e209d39SAndroid Build Coastguard Worker      * @return true if the given zone has the same rules and offset as this one
701*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
702*0e209d39SAndroid Build Coastguard Worker      */
703*0e209d39SAndroid Build Coastguard Worker     UBool hasSameRules(const TimeZone& other) const override;
704*0e209d39SAndroid Build Coastguard Worker 
705*0e209d39SAndroid Build Coastguard Worker     /**
706*0e209d39SAndroid Build Coastguard Worker      * Clones TimeZone objects polymorphically. Clients are responsible for deleting
707*0e209d39SAndroid Build Coastguard Worker      * the TimeZone object cloned.
708*0e209d39SAndroid Build Coastguard Worker      *
709*0e209d39SAndroid Build Coastguard Worker      * @return   A new copy of this TimeZone object.
710*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
711*0e209d39SAndroid Build Coastguard Worker      */
712*0e209d39SAndroid Build Coastguard Worker     virtual SimpleTimeZone* clone() const override;
713*0e209d39SAndroid Build Coastguard Worker 
714*0e209d39SAndroid Build Coastguard Worker     /**
715*0e209d39SAndroid Build Coastguard Worker      * Gets the first time zone transition after the base time.
716*0e209d39SAndroid Build Coastguard Worker      * @param base      The base time.
717*0e209d39SAndroid Build Coastguard Worker      * @param inclusive Whether the base time is inclusive or not.
718*0e209d39SAndroid Build Coastguard Worker      * @param result    Receives the first transition after the base time.
719*0e209d39SAndroid Build Coastguard Worker      * @return  true if the transition is found.
720*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 3.8
721*0e209d39SAndroid Build Coastguard Worker      */
722*0e209d39SAndroid Build Coastguard Worker     virtual UBool getNextTransition(UDate base, UBool inclusive, TimeZoneTransition& result) const override;
723*0e209d39SAndroid Build Coastguard Worker 
724*0e209d39SAndroid Build Coastguard Worker     /**
725*0e209d39SAndroid Build Coastguard Worker      * Gets the most recent time zone transition before the base time.
726*0e209d39SAndroid Build Coastguard Worker      * @param base      The base time.
727*0e209d39SAndroid Build Coastguard Worker      * @param inclusive Whether the base time is inclusive or not.
728*0e209d39SAndroid Build Coastguard Worker      * @param result    Receives the most recent transition before the base time.
729*0e209d39SAndroid Build Coastguard Worker      * @return  true if the transition is found.
730*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 3.8
731*0e209d39SAndroid Build Coastguard Worker      */
732*0e209d39SAndroid Build Coastguard Worker     virtual UBool getPreviousTransition(UDate base, UBool inclusive, TimeZoneTransition& result) const override;
733*0e209d39SAndroid Build Coastguard Worker 
734*0e209d39SAndroid Build Coastguard Worker     /**
735*0e209d39SAndroid Build Coastguard Worker      * Returns the number of <code>TimeZoneRule</code>s which represents time transitions,
736*0e209d39SAndroid Build Coastguard Worker      * for this time zone, that is, all <code>TimeZoneRule</code>s for this time zone except
737*0e209d39SAndroid Build Coastguard Worker      * <code>InitialTimeZoneRule</code>.  The return value range is 0 or any positive value.
738*0e209d39SAndroid Build Coastguard Worker      * @param status    Receives error status code.
739*0e209d39SAndroid Build Coastguard Worker      * @return The number of <code>TimeZoneRule</code>s representing time transitions.
740*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 3.8
741*0e209d39SAndroid Build Coastguard Worker      */
742*0e209d39SAndroid Build Coastguard Worker     virtual int32_t countTransitionRules(UErrorCode& status) const override;
743*0e209d39SAndroid Build Coastguard Worker 
744*0e209d39SAndroid Build Coastguard Worker     /**
745*0e209d39SAndroid Build Coastguard Worker      * Gets the <code>InitialTimeZoneRule</code> and the set of <code>TimeZoneRule</code>
746*0e209d39SAndroid Build Coastguard Worker      * which represent time transitions for this time zone.  On successful return,
747*0e209d39SAndroid Build Coastguard Worker      * the argument initial points to non-nullptr <code>InitialTimeZoneRule</code> and
748*0e209d39SAndroid Build Coastguard Worker      * the array trsrules is filled with 0 or multiple <code>TimeZoneRule</code>
749*0e209d39SAndroid Build Coastguard Worker      * instances up to the size specified by trscount.  The results are referencing the
750*0e209d39SAndroid Build Coastguard Worker      * rule instance held by this time zone instance.  Therefore, after this time zone
751*0e209d39SAndroid Build Coastguard Worker      * is destructed, they are no longer available.
752*0e209d39SAndroid Build Coastguard Worker      * @param initial       Receives the initial timezone rule
753*0e209d39SAndroid Build Coastguard Worker      * @param trsrules      Receives the timezone transition rules
754*0e209d39SAndroid Build Coastguard Worker      * @param trscount      On input, specify the size of the array 'transitions' receiving
755*0e209d39SAndroid Build Coastguard Worker      *                      the timezone transition rules.  On output, actual number of
756*0e209d39SAndroid Build Coastguard Worker      *                      rules filled in the array will be set.
757*0e209d39SAndroid Build Coastguard Worker      * @param status        Receives error status code.
758*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 3.8
759*0e209d39SAndroid Build Coastguard Worker      */
760*0e209d39SAndroid Build Coastguard Worker     virtual void getTimeZoneRules(const InitialTimeZoneRule*& initial,
761*0e209d39SAndroid Build Coastguard Worker         const TimeZoneRule* trsrules[], int32_t& trscount, UErrorCode& status) const override;
762*0e209d39SAndroid Build Coastguard Worker 
763*0e209d39SAndroid Build Coastguard Worker 
764*0e209d39SAndroid Build Coastguard Worker public:
765*0e209d39SAndroid Build Coastguard Worker 
766*0e209d39SAndroid Build Coastguard Worker     /**
767*0e209d39SAndroid Build Coastguard Worker      * Override TimeZone Returns a unique class ID POLYMORPHICALLY. Pure virtual
768*0e209d39SAndroid Build Coastguard Worker      * override. This method is to implement a simple version of RTTI, since not all C++
769*0e209d39SAndroid Build Coastguard Worker      * compilers support genuine RTTI. Polymorphic operator==() and clone() methods call
770*0e209d39SAndroid Build Coastguard Worker      * this method.
771*0e209d39SAndroid Build Coastguard Worker      *
772*0e209d39SAndroid Build Coastguard Worker      * @return   The class ID for this object. All objects of a given class have the
773*0e209d39SAndroid Build Coastguard Worker      *           same class ID. Objects of other classes have different class IDs.
774*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
775*0e209d39SAndroid Build Coastguard Worker      */
776*0e209d39SAndroid Build Coastguard Worker     virtual UClassID getDynamicClassID() const override;
777*0e209d39SAndroid Build Coastguard Worker 
778*0e209d39SAndroid Build Coastguard Worker     /**
779*0e209d39SAndroid Build Coastguard Worker      * Return the class ID for this class. This is useful only for comparing to a return
780*0e209d39SAndroid Build Coastguard Worker      * value from getDynamicClassID(). For example:
781*0e209d39SAndroid Build Coastguard Worker      * <pre>
782*0e209d39SAndroid Build Coastguard Worker      * .   Base* polymorphic_pointer = createPolymorphicObject();
783*0e209d39SAndroid Build Coastguard Worker      * .   if (polymorphic_pointer->getDynamicClassID() ==
784*0e209d39SAndroid Build Coastguard Worker      * .       Derived::getStaticClassID()) ...
785*0e209d39SAndroid Build Coastguard Worker      * </pre>
786*0e209d39SAndroid Build Coastguard Worker      * @return   The class ID for all objects of this class.
787*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
788*0e209d39SAndroid Build Coastguard Worker      */
789*0e209d39SAndroid Build Coastguard Worker     static UClassID U_EXPORT2 getStaticClassID();
790*0e209d39SAndroid Build Coastguard Worker 
791*0e209d39SAndroid Build Coastguard Worker private:
792*0e209d39SAndroid Build Coastguard Worker     /**
793*0e209d39SAndroid Build Coastguard Worker      * Constants specifying values of startMode and endMode.
794*0e209d39SAndroid Build Coastguard Worker      */
795*0e209d39SAndroid Build Coastguard Worker     enum EMode
796*0e209d39SAndroid Build Coastguard Worker     {
797*0e209d39SAndroid Build Coastguard Worker         DOM_MODE = 1,
798*0e209d39SAndroid Build Coastguard Worker         DOW_IN_MONTH_MODE,
799*0e209d39SAndroid Build Coastguard Worker         DOW_GE_DOM_MODE,
800*0e209d39SAndroid Build Coastguard Worker         DOW_LE_DOM_MODE
801*0e209d39SAndroid Build Coastguard Worker     };
802*0e209d39SAndroid Build Coastguard Worker 
803*0e209d39SAndroid Build Coastguard Worker     SimpleTimeZone() = delete; // default constructor not implemented
804*0e209d39SAndroid Build Coastguard Worker 
805*0e209d39SAndroid Build Coastguard Worker     /**
806*0e209d39SAndroid Build Coastguard Worker      * Internal construction method.
807*0e209d39SAndroid Build Coastguard Worker      * @param rawOffsetGMT    The new SimpleTimeZone's raw GMT offset
808*0e209d39SAndroid Build Coastguard Worker      * @param startMonth      the month DST starts
809*0e209d39SAndroid Build Coastguard Worker      * @param startDay        the day DST starts
810*0e209d39SAndroid Build Coastguard Worker      * @param startDayOfWeek  the DOW DST starts
811*0e209d39SAndroid Build Coastguard Worker      * @param startTime       the time DST starts
812*0e209d39SAndroid Build Coastguard Worker      * @param startTimeMode   Whether the start time is local wall time, local
813*0e209d39SAndroid Build Coastguard Worker      *                        standard time, or UTC time. Default is local wall time.
814*0e209d39SAndroid Build Coastguard Worker      * @param endMonth        the month DST ends
815*0e209d39SAndroid Build Coastguard Worker      * @param endDay          the day DST ends
816*0e209d39SAndroid Build Coastguard Worker      * @param endDayOfWeek    the DOW DST ends
817*0e209d39SAndroid Build Coastguard Worker      * @param endTime         the time DST ends
818*0e209d39SAndroid Build Coastguard Worker      * @param endTimeMode     Whether the end time is local wall time, local
819*0e209d39SAndroid Build Coastguard Worker      *                        standard time, or UTC time. Default is local wall time.
820*0e209d39SAndroid Build Coastguard Worker      * @param dstSavings      The number of milliseconds added to standard time
821*0e209d39SAndroid Build Coastguard Worker      *                        to get DST time. Default is one hour.
822*0e209d39SAndroid Build Coastguard Worker      * @param status          An UErrorCode to receive the status.
823*0e209d39SAndroid Build Coastguard Worker      */
824*0e209d39SAndroid Build Coastguard Worker     void construct(int32_t rawOffsetGMT,
825*0e209d39SAndroid Build Coastguard Worker                    int8_t startMonth, int8_t startDay, int8_t startDayOfWeek,
826*0e209d39SAndroid Build Coastguard Worker                    int32_t startTime, TimeMode startTimeMode,
827*0e209d39SAndroid Build Coastguard Worker                    int8_t endMonth, int8_t endDay, int8_t endDayOfWeek,
828*0e209d39SAndroid Build Coastguard Worker                    int32_t endTime, TimeMode endTimeMode,
829*0e209d39SAndroid Build Coastguard Worker                    int32_t dstSavings, UErrorCode& status);
830*0e209d39SAndroid Build Coastguard Worker 
831*0e209d39SAndroid Build Coastguard Worker     /**
832*0e209d39SAndroid Build Coastguard Worker      * Compare a given date in the year to a rule. Return 1, 0, or -1, depending
833*0e209d39SAndroid Build Coastguard Worker      * on whether the date is after, equal to, or before the rule date. The
834*0e209d39SAndroid Build Coastguard Worker      * millis are compared directly against the ruleMillis, so any
835*0e209d39SAndroid Build Coastguard Worker      * standard-daylight adjustments must be handled by the caller.
836*0e209d39SAndroid Build Coastguard Worker      *
837*0e209d39SAndroid Build Coastguard Worker      * @return  1 if the date is after the rule date, -1 if the date is before
838*0e209d39SAndroid Build Coastguard Worker      *          the rule date, or 0 if the date is equal to the rule date.
839*0e209d39SAndroid Build Coastguard Worker      */
840*0e209d39SAndroid Build Coastguard Worker     static int32_t compareToRule(int8_t month, int8_t monthLen, int8_t prevMonthLen,
841*0e209d39SAndroid Build Coastguard Worker                                  int8_t dayOfMonth,
842*0e209d39SAndroid Build Coastguard Worker                                  int8_t dayOfWeek, int32_t millis, int32_t millisDelta,
843*0e209d39SAndroid Build Coastguard Worker                                  EMode ruleMode, int8_t ruleMonth, int8_t ruleDayOfWeek,
844*0e209d39SAndroid Build Coastguard Worker                                  int8_t ruleDay, int32_t ruleMillis);
845*0e209d39SAndroid Build Coastguard Worker 
846*0e209d39SAndroid Build Coastguard Worker     /**
847*0e209d39SAndroid Build Coastguard Worker      * Given a set of encoded rules in startDay and startDayOfMonth, decode
848*0e209d39SAndroid Build Coastguard Worker      * them and set the startMode appropriately.  Do the same for endDay and
849*0e209d39SAndroid Build Coastguard Worker      * endDayOfMonth.
850*0e209d39SAndroid Build Coastguard Worker      * <P>
851*0e209d39SAndroid Build Coastguard Worker      * Upon entry, the day of week variables may be zero or
852*0e209d39SAndroid Build Coastguard Worker      * negative, in order to indicate special modes.  The day of month
853*0e209d39SAndroid Build Coastguard Worker      * variables may also be negative.
854*0e209d39SAndroid Build Coastguard Worker      * <P>
855*0e209d39SAndroid Build Coastguard Worker      * Upon exit, the mode variables will be
856*0e209d39SAndroid Build Coastguard Worker      * set, and the day of week and day of month variables will be positive.
857*0e209d39SAndroid Build Coastguard Worker      * <P>
858*0e209d39SAndroid Build Coastguard Worker      * This method also recognizes a startDay or endDay of zero as indicating
859*0e209d39SAndroid Build Coastguard Worker      * no DST.
860*0e209d39SAndroid Build Coastguard Worker      */
861*0e209d39SAndroid Build Coastguard Worker     void decodeRules(UErrorCode& status);
862*0e209d39SAndroid Build Coastguard Worker     void decodeStartRule(UErrorCode& status);
863*0e209d39SAndroid Build Coastguard Worker     void decodeEndRule(UErrorCode& status);
864*0e209d39SAndroid Build Coastguard Worker 
865*0e209d39SAndroid Build Coastguard Worker     int8_t startMonth, startDay, startDayOfWeek;   // the month, day, DOW, and time DST starts
866*0e209d39SAndroid Build Coastguard Worker     int32_t startTime;
867*0e209d39SAndroid Build Coastguard Worker     TimeMode startTimeMode, endTimeMode; // Mode for startTime, endTime; see TimeMode
868*0e209d39SAndroid Build Coastguard Worker     int8_t endMonth, endDay, endDayOfWeek; // the month, day, DOW, and time DST ends
869*0e209d39SAndroid Build Coastguard Worker     int32_t endTime;
870*0e209d39SAndroid Build Coastguard Worker     int32_t startYear;  // the year these DST rules took effect
871*0e209d39SAndroid Build Coastguard Worker     int32_t rawOffset;  // the TimeZone's raw GMT offset
872*0e209d39SAndroid Build Coastguard Worker     UBool useDaylight; // flag indicating whether this TimeZone uses DST
873*0e209d39SAndroid Build Coastguard Worker     static const int8_t STATICMONTHLENGTH[12]; // lengths of the months
874*0e209d39SAndroid Build Coastguard Worker     EMode startMode, endMode;   // flags indicating what kind of rules the DST rules are
875*0e209d39SAndroid Build Coastguard Worker 
876*0e209d39SAndroid Build Coastguard Worker     /**
877*0e209d39SAndroid Build Coastguard Worker      * A positive value indicating the amount of time saved during DST in ms.
878*0e209d39SAndroid Build Coastguard Worker      * Typically one hour; sometimes 30 minutes.
879*0e209d39SAndroid Build Coastguard Worker      */
880*0e209d39SAndroid Build Coastguard Worker     int32_t dstSavings;
881*0e209d39SAndroid Build Coastguard Worker 
882*0e209d39SAndroid Build Coastguard Worker     /* Private for BasicTimeZone implementation */
883*0e209d39SAndroid Build Coastguard Worker     void checkTransitionRules(UErrorCode& status) const;
884*0e209d39SAndroid Build Coastguard Worker     void initTransitionRules(UErrorCode& status);
885*0e209d39SAndroid Build Coastguard Worker     void clearTransitionRules();
886*0e209d39SAndroid Build Coastguard Worker     void deleteTransitionRules();
887*0e209d39SAndroid Build Coastguard Worker     UBool   transitionRulesInitialized;
888*0e209d39SAndroid Build Coastguard Worker     InitialTimeZoneRule*    initialRule;
889*0e209d39SAndroid Build Coastguard Worker     TimeZoneTransition*     firstTransition;
890*0e209d39SAndroid Build Coastguard Worker     AnnualTimeZoneRule*     stdRule;
891*0e209d39SAndroid Build Coastguard Worker     AnnualTimeZoneRule*     dstRule;
892*0e209d39SAndroid Build Coastguard Worker };
893*0e209d39SAndroid Build Coastguard Worker 
setStartRule(int32_t month,int32_t dayOfWeekInMonth,int32_t dayOfWeek,int32_t time,UErrorCode & status)894*0e209d39SAndroid Build Coastguard Worker inline void SimpleTimeZone::setStartRule(int32_t month, int32_t dayOfWeekInMonth,
895*0e209d39SAndroid Build Coastguard Worker                                          int32_t dayOfWeek,
896*0e209d39SAndroid Build Coastguard Worker                                          int32_t time, UErrorCode& status) {
897*0e209d39SAndroid Build Coastguard Worker     setStartRule(month, dayOfWeekInMonth, dayOfWeek, time, WALL_TIME, status);
898*0e209d39SAndroid Build Coastguard Worker }
899*0e209d39SAndroid Build Coastguard Worker 
setStartRule(int32_t month,int32_t dayOfMonth,int32_t time,UErrorCode & status)900*0e209d39SAndroid Build Coastguard Worker inline void SimpleTimeZone::setStartRule(int32_t month, int32_t dayOfMonth,
901*0e209d39SAndroid Build Coastguard Worker                                          int32_t time,
902*0e209d39SAndroid Build Coastguard Worker                                          UErrorCode& status) {
903*0e209d39SAndroid Build Coastguard Worker     setStartRule(month, dayOfMonth, time, WALL_TIME, status);
904*0e209d39SAndroid Build Coastguard Worker }
905*0e209d39SAndroid Build Coastguard Worker 
setStartRule(int32_t month,int32_t dayOfMonth,int32_t dayOfWeek,int32_t time,UBool after,UErrorCode & status)906*0e209d39SAndroid Build Coastguard Worker inline void SimpleTimeZone::setStartRule(int32_t month, int32_t dayOfMonth,
907*0e209d39SAndroid Build Coastguard Worker                                          int32_t dayOfWeek,
908*0e209d39SAndroid Build Coastguard Worker                                          int32_t time, UBool after, UErrorCode& status) {
909*0e209d39SAndroid Build Coastguard Worker     setStartRule(month, dayOfMonth, dayOfWeek, time, WALL_TIME, after, status);
910*0e209d39SAndroid Build Coastguard Worker }
911*0e209d39SAndroid Build Coastguard Worker 
setEndRule(int32_t month,int32_t dayOfWeekInMonth,int32_t dayOfWeek,int32_t time,UErrorCode & status)912*0e209d39SAndroid Build Coastguard Worker inline void SimpleTimeZone::setEndRule(int32_t month, int32_t dayOfWeekInMonth,
913*0e209d39SAndroid Build Coastguard Worker                                        int32_t dayOfWeek,
914*0e209d39SAndroid Build Coastguard Worker                                        int32_t time, UErrorCode& status) {
915*0e209d39SAndroid Build Coastguard Worker     setEndRule(month, dayOfWeekInMonth, dayOfWeek, time, WALL_TIME, status);
916*0e209d39SAndroid Build Coastguard Worker }
917*0e209d39SAndroid Build Coastguard Worker 
setEndRule(int32_t month,int32_t dayOfMonth,int32_t time,UErrorCode & status)918*0e209d39SAndroid Build Coastguard Worker inline void SimpleTimeZone::setEndRule(int32_t month, int32_t dayOfMonth,
919*0e209d39SAndroid Build Coastguard Worker                                        int32_t time, UErrorCode& status) {
920*0e209d39SAndroid Build Coastguard Worker     setEndRule(month, dayOfMonth, time, WALL_TIME, status);
921*0e209d39SAndroid Build Coastguard Worker }
922*0e209d39SAndroid Build Coastguard Worker 
setEndRule(int32_t month,int32_t dayOfMonth,int32_t dayOfWeek,int32_t time,UBool after,UErrorCode & status)923*0e209d39SAndroid Build Coastguard Worker inline void SimpleTimeZone::setEndRule(int32_t month, int32_t dayOfMonth, int32_t dayOfWeek,
924*0e209d39SAndroid Build Coastguard Worker                                        int32_t time, UBool after, UErrorCode& status) {
925*0e209d39SAndroid Build Coastguard Worker     setEndRule(month, dayOfMonth, dayOfWeek, time, WALL_TIME, after, status);
926*0e209d39SAndroid Build Coastguard Worker }
927*0e209d39SAndroid Build Coastguard Worker 
928*0e209d39SAndroid Build Coastguard Worker inline void
getOffset(UDate date,UBool local,int32_t & rawOffsetRef,int32_t & dstOffsetRef,UErrorCode & ec)929*0e209d39SAndroid Build Coastguard Worker SimpleTimeZone::getOffset(UDate date, UBool local, int32_t& rawOffsetRef,
930*0e209d39SAndroid Build Coastguard Worker                           int32_t& dstOffsetRef, UErrorCode& ec) const {
931*0e209d39SAndroid Build Coastguard Worker     TimeZone::getOffset(date, local, rawOffsetRef, dstOffsetRef, ec);
932*0e209d39SAndroid Build Coastguard Worker }
933*0e209d39SAndroid Build Coastguard Worker 
934*0e209d39SAndroid Build Coastguard Worker U_NAMESPACE_END
935*0e209d39SAndroid Build Coastguard Worker 
936*0e209d39SAndroid Build Coastguard Worker #endif /* #if !UCONFIG_NO_FORMATTING */
937*0e209d39SAndroid Build Coastguard Worker 
938*0e209d39SAndroid Build Coastguard Worker #endif /* U_SHOW_CPLUSPLUS_API */
939*0e209d39SAndroid Build Coastguard Worker 
940*0e209d39SAndroid Build Coastguard Worker #endif // _SIMPLETZ
941