intl/icu/source/i18n/unicode/simpletz.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/intl/icu/source/i18n/unicode/simpletz.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,928 @@
     1.4 +/*
     1.5 + ********************************************************************************
     1.6 + * Copyright (C) 1997-2013, International Business Machines                     *
     1.7 + * Corporation and others. All Rights Reserved.                                 *
     1.8 + ********************************************************************************
     1.9 + *
    1.10 + * File SIMPLETZ.H
    1.11 + *
    1.12 + * Modification History:
    1.13 + *
    1.14 + *   Date        Name        Description
    1.15 + *   04/21/97    aliu        Overhauled header.
    1.16 + *   08/10/98    stephen     JDK 1.2 sync
    1.17 + *                           Added setStartRule() / setEndRule() overloads
    1.18 + *                           Added hasSameRules()
    1.19 + *   09/02/98    stephen     Added getOffset(monthLen)
    1.20 + *                           Changed getOffset() to take UErrorCode
    1.21 + *   07/09/99    stephen     Removed millisPerHour (unused, for HP compiler)
    1.22 + *   12/02/99    aliu        Added TimeMode and constructor and setStart/EndRule
    1.23 + *                           methods that take TimeMode. Added to docs.
    1.24 + ********************************************************************************
    1.25 + */
    1.26 +
    1.27 +#ifndef SIMPLETZ_H
    1.28 +#define SIMPLETZ_H
    1.29 +
    1.30 +#include "unicode/utypes.h"
    1.31 +
    1.32 +/**
    1.33 + * \file 
    1.34 + * \brief C++ API: SimpleTimeZone is a concrete subclass of TimeZone.
    1.35 + */
    1.36 + 
    1.37 +#if !UCONFIG_NO_FORMATTING
    1.38 +
    1.39 +#include "unicode/basictz.h"
    1.40 +
    1.41 +U_NAMESPACE_BEGIN
    1.42 +
    1.43 +// forward declaration
    1.44 +class InitialTimeZoneRule;
    1.45 +class TimeZoneTransition;
    1.46 +class AnnualTimeZoneRule;
    1.47 +
    1.48 +/**
    1.49 + * <code>SimpleTimeZone</code> is a concrete subclass of <code>TimeZone</code>
    1.50 + * that represents a time zone for use with a Gregorian calendar. This
    1.51 + * class does not handle historical changes.
    1.52 + * <P>
    1.53 + * When specifying daylight-savings-time begin and end dates, use a negative value for
    1.54 + * <code>dayOfWeekInMonth</code> to indicate that <code>SimpleTimeZone</code> should
    1.55 + * count from the end of the month backwards. For example, if Daylight Savings
    1.56 + * Time starts or ends at the last Sunday a month, use <code>dayOfWeekInMonth = -1</code>
    1.57 + * along with <code>dayOfWeek = UCAL_SUNDAY</code> to specify the rule.
    1.58 + *
    1.59 + * @see      Calendar
    1.60 + * @see      GregorianCalendar
    1.61 + * @see      TimeZone
    1.62 + * @author   D. Goldsmith, Mark Davis, Chen-Lieh Huang, Alan Liu
    1.63 + */
    1.64 +class U_I18N_API SimpleTimeZone: public BasicTimeZone {
    1.65 +public:
    1.66 +
    1.67 +    /**
    1.68 +     * TimeMode is used, together with a millisecond offset after
    1.69 +     * midnight, to specify a rule transition time.  Most rules
    1.70 +     * transition at a local wall time, that is, according to the
    1.71 +     * current time in effect, either standard, or DST.  However, some
    1.72 +     * rules transition at local standard time, and some at a specific
    1.73 +     * UTC time.  Although it might seem that all times could be
    1.74 +     * converted to wall time, thus eliminating the need for this
    1.75 +     * parameter, this is not the case.
    1.76 +     * @stable ICU 2.0
    1.77 +     */
    1.78 +    enum TimeMode {
    1.79 +        WALL_TIME = 0,
    1.80 +        STANDARD_TIME,
    1.81 +        UTC_TIME
    1.82 +    };
    1.83 +
    1.84 +    /**
    1.85 +     * Copy constructor
    1.86 +     * @param source the object to be copied.
    1.87 +     * @stable ICU 2.0
    1.88 +     */
    1.89 +    SimpleTimeZone(const SimpleTimeZone& source);
    1.90 +
    1.91 +    /**
    1.92 +     * Default assignment operator
    1.93 +     * @param right    the object to be copied.
    1.94 +     * @stable ICU 2.0
    1.95 +     */
    1.96 +    SimpleTimeZone& operator=(const SimpleTimeZone& right);
    1.97 +
    1.98 +    /**
    1.99 +     * Destructor
   1.100 +     * @stable ICU 2.0
   1.101 +     */
   1.102 +    virtual ~SimpleTimeZone();
   1.103 +
   1.104 +    /**
   1.105 +     * Returns true if the two TimeZone objects are equal; that is, they have
   1.106 +     * the same ID, raw GMT offset, and DST rules.
   1.107 +     *
   1.108 +     * @param that  The SimpleTimeZone object to be compared with.
   1.109 +     * @return      True if the given time zone is equal to this time zone; false
   1.110 +     *              otherwise.
   1.111 +     * @stable ICU 2.0
   1.112 +     */
   1.113 +    virtual UBool operator==(const TimeZone& that) const;
   1.114 +
   1.115 +    /**
   1.116 +     * Constructs a SimpleTimeZone with the given raw GMT offset and time zone ID,
   1.117 +     * and which doesn't observe daylight savings time.  Normally you should use
   1.118 +     * TimeZone::createInstance() to create a TimeZone instead of creating a
   1.119 +     * SimpleTimeZone directly with this constructor.
   1.120 +     *
   1.121 +     * @param rawOffsetGMT  The given base time zone offset to GMT.
   1.122 +     * @param ID         The timezone ID which is obtained from
   1.123 +     *                   TimeZone.getAvailableIDs.
   1.124 +     * @stable ICU 2.0
   1.125 +     */
   1.126 +    SimpleTimeZone(int32_t rawOffsetGMT, const UnicodeString& ID);
   1.127 +
   1.128 +    /**
   1.129 +     * Construct a SimpleTimeZone with the given raw GMT offset, time zone ID,
   1.130 +     * and times to start and end daylight savings time. To create a TimeZone that
   1.131 +     * doesn't observe daylight savings time, don't use this constructor; use
   1.132 +     * SimpleTimeZone(rawOffset, ID) instead. Normally, you should use
   1.133 +     * TimeZone.createInstance() to create a TimeZone instead of creating a
   1.134 +     * SimpleTimeZone directly with this constructor.
   1.135 +     * <P>
   1.136 +     * Various types of daylight-savings time rules can be specfied by using different
   1.137 +     * values for startDay and startDayOfWeek and endDay and endDayOfWeek.  For a
   1.138 +     * complete explanation of how these parameters work, see the documentation for
   1.139 +     * setStartRule().
   1.140 +     *
   1.141 +     * @param rawOffsetGMT      The new SimpleTimeZone's raw GMT offset
   1.142 +     * @param ID                The new SimpleTimeZone's time zone ID.
   1.143 +     * @param savingsStartMonth The daylight savings starting month. Month is
   1.144 +     *                          0-based. eg, 0 for January.
   1.145 +     * @param savingsStartDayOfWeekInMonth   The daylight savings starting
   1.146 +     *                          day-of-week-in-month. See setStartRule() for a
   1.147 +     *                          complete explanation.
   1.148 +     * @param savingsStartDayOfWeek The daylight savings starting day-of-week.
   1.149 +     *                          See setStartRule() for a complete explanation.
   1.150 +     * @param savingsStartTime  The daylight savings starting time, expressed as the
   1.151 +     *                          number of milliseconds after midnight.
   1.152 +     * @param savingsEndMonth   The daylight savings ending month. Month is
   1.153 +     *                          0-based. eg, 0 for January.
   1.154 +     * @param savingsEndDayOfWeekInMonth     The daylight savings ending day-of-week-in-month.
   1.155 +     *                          See setStartRule() for a complete explanation.
   1.156 +     * @param savingsEndDayOfWeek The daylight savings ending day-of-week.
   1.157 +     *                          See setStartRule() for a complete explanation.
   1.158 +     * @param savingsEndTime    The daylight savings ending time, expressed as the
   1.159 +     *                          number of milliseconds after midnight.
   1.160 +     * @param status            An UErrorCode to receive the status.
   1.161 +     * @stable ICU 2.0
   1.162 +     */
   1.163 +    SimpleTimeZone(int32_t rawOffsetGMT, const UnicodeString& ID,
   1.164 +        int8_t savingsStartMonth, int8_t savingsStartDayOfWeekInMonth,
   1.165 +        int8_t savingsStartDayOfWeek, int32_t savingsStartTime,
   1.166 +        int8_t savingsEndMonth, int8_t savingsEndDayOfWeekInMonth,
   1.167 +        int8_t savingsEndDayOfWeek, int32_t savingsEndTime,
   1.168 +        UErrorCode& status);
   1.169 +    /**
   1.170 +     * Construct a SimpleTimeZone with the given raw GMT offset, time zone ID,
   1.171 +     * and times to start and end daylight savings time. To create a TimeZone that
   1.172 +     * doesn't observe daylight savings time, don't use this constructor; use
   1.173 +     * SimpleTimeZone(rawOffset, ID) instead. Normally, you should use
   1.174 +     * TimeZone.createInstance() to create a TimeZone instead of creating a
   1.175 +     * SimpleTimeZone directly with this constructor.
   1.176 +     * <P>
   1.177 +     * Various types of daylight-savings time rules can be specfied by using different
   1.178 +     * values for startDay and startDayOfWeek and endDay and endDayOfWeek.  For a
   1.179 +     * complete explanation of how these parameters work, see the documentation for
   1.180 +     * setStartRule().
   1.181 +     *
   1.182 +     * @param rawOffsetGMT      The new SimpleTimeZone's raw GMT offset
   1.183 +     * @param ID                The new SimpleTimeZone's time zone ID.
   1.184 +     * @param savingsStartMonth The daylight savings starting month. Month is
   1.185 +     *                          0-based. eg, 0 for January.
   1.186 +     * @param savingsStartDayOfWeekInMonth   The daylight savings starting
   1.187 +     *                          day-of-week-in-month. See setStartRule() for a
   1.188 +     *                          complete explanation.
   1.189 +     * @param savingsStartDayOfWeek The daylight savings starting day-of-week.
   1.190 +     *                          See setStartRule() for a complete explanation.
   1.191 +     * @param savingsStartTime  The daylight savings starting time, expressed as the
   1.192 +     *                          number of milliseconds after midnight.
   1.193 +     * @param savingsEndMonth   The daylight savings ending month. Month is
   1.194 +     *                          0-based. eg, 0 for January.
   1.195 +     * @param savingsEndDayOfWeekInMonth     The daylight savings ending day-of-week-in-month.
   1.196 +     *                          See setStartRule() for a complete explanation.
   1.197 +     * @param savingsEndDayOfWeek The daylight savings ending day-of-week.
   1.198 +     *                          See setStartRule() for a complete explanation.
   1.199 +     * @param savingsEndTime    The daylight savings ending time, expressed as the
   1.200 +     *                          number of milliseconds after midnight.
   1.201 +     * @param savingsDST        The number of milliseconds added to standard time
   1.202 +     *                          to get DST time. Default is one hour.
   1.203 +     * @param status            An UErrorCode to receive the status.
   1.204 +     * @stable ICU 2.0
   1.205 +     */
   1.206 +    SimpleTimeZone(int32_t rawOffsetGMT, const UnicodeString& ID,
   1.207 +        int8_t savingsStartMonth, int8_t savingsStartDayOfWeekInMonth,
   1.208 +        int8_t savingsStartDayOfWeek, int32_t savingsStartTime,
   1.209 +        int8_t savingsEndMonth, int8_t savingsEndDayOfWeekInMonth,
   1.210 +        int8_t savingsEndDayOfWeek, int32_t savingsEndTime,
   1.211 +        int32_t savingsDST, UErrorCode& status);
   1.212 +
   1.213 +    /**
   1.214 +     * Construct a SimpleTimeZone with the given raw GMT offset, time zone ID,
   1.215 +     * and times to start and end daylight savings time. To create a TimeZone that
   1.216 +     * doesn't observe daylight savings time, don't use this constructor; use
   1.217 +     * SimpleTimeZone(rawOffset, ID) instead. Normally, you should use
   1.218 +     * TimeZone.createInstance() to create a TimeZone instead of creating a
   1.219 +     * SimpleTimeZone directly with this constructor.
   1.220 +     * <P>
   1.221 +     * Various types of daylight-savings time rules can be specfied by using different
   1.222 +     * values for startDay and startDayOfWeek and endDay and endDayOfWeek.  For a
   1.223 +     * complete explanation of how these parameters work, see the documentation for
   1.224 +     * setStartRule().
   1.225 +     *
   1.226 +     * @param rawOffsetGMT      The new SimpleTimeZone's raw GMT offset
   1.227 +     * @param ID                The new SimpleTimeZone's time zone ID.
   1.228 +     * @param savingsStartMonth The daylight savings starting month. Month is
   1.229 +     *                          0-based. eg, 0 for January.
   1.230 +     * @param savingsStartDayOfWeekInMonth   The daylight savings starting
   1.231 +     *                          day-of-week-in-month. See setStartRule() for a
   1.232 +     *                          complete explanation.
   1.233 +     * @param savingsStartDayOfWeek The daylight savings starting day-of-week.
   1.234 +     *                          See setStartRule() for a complete explanation.
   1.235 +     * @param savingsStartTime  The daylight savings starting time, expressed as the
   1.236 +     *                          number of milliseconds after midnight.
   1.237 +     * @param savingsStartTimeMode Whether the start time is local wall time, local
   1.238 +     *                          standard time, or UTC time. Default is local wall time.
   1.239 +     * @param savingsEndMonth   The daylight savings ending month. Month is
   1.240 +     *                          0-based. eg, 0 for January.
   1.241 +     * @param savingsEndDayOfWeekInMonth     The daylight savings ending day-of-week-in-month.
   1.242 +     *                          See setStartRule() for a complete explanation.
   1.243 +     * @param savingsEndDayOfWeek The daylight savings ending day-of-week.
   1.244 +     *                          See setStartRule() for a complete explanation.
   1.245 +     * @param savingsEndTime    The daylight savings ending time, expressed as the
   1.246 +     *                          number of milliseconds after midnight.
   1.247 +     * @param savingsEndTimeMode Whether the end time is local wall time, local
   1.248 +     *                          standard time, or UTC time. Default is local wall time.
   1.249 +     * @param savingsDST        The number of milliseconds added to standard time
   1.250 +     *                          to get DST time. Default is one hour.
   1.251 +     * @param status            An UErrorCode to receive the status.
   1.252 +     * @stable ICU 2.0
   1.253 +     */
   1.254 +    SimpleTimeZone(int32_t rawOffsetGMT, const UnicodeString& ID,
   1.255 +        int8_t savingsStartMonth, int8_t savingsStartDayOfWeekInMonth,
   1.256 +        int8_t savingsStartDayOfWeek, int32_t savingsStartTime,
   1.257 +        TimeMode savingsStartTimeMode,
   1.258 +        int8_t savingsEndMonth, int8_t savingsEndDayOfWeekInMonth,
   1.259 +        int8_t savingsEndDayOfWeek, int32_t savingsEndTime, TimeMode savingsEndTimeMode,
   1.260 +        int32_t savingsDST, UErrorCode& status);
   1.261 +
   1.262 +    /**
   1.263 +     * Sets the daylight savings starting year, that is, the year this time zone began
   1.264 +     * observing its specified daylight savings time rules.  The time zone is considered
   1.265 +     * not to observe daylight savings time prior to that year; SimpleTimeZone doesn't
   1.266 +     * support historical daylight-savings-time rules.
   1.267 +     * @param year the daylight savings starting year.
   1.268 +     * @stable ICU 2.0
   1.269 +     */
   1.270 +    void setStartYear(int32_t year);
   1.271 +
   1.272 +    /**
   1.273 +     * Sets the daylight savings starting rule. For example, in the U.S., Daylight Savings
   1.274 +     * Time starts at the second Sunday in March, at 2 AM in standard time.
   1.275 +     * Therefore, you can set the start rule by calling:
   1.276 +     * setStartRule(UCAL_MARCH, 2, UCAL_SUNDAY, 2*60*60*1000);
   1.277 +     * The dayOfWeekInMonth and dayOfWeek parameters together specify how to calculate
   1.278 +     * the exact starting date.  Their exact meaning depend on their respective signs,
   1.279 +     * allowing various types of rules to be constructed, as follows:
   1.280 +     * <ul>
   1.281 +     *   <li>If both dayOfWeekInMonth and dayOfWeek are positive, they specify the
   1.282 +     *       day of week in the month (e.g., (2, WEDNESDAY) is the second Wednesday
   1.283 +     *       of the month).</li>
   1.284 +     *   <li>If dayOfWeek is positive and dayOfWeekInMonth is negative, they specify
   1.285 +     *       the day of week in the month counting backward from the end of the month.
   1.286 +     *       (e.g., (-1, MONDAY) is the last Monday in the month)</li>
   1.287 +     *   <li>If dayOfWeek is zero and dayOfWeekInMonth is positive, dayOfWeekInMonth
   1.288 +     *       specifies the day of the month, regardless of what day of the week it is.
   1.289 +     *       (e.g., (10, 0) is the tenth day of the month)</li>
   1.290 +     *   <li>If dayOfWeek is zero and dayOfWeekInMonth is negative, dayOfWeekInMonth
   1.291 +     *       specifies the day of the month counting backward from the end of the
   1.292 +     *       month, regardless of what day of the week it is (e.g., (-2, 0) is the
   1.293 +     *       next-to-last day of the month).</li>
   1.294 +     *   <li>If dayOfWeek is negative and dayOfWeekInMonth is positive, they specify the
   1.295 +     *       first specified day of the week on or after the specfied day of the month.
   1.296 +     *       (e.g., (15, -SUNDAY) is the first Sunday after the 15th of the month
   1.297 +     *       [or the 15th itself if the 15th is a Sunday].)</li>
   1.298 +     *   <li>If dayOfWeek and DayOfWeekInMonth are both negative, they specify the
   1.299 +     *       last specified day of the week on or before the specified day of the month.
   1.300 +     *       (e.g., (-20, -TUESDAY) is the last Tuesday before the 20th of the month
   1.301 +     *       [or the 20th itself if the 20th is a Tuesday].)</li>
   1.302 +     * </ul>
   1.303 +     * @param month the daylight savings starting month. Month is 0-based.
   1.304 +     * eg, 0 for January.
   1.305 +     * @param dayOfWeekInMonth the daylight savings starting
   1.306 +     * day-of-week-in-month. Please see the member description for an example.
   1.307 +     * @param dayOfWeek the daylight savings starting day-of-week. Please see
   1.308 +     * the member description for an example.
   1.309 +     * @param time the daylight savings starting time. Please see the member
   1.310 +     * description for an example.
   1.311 +     * @param status An UErrorCode
   1.312 +     * @stable ICU 2.0
   1.313 +     */
   1.314 +    void setStartRule(int32_t month, int32_t dayOfWeekInMonth, int32_t dayOfWeek,
   1.315 +                      int32_t time, UErrorCode& status);
   1.316 +    /**
   1.317 +     * Sets the daylight savings starting rule. For example, in the U.S., Daylight Savings
   1.318 +     * Time starts at the second Sunday in March, at 2 AM in standard time.
   1.319 +     * Therefore, you can set the start rule by calling:
   1.320 +     * setStartRule(UCAL_MARCH, 2, UCAL_SUNDAY, 2*60*60*1000);
   1.321 +     * The dayOfWeekInMonth and dayOfWeek parameters together specify how to calculate
   1.322 +     * the exact starting date.  Their exact meaning depend on their respective signs,
   1.323 +     * allowing various types of rules to be constructed, as follows:
   1.324 +     * <ul>
   1.325 +     *   <li>If both dayOfWeekInMonth and dayOfWeek are positive, they specify the
   1.326 +     *       day of week in the month (e.g., (2, WEDNESDAY) is the second Wednesday
   1.327 +     *       of the month).</li>
   1.328 +     *   <li>If dayOfWeek is positive and dayOfWeekInMonth is negative, they specify
   1.329 +     *       the day of week in the month counting backward from the end of the month.
   1.330 +     *       (e.g., (-1, MONDAY) is the last Monday in the month)</li>
   1.331 +     *   <li>If dayOfWeek is zero and dayOfWeekInMonth is positive, dayOfWeekInMonth
   1.332 +     *       specifies the day of the month, regardless of what day of the week it is.
   1.333 +     *       (e.g., (10, 0) is the tenth day of the month)</li>
   1.334 +     *   <li>If dayOfWeek is zero and dayOfWeekInMonth is negative, dayOfWeekInMonth
   1.335 +     *       specifies the day of the month counting backward from the end of the
   1.336 +     *       month, regardless of what day of the week it is (e.g., (-2, 0) is the
   1.337 +     *       next-to-last day of the month).</li>
   1.338 +     *   <li>If dayOfWeek is negative and dayOfWeekInMonth is positive, they specify the
   1.339 +     *       first specified day of the week on or after the specfied day of the month.
   1.340 +     *       (e.g., (15, -SUNDAY) is the first Sunday after the 15th of the month
   1.341 +     *       [or the 15th itself if the 15th is a Sunday].)</li>
   1.342 +     *   <li>If dayOfWeek and DayOfWeekInMonth are both negative, they specify the
   1.343 +     *       last specified day of the week on or before the specified day of the month.
   1.344 +     *       (e.g., (-20, -TUESDAY) is the last Tuesday before the 20th of the month
   1.345 +     *       [or the 20th itself if the 20th is a Tuesday].)</li>
   1.346 +     * </ul>
   1.347 +     * @param month the daylight savings starting month. Month is 0-based.
   1.348 +     * eg, 0 for January.
   1.349 +     * @param dayOfWeekInMonth the daylight savings starting
   1.350 +     * day-of-week-in-month. Please see the member description for an example.
   1.351 +     * @param dayOfWeek the daylight savings starting day-of-week. Please see
   1.352 +     * the member description for an example.
   1.353 +     * @param time the daylight savings starting time. Please see the member
   1.354 +     * description for an example.
   1.355 +     * @param mode whether the time is local wall time, local standard time,
   1.356 +     * or UTC time. Default is local wall time.
   1.357 +     * @param status An UErrorCode
   1.358 +     * @stable ICU 2.0
   1.359 +     */
   1.360 +    void setStartRule(int32_t month, int32_t dayOfWeekInMonth, int32_t dayOfWeek,
   1.361 +                      int32_t time, TimeMode mode, UErrorCode& status);
   1.362 +
   1.363 +    /**
   1.364 +     * Sets the DST start rule to a fixed date within a month.
   1.365 +     *
   1.366 +     * @param month         The month in which this rule occurs (0-based).
   1.367 +     * @param dayOfMonth    The date in that month (1-based).
   1.368 +     * @param time          The time of that day (number of millis after midnight)
   1.369 +     *                      when DST takes effect in local wall time, which is
   1.370 +     *                      standard time in this case.
   1.371 +     * @param status An UErrorCode
   1.372 +     * @stable ICU 2.0
   1.373 +     */
   1.374 +    void setStartRule(int32_t month, int32_t dayOfMonth, int32_t time,
   1.375 +                      UErrorCode& status);
   1.376 +    /**
   1.377 +     * Sets the DST start rule to a fixed date within a month.
   1.378 +     *
   1.379 +     * @param month         The month in which this rule occurs (0-based).
   1.380 +     * @param dayOfMonth    The date in that month (1-based).
   1.381 +     * @param time          The time of that day (number of millis after midnight)
   1.382 +     *                      when DST takes effect in local wall time, which is
   1.383 +     *                      standard time in this case.
   1.384 +     * @param mode whether the time is local wall time, local standard time,
   1.385 +     * or UTC time. Default is local wall time.
   1.386 +     * @param status An UErrorCode
   1.387 +     * @stable ICU 2.0
   1.388 +     */
   1.389 +    void setStartRule(int32_t month, int32_t dayOfMonth, int32_t time,
   1.390 +                      TimeMode mode, UErrorCode& status);
   1.391 +
   1.392 +    /**
   1.393 +     * Sets the DST start rule to a weekday before or after a give date within
   1.394 +     * a month, e.g., the first Monday on or after the 8th.
   1.395 +     *
   1.396 +     * @param month         The month in which this rule occurs (0-based).
   1.397 +     * @param dayOfMonth    A date within that month (1-based).
   1.398 +     * @param dayOfWeek     The day of the week on which this rule occurs.
   1.399 +     * @param time          The time of that day (number of millis after midnight)
   1.400 +     *                      when DST takes effect in local wall time, which is
   1.401 +     *                      standard time in this case.
   1.402 +     * @param after         If true, this rule selects the first dayOfWeek on
   1.403 +     *                      or after dayOfMonth.  If false, this rule selects
   1.404 +     *                      the last dayOfWeek on or before dayOfMonth.
   1.405 +     * @param status An UErrorCode
   1.406 +     * @stable ICU 2.0
   1.407 +     */
   1.408 +    void setStartRule(int32_t month, int32_t dayOfMonth, int32_t dayOfWeek,
   1.409 +                      int32_t time, UBool after, UErrorCode& status);
   1.410 +    /**
   1.411 +     * Sets the DST start rule to a weekday before or after a give date within
   1.412 +     * a month, e.g., the first Monday on or after the 8th.
   1.413 +     *
   1.414 +     * @param month         The month in which this rule occurs (0-based).
   1.415 +     * @param dayOfMonth    A date within that month (1-based).
   1.416 +     * @param dayOfWeek     The day of the week on which this rule occurs.
   1.417 +     * @param time          The time of that day (number of millis after midnight)
   1.418 +     *                      when DST takes effect in local wall time, which is
   1.419 +     *                      standard time in this case.
   1.420 +     * @param mode whether the time is local wall time, local standard time,
   1.421 +     * or UTC time. Default is local wall time.
   1.422 +     * @param after         If true, this rule selects the first dayOfWeek on
   1.423 +     *                      or after dayOfMonth.  If false, this rule selects
   1.424 +     *                      the last dayOfWeek on or before dayOfMonth.
   1.425 +     * @param status An UErrorCode
   1.426 +     * @stable ICU 2.0
   1.427 +     */
   1.428 +    void setStartRule(int32_t month, int32_t dayOfMonth, int32_t dayOfWeek,
   1.429 +                      int32_t time, TimeMode mode, UBool after, UErrorCode& status);
   1.430 +
   1.431 +    /**
   1.432 +     * Sets the daylight savings ending rule. For example, if Daylight
   1.433 +     * Savings Time ends at the last (-1) Sunday in October, at 2 AM in standard time.
   1.434 +     * Therefore, you can set the end rule by calling:
   1.435 +     * <pre>
   1.436 +     *    setEndRule(UCAL_OCTOBER, -1, UCAL_SUNDAY, 2*60*60*1000);
   1.437 +     * </pre>
   1.438 +     * Various other types of rules can be specified by manipulating the dayOfWeek
   1.439 +     * and dayOfWeekInMonth parameters.  For complete details, see the documentation
   1.440 +     * for setStartRule().
   1.441 +     *
   1.442 +     * @param month the daylight savings ending month. Month is 0-based.
   1.443 +     * eg, 0 for January.
   1.444 +     * @param dayOfWeekInMonth the daylight savings ending
   1.445 +     * day-of-week-in-month. See setStartRule() for a complete explanation.
   1.446 +     * @param dayOfWeek the daylight savings ending day-of-week. See setStartRule()
   1.447 +     * for a complete explanation.
   1.448 +     * @param time the daylight savings ending time. Please see the member
   1.449 +     * description for an example.
   1.450 +     * @param status An UErrorCode
   1.451 +     * @stable ICU 2.0
   1.452 +     */
   1.453 +    void setEndRule(int32_t month, int32_t dayOfWeekInMonth, int32_t dayOfWeek,
   1.454 +                    int32_t time, UErrorCode& status);
   1.455 +
   1.456 +    /**
   1.457 +     * Sets the daylight savings ending rule. For example, if Daylight
   1.458 +     * Savings Time ends at the last (-1) Sunday in October, at 2 AM in standard time.
   1.459 +     * Therefore, you can set the end rule by calling:
   1.460 +     * <pre>
   1.461 +     *    setEndRule(UCAL_OCTOBER, -1, UCAL_SUNDAY, 2*60*60*1000);
   1.462 +     * </pre>
   1.463 +     * Various other types of rules can be specified by manipulating the dayOfWeek
   1.464 +     * and dayOfWeekInMonth parameters.  For complete details, see the documentation
   1.465 +     * for setStartRule().
   1.466 +     *
   1.467 +     * @param month the daylight savings ending month. Month is 0-based.
   1.468 +     * eg, 0 for January.
   1.469 +     * @param dayOfWeekInMonth the daylight savings ending
   1.470 +     * day-of-week-in-month. See setStartRule() for a complete explanation.
   1.471 +     * @param dayOfWeek the daylight savings ending day-of-week. See setStartRule()
   1.472 +     * for a complete explanation.
   1.473 +     * @param time the daylight savings ending time. Please see the member
   1.474 +     * description for an example.
   1.475 +     * @param mode whether the time is local wall time, local standard time,
   1.476 +     * or UTC time. Default is local wall time.
   1.477 +     * @param status An UErrorCode
   1.478 +     * @stable ICU 2.0
   1.479 +     */
   1.480 +    void setEndRule(int32_t month, int32_t dayOfWeekInMonth, int32_t dayOfWeek,
   1.481 +                    int32_t time, TimeMode mode, UErrorCode& status);
   1.482 +
   1.483 +    /**
   1.484 +     * Sets the DST end rule to a fixed date within a month.
   1.485 +     *
   1.486 +     * @param month         The month in which this rule occurs (0-based).
   1.487 +     * @param dayOfMonth    The date in that month (1-based).
   1.488 +     * @param time          The time of that day (number of millis after midnight)
   1.489 +     *                      when DST ends in local wall time, which is daylight
   1.490 +     *                      time in this case.
   1.491 +     * @param status An UErrorCode
   1.492 +     * @stable ICU 2.0
   1.493 +     */
   1.494 +    void setEndRule(int32_t month, int32_t dayOfMonth, int32_t time, UErrorCode& status);
   1.495 +
   1.496 +    /**
   1.497 +     * Sets the DST end rule to a fixed date within a month.
   1.498 +     *
   1.499 +     * @param month         The month in which this rule occurs (0-based).
   1.500 +     * @param dayOfMonth    The date in that month (1-based).
   1.501 +     * @param time          The time of that day (number of millis after midnight)
   1.502 +     *                      when DST ends in local wall time, which is daylight
   1.503 +     *                      time in this case.
   1.504 +     * @param mode whether the time is local wall time, local standard time,
   1.505 +     * or UTC time. Default is local wall time.
   1.506 +     * @param status An UErrorCode
   1.507 +     * @stable ICU 2.0
   1.508 +     */
   1.509 +    void setEndRule(int32_t month, int32_t dayOfMonth, int32_t time,
   1.510 +                    TimeMode mode, UErrorCode& status);
   1.511 +
   1.512 +    /**
   1.513 +     * Sets the DST end rule to a weekday before or after a give date within
   1.514 +     * a month, e.g., the first Monday on or after the 8th.
   1.515 +     *
   1.516 +     * @param month         The month in which this rule occurs (0-based).
   1.517 +     * @param dayOfMonth    A date within that month (1-based).
   1.518 +     * @param dayOfWeek     The day of the week on which this rule occurs.
   1.519 +     * @param time          The time of that day (number of millis after midnight)
   1.520 +     *                      when DST ends in local wall time, which is daylight
   1.521 +     *                      time in this case.
   1.522 +     * @param after         If true, this rule selects the first dayOfWeek on
   1.523 +     *                      or after dayOfMonth.  If false, this rule selects
   1.524 +     *                      the last dayOfWeek on or before dayOfMonth.
   1.525 +     * @param status An UErrorCode
   1.526 +     * @stable ICU 2.0
   1.527 +     */
   1.528 +    void setEndRule(int32_t month, int32_t dayOfMonth, int32_t dayOfWeek,
   1.529 +                    int32_t time, UBool after, UErrorCode& status);
   1.530 +
   1.531 +    /**
   1.532 +     * Sets the DST end rule to a weekday before or after a give date within
   1.533 +     * a month, e.g., the first Monday on or after the 8th.
   1.534 +     *
   1.535 +     * @param month         The month in which this rule occurs (0-based).
   1.536 +     * @param dayOfMonth    A date within that month (1-based).
   1.537 +     * @param dayOfWeek     The day of the week on which this rule occurs.
   1.538 +     * @param time          The time of that day (number of millis after midnight)
   1.539 +     *                      when DST ends in local wall time, which is daylight
   1.540 +     *                      time in this case.
   1.541 +     * @param mode whether the time is local wall time, local standard time,
   1.542 +     * or UTC time. Default is local wall time.
   1.543 +     * @param after         If true, this rule selects the first dayOfWeek on
   1.544 +     *                      or after dayOfMonth.  If false, this rule selects
   1.545 +     *                      the last dayOfWeek on or before dayOfMonth.
   1.546 +     * @param status An UErrorCode
   1.547 +     * @stable ICU 2.0
   1.548 +     */
   1.549 +    void setEndRule(int32_t month, int32_t dayOfMonth, int32_t dayOfWeek,
   1.550 +                    int32_t time, TimeMode mode, UBool after, UErrorCode& status);
   1.551 +
   1.552 +    /**
   1.553 +     * Returns the TimeZone's adjusted GMT offset (i.e., the number of milliseconds to add
   1.554 +     * to GMT to get local time in this time zone, taking daylight savings time into
   1.555 +     * account) as of a particular reference date.  The reference date is used to determine
   1.556 +     * whether daylight savings time is in effect and needs to be figured into the offset
   1.557 +     * that is returned (in other words, what is the adjusted GMT offset in this time zone
   1.558 +     * at this particular date and time?).  For the time zones produced by createTimeZone(),
   1.559 +     * the reference data is specified according to the Gregorian calendar, and the date
   1.560 +     * and time fields are in GMT, NOT local time.
   1.561 +     *
   1.562 +     * @param era        The reference date's era
   1.563 +     * @param year       The reference date's year
   1.564 +     * @param month      The reference date's month (0-based; 0 is January)
   1.565 +     * @param day        The reference date's day-in-month (1-based)
   1.566 +     * @param dayOfWeek  The reference date's day-of-week (1-based; 1 is Sunday)
   1.567 +     * @param millis     The reference date's milliseconds in day, UTT (NOT local time).
   1.568 +     * @param status     An UErrorCode to receive the status.
   1.569 +     * @return           The offset in milliseconds to add to GMT to get local time.
   1.570 +     * @stable ICU 2.0
   1.571 +     */
   1.572 +    virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day,
   1.573 +                              uint8_t dayOfWeek, int32_t millis, UErrorCode& status) const;
   1.574 +
   1.575 +    /**
   1.576 +     * Gets the time zone offset, for current date, modified in case of
   1.577 +     * daylight savings. This is the offset to add *to* UTC to get local time.
   1.578 +     * @param era the era of the given date.
   1.579 +     * @param year the year in the given date.
   1.580 +     * @param month the month in the given date.
   1.581 +     * Month is 0-based. e.g., 0 for January.
   1.582 +     * @param day the day-in-month of the given date.
   1.583 +     * @param dayOfWeek the day-of-week of the given date.
   1.584 +     * @param milliseconds the millis in day in <em>standard</em> local time.
   1.585 +     * @param monthLength the length of the given month in days.
   1.586 +     * @param status     An UErrorCode to receive the status.
   1.587 +     * @return the offset to add *to* GMT to get local time.
   1.588 +     * @stable ICU 2.0
   1.589 +     */
   1.590 +    virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day,
   1.591 +                           uint8_t dayOfWeek, int32_t milliseconds,
   1.592 +                           int32_t monthLength, UErrorCode& status) const;
   1.593 +    /**
   1.594 +     * Gets the time zone offset, for current date, modified in case of
   1.595 +     * daylight savings. This is the offset to add *to* UTC to get local time.
   1.596 +     * @param era the era of the given date.
   1.597 +     * @param year the year in the given date.
   1.598 +     * @param month the month in the given date.
   1.599 +     * Month is 0-based. e.g., 0 for January.
   1.600 +     * @param day the day-in-month of the given date.
   1.601 +     * @param dayOfWeek the day-of-week of the given date.
   1.602 +     * @param milliseconds the millis in day in <em>standard</em> local time.
   1.603 +     * @param monthLength the length of the given month in days.
   1.604 +     * @param prevMonthLength length of the previous month in days.
   1.605 +     * @param status     An UErrorCode to receive the status.
   1.606 +     * @return the offset to add *to* GMT to get local time.
   1.607 +     * @stable ICU 2.0
   1.608 +     */
   1.609 +    virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day,
   1.610 +                              uint8_t dayOfWeek, int32_t milliseconds,
   1.611 +                              int32_t monthLength, int32_t prevMonthLength,
   1.612 +                              UErrorCode& status) const;
   1.613 +
   1.614 +    /**
   1.615 +     * Redeclared TimeZone method.  This implementation simply calls
   1.616 +     * the base class method, which otherwise would be hidden.
   1.617 +     * @stable ICU 2.8
   1.618 +     */
   1.619 +    virtual void getOffset(UDate date, UBool local, int32_t& rawOffset,
   1.620 +                           int32_t& dstOffset, UErrorCode& ec) const;
   1.621 +
   1.622 +    /**
   1.623 +     * Get time zone offsets from local wall time.
   1.624 +     * @internal
   1.625 +     */
   1.626 +    virtual void getOffsetFromLocal(UDate date, int32_t nonExistingTimeOpt, int32_t duplicatedTimeOpt,
   1.627 +        int32_t& rawOffset, int32_t& dstOffset, UErrorCode& status) const;
   1.628 +
   1.629 +    /**
   1.630 +     * Returns the TimeZone's raw GMT offset (i.e., the number of milliseconds to add
   1.631 +     * to GMT to get local time, before taking daylight savings time into account).
   1.632 +     *
   1.633 +     * @return   The TimeZone's raw GMT offset.
   1.634 +     * @stable ICU 2.0
   1.635 +     */
   1.636 +    virtual int32_t getRawOffset(void) const;
   1.637 +
   1.638 +    /**
   1.639 +     * Sets the TimeZone's raw GMT offset (i.e., the number of milliseconds to add
   1.640 +     * to GMT to get local time, before taking daylight savings time into account).
   1.641 +     *
   1.642 +     * @param offsetMillis  The new raw GMT offset for this time zone.
   1.643 +     * @stable ICU 2.0
   1.644 +     */
   1.645 +    virtual void setRawOffset(int32_t offsetMillis);
   1.646 +
   1.647 +    /**
   1.648 +     * Sets the amount of time in ms that the clock is advanced during DST.
   1.649 +     * @param millisSavedDuringDST the number of milliseconds the time is
   1.650 +     * advanced with respect to standard time when the daylight savings rules
   1.651 +     * are in effect. A positive number, typically one hour (3600000).
   1.652 +     * @param status  An UErrorCode to receive the status.
   1.653 +     * @stable ICU 2.0
   1.654 +     */
   1.655 +    void setDSTSavings(int32_t millisSavedDuringDST, UErrorCode& status);
   1.656 +
   1.657 +    /**
   1.658 +     * Returns the amount of time in ms that the clock is advanced during DST.
   1.659 +     * @return the number of milliseconds the time is
   1.660 +     * advanced with respect to standard time when the daylight savings rules
   1.661 +     * are in effect. A positive number, typically one hour (3600000).
   1.662 +     * @stable ICU 2.0
   1.663 +     */
   1.664 +    virtual int32_t getDSTSavings(void) const;
   1.665 +
   1.666 +    /**
   1.667 +     * Queries if this TimeZone uses Daylight Savings Time.
   1.668 +     *
   1.669 +     * @return   True if this TimeZone uses Daylight Savings Time; false otherwise.
   1.670 +     * @stable ICU 2.0
   1.671 +     */
   1.672 +    virtual UBool useDaylightTime(void) const;
   1.673 +
   1.674 +    /**
   1.675 +     * Returns true if the given date is within the period when daylight savings time
   1.676 +     * is in effect; false otherwise.  If the TimeZone doesn't observe daylight savings
   1.677 +     * time, this functions always returns false.
   1.678 +     * This method is wasteful since it creates a new GregorianCalendar and
   1.679 +     * deletes it each time it is called. This is a deprecated method
   1.680 +     * and provided only for Java compatibility.
   1.681 +     *
   1.682 +     * @param date The date to test.
   1.683 +     * @param status  An UErrorCode to receive the status.
   1.684 +     * @return true if the given date is in Daylight Savings Time;
   1.685 +     * false otherwise.
   1.686 +     * @deprecated ICU 2.4. Use Calendar::inDaylightTime() instead.
   1.687 +     */
   1.688 +    virtual UBool inDaylightTime(UDate date, UErrorCode& status) const;
   1.689 +
   1.690 +    /**
   1.691 +     * Return true if this zone has the same rules and offset as another zone.
   1.692 +     * @param other the TimeZone object to be compared with
   1.693 +     * @return true if the given zone has the same rules and offset as this one
   1.694 +     * @stable ICU 2.0
   1.695 +     */
   1.696 +    UBool hasSameRules(const TimeZone& other) const;
   1.697 +
   1.698 +    /**
   1.699 +     * Clones TimeZone objects polymorphically. Clients are responsible for deleting
   1.700 +     * the TimeZone object cloned.
   1.701 +     *
   1.702 +     * @return   A new copy of this TimeZone object.
   1.703 +     * @stable ICU 2.0
   1.704 +     */
   1.705 +    virtual TimeZone* clone(void) const;
   1.706 +
   1.707 +    /**
   1.708 +     * Gets the first time zone transition after the base time.
   1.709 +     * @param base      The base time.
   1.710 +     * @param inclusive Whether the base time is inclusive or not.
   1.711 +     * @param result    Receives the first transition after the base time.
   1.712 +     * @return  TRUE if the transition is found.
   1.713 +     * @stable ICU 3.8
   1.714 +     */
   1.715 +    virtual UBool getNextTransition(UDate base, UBool inclusive, TimeZoneTransition& result) const;
   1.716 +
   1.717 +    /**
   1.718 +     * Gets the most recent time zone transition before the base time.
   1.719 +     * @param base      The base time.
   1.720 +     * @param inclusive Whether the base time is inclusive or not.
   1.721 +     * @param result    Receives the most recent transition before the base time.
   1.722 +     * @return  TRUE if the transition is found.
   1.723 +     * @stable ICU 3.8
   1.724 +     */
   1.725 +    virtual UBool getPreviousTransition(UDate base, UBool inclusive, TimeZoneTransition& result) const;
   1.726 +
   1.727 +    /**
   1.728 +     * Returns the number of <code>TimeZoneRule</code>s which represents time transitions,
   1.729 +     * for this time zone, that is, all <code>TimeZoneRule</code>s for this time zone except
   1.730 +     * <code>InitialTimeZoneRule</code>.  The return value range is 0 or any positive value.
   1.731 +     * @param status    Receives error status code.
   1.732 +     * @return The number of <code>TimeZoneRule</code>s representing time transitions.
   1.733 +     * @stable ICU 3.8
   1.734 +     */
   1.735 +    virtual int32_t countTransitionRules(UErrorCode& status) const;
   1.736 +
   1.737 +    /**
   1.738 +     * Gets the <code>InitialTimeZoneRule</code> and the set of <code>TimeZoneRule</code>
   1.739 +     * which represent time transitions for this time zone.  On successful return,
   1.740 +     * the argument initial points to non-NULL <code>InitialTimeZoneRule</code> and
   1.741 +     * the array trsrules is filled with 0 or multiple <code>TimeZoneRule</code>
   1.742 +     * instances up to the size specified by trscount.  The results are referencing the
   1.743 +     * rule instance held by this time zone instance.  Therefore, after this time zone
   1.744 +     * is destructed, they are no longer available.
   1.745 +     * @param initial       Receives the initial timezone rule
   1.746 +     * @param trsrules      Receives the timezone transition rules
   1.747 +     * @param trscount      On input, specify the size of the array 'transitions' receiving
   1.748 +     *                      the timezone transition rules.  On output, actual number of
   1.749 +     *                      rules filled in the array will be set.
   1.750 +     * @param status        Receives error status code.
   1.751 +     * @stable ICU 3.8
   1.752 +     */
   1.753 +    virtual void getTimeZoneRules(const InitialTimeZoneRule*& initial,
   1.754 +        const TimeZoneRule* trsrules[], int32_t& trscount, UErrorCode& status) const;
   1.755 +
   1.756 +
   1.757 +public:
   1.758 +
   1.759 +    /**
   1.760 +     * Override TimeZone Returns a unique class ID POLYMORPHICALLY. Pure virtual
   1.761 +     * override. This method is to implement a simple version of RTTI, since not all C++
   1.762 +     * compilers support genuine RTTI. Polymorphic operator==() and clone() methods call
   1.763 +     * this method.
   1.764 +     *
   1.765 +     * @return   The class ID for this object. All objects of a given class have the
   1.766 +     *           same class ID. Objects of other classes have different class IDs.
   1.767 +     * @stable ICU 2.0
   1.768 +     */
   1.769 +    virtual UClassID getDynamicClassID(void) const;
   1.770 +
   1.771 +    /**
   1.772 +     * Return the class ID for this class. This is useful only for comparing to a return
   1.773 +     * value from getDynamicClassID(). For example:
   1.774 +     * <pre>
   1.775 +     * .   Base* polymorphic_pointer = createPolymorphicObject();
   1.776 +     * .   if (polymorphic_pointer->getDynamicClassID() ==
   1.777 +     * .       Derived::getStaticClassID()) ...
   1.778 +     * </pre>
   1.779 +     * @return   The class ID for all objects of this class.
   1.780 +     * @stable ICU 2.0
   1.781 +     */
   1.782 +    static UClassID U_EXPORT2 getStaticClassID(void);
   1.783 +
   1.784 +private:
   1.785 +    /**
   1.786 +     * Constants specifying values of startMode and endMode.
   1.787 +     */
   1.788 +    enum EMode
   1.789 +    {
   1.790 +        DOM_MODE = 1,
   1.791 +        DOW_IN_MONTH_MODE,
   1.792 +        DOW_GE_DOM_MODE,
   1.793 +        DOW_LE_DOM_MODE
   1.794 +    };
   1.795 +
   1.796 +    SimpleTimeZone(); // default constructor not implemented
   1.797 +
   1.798 +    /**
   1.799 +     * Internal construction method.
   1.800 +     * @param rawOffsetGMT    The new SimpleTimeZone's raw GMT offset
   1.801 +     * @param startMonth      the month DST starts
   1.802 +     * @param startDay        the day DST starts
   1.803 +     * @param startDayOfWeek  the DOW DST starts
   1.804 +     * @param startTime       the time DST starts
   1.805 +     * @param startTimeMode   Whether the start time is local wall time, local
   1.806 +     *                        standard time, or UTC time. Default is local wall time.
   1.807 +     * @param endMonth        the month DST ends
   1.808 +     * @param endDay          the day DST ends
   1.809 +     * @param endDayOfWeek    the DOW DST ends
   1.810 +     * @param endTime         the time DST ends
   1.811 +     * @param endTimeMode     Whether the end time is local wall time, local
   1.812 +     *                        standard time, or UTC time. Default is local wall time.
   1.813 +     * @param dstSavings      The number of milliseconds added to standard time
   1.814 +     *                        to get DST time. Default is one hour.
   1.815 +     * @param status          An UErrorCode to receive the status.
   1.816 +     */
   1.817 +    void construct(int32_t rawOffsetGMT,
   1.818 +                   int8_t startMonth, int8_t startDay, int8_t startDayOfWeek,
   1.819 +                   int32_t startTime, TimeMode startTimeMode,
   1.820 +                   int8_t endMonth, int8_t endDay, int8_t endDayOfWeek,
   1.821 +                   int32_t endTime, TimeMode endTimeMode,
   1.822 +                   int32_t dstSavings, UErrorCode& status);
   1.823 +
   1.824 +    /**
   1.825 +     * Compare a given date in the year to a rule. Return 1, 0, or -1, depending
   1.826 +     * on whether the date is after, equal to, or before the rule date. The
   1.827 +     * millis are compared directly against the ruleMillis, so any
   1.828 +     * standard-daylight adjustments must be handled by the caller.
   1.829 +     *
   1.830 +     * @return  1 if the date is after the rule date, -1 if the date is before
   1.831 +     *          the rule date, or 0 if the date is equal to the rule date.
   1.832 +     */
   1.833 +    static int32_t compareToRule(int8_t month, int8_t monthLen, int8_t prevMonthLen,
   1.834 +                                 int8_t dayOfMonth,
   1.835 +                                 int8_t dayOfWeek, int32_t millis, int32_t millisDelta,
   1.836 +                                 EMode ruleMode, int8_t ruleMonth, int8_t ruleDayOfWeek,
   1.837 +                                 int8_t ruleDay, int32_t ruleMillis);
   1.838 +
   1.839 +    /**
   1.840 +     * Given a set of encoded rules in startDay and startDayOfMonth, decode
   1.841 +     * them and set the startMode appropriately.  Do the same for endDay and
   1.842 +     * endDayOfMonth.
   1.843 +     * <P>
   1.844 +     * Upon entry, the day of week variables may be zero or
   1.845 +     * negative, in order to indicate special modes.  The day of month
   1.846 +     * variables may also be negative.
   1.847 +     * <P>
   1.848 +     * Upon exit, the mode variables will be
   1.849 +     * set, and the day of week and day of month variables will be positive.
   1.850 +     * <P>
   1.851 +     * This method also recognizes a startDay or endDay of zero as indicating
   1.852 +     * no DST.
   1.853 +     */
   1.854 +    void decodeRules(UErrorCode& status);
   1.855 +    void decodeStartRule(UErrorCode& status);
   1.856 +    void decodeEndRule(UErrorCode& status);
   1.857 +
   1.858 +    int8_t startMonth, startDay, startDayOfWeek;   // the month, day, DOW, and time DST starts
   1.859 +    int32_t startTime;
   1.860 +    TimeMode startTimeMode, endTimeMode; // Mode for startTime, endTime; see TimeMode
   1.861 +    int8_t endMonth, endDay, endDayOfWeek; // the month, day, DOW, and time DST ends
   1.862 +    int32_t endTime;
   1.863 +    int32_t startYear;  // the year these DST rules took effect
   1.864 +    int32_t rawOffset;  // the TimeZone's raw GMT offset
   1.865 +    UBool useDaylight; // flag indicating whether this TimeZone uses DST
   1.866 +    static const int8_t STATICMONTHLENGTH[12]; // lengths of the months
   1.867 +    EMode startMode, endMode;   // flags indicating what kind of rules the DST rules are
   1.868 +
   1.869 +    /**
   1.870 +     * A positive value indicating the amount of time saved during DST in ms.
   1.871 +     * Typically one hour; sometimes 30 minutes.
   1.872 +     */
   1.873 +    int32_t dstSavings;
   1.874 +
   1.875 +    /* Private for BasicTimeZone implementation */
   1.876 +    void checkTransitionRules(UErrorCode& status) const;
   1.877 +    void initTransitionRules(UErrorCode& status);
   1.878 +    void clearTransitionRules(void);
   1.879 +    void deleteTransitionRules(void);
   1.880 +    UBool   transitionRulesInitialized;
   1.881 +    InitialTimeZoneRule*    initialRule;
   1.882 +    TimeZoneTransition*     firstTransition;
   1.883 +    AnnualTimeZoneRule*     stdRule;
   1.884 +    AnnualTimeZoneRule*     dstRule;
   1.885 +};
   1.886 +
   1.887 +inline void SimpleTimeZone::setStartRule(int32_t month, int32_t dayOfWeekInMonth,
   1.888 +                                         int32_t dayOfWeek,
   1.889 +                                         int32_t time, UErrorCode& status) {
   1.890 +    setStartRule(month, dayOfWeekInMonth, dayOfWeek, time, WALL_TIME, status);
   1.891 +}
   1.892 +
   1.893 +inline void SimpleTimeZone::setStartRule(int32_t month, int32_t dayOfMonth,
   1.894 +                                         int32_t time,
   1.895 +                                         UErrorCode& status) {
   1.896 +    setStartRule(month, dayOfMonth, time, WALL_TIME, status);
   1.897 +}
   1.898 +
   1.899 +inline void SimpleTimeZone::setStartRule(int32_t month, int32_t dayOfMonth,
   1.900 +                                         int32_t dayOfWeek,
   1.901 +                                         int32_t time, UBool after, UErrorCode& status) {
   1.902 +    setStartRule(month, dayOfMonth, dayOfWeek, time, WALL_TIME, after, status);
   1.903 +}
   1.904 +
   1.905 +inline void SimpleTimeZone::setEndRule(int32_t month, int32_t dayOfWeekInMonth,
   1.906 +                                       int32_t dayOfWeek,
   1.907 +                                       int32_t time, UErrorCode& status) {
   1.908 +    setEndRule(month, dayOfWeekInMonth, dayOfWeek, time, WALL_TIME, status);
   1.909 +}
   1.910 +
   1.911 +inline void SimpleTimeZone::setEndRule(int32_t month, int32_t dayOfMonth,
   1.912 +                                       int32_t time, UErrorCode& status) {
   1.913 +    setEndRule(month, dayOfMonth, time, WALL_TIME, status);
   1.914 +}
   1.915 +
   1.916 +inline void SimpleTimeZone::setEndRule(int32_t month, int32_t dayOfMonth, int32_t dayOfWeek,
   1.917 +                                       int32_t time, UBool after, UErrorCode& status) {
   1.918 +    setEndRule(month, dayOfMonth, dayOfWeek, time, WALL_TIME, after, status);
   1.919 +}
   1.920 +
   1.921 +inline void
   1.922 +SimpleTimeZone::getOffset(UDate date, UBool local, int32_t& rawOffsetRef,
   1.923 +                          int32_t& dstOffsetRef, UErrorCode& ec) const {
   1.924 +    TimeZone::getOffset(date, local, rawOffsetRef, dstOffsetRef, ec);
   1.925 +}
   1.926 +
   1.927 +U_NAMESPACE_END
   1.928 +
   1.929 +#endif /* #if !UCONFIG_NO_FORMATTING */
   1.930 +
   1.931 +#endif // _SIMPLETZ

mercurial