1ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/*
2ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru*******************************************************************************
385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho* Copyright (C) 2007-2008, International Business Machines Corporation and    *
4ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* others. All Rights Reserved.                                                *
5ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru*******************************************************************************
6ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru*/
7ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#ifndef TZRULE_H
8ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#define TZRULE_H
9ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
10ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/**
11ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * \file
12ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * \brief C++ API: Time zone rule classes
13ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */
14ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
15ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "unicode/utypes.h"
16ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
17ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#if !UCONFIG_NO_FORMATTING
18ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
19ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "unicode/uobject.h"
20ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "unicode/unistr.h"
21ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "unicode/dtrule.h"
22ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
23ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_NAMESPACE_BEGIN
24ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
25ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/**
26ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <code>TimeZoneRule</code> is a class representing a rule for time zone.
27ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <code>TimeZoneRule</code> has a set of time zone attributes, such as zone name,
28ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * raw offset (UTC offset for standard time) and daylight saving time offset.
29ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
3085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * @stable ICU 3.8
31ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */
32ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruclass U_I18N_API TimeZoneRule : public UObject {
33ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querupublic:
34ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
35ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Destructor.
3685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
37ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
38ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual ~TimeZoneRule();
39ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
40ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
41ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Clone this TimeZoneRule object polymorphically. The caller owns the result and
42ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * should delete it when done.
43ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  A copy of the object.
4485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
45ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
46ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual TimeZoneRule* clone(void) const = 0;
47ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
48ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
49ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Return true if the given <code>TimeZoneRule</code> objects are semantically equal. Objects
50ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * of different subclasses are considered unequal.
51ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param that  The object to be compared with.
52ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if the given <code>TimeZoneRule</code> objects are semantically equal.
5385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
54ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
55ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UBool operator==(const TimeZoneRule& that) const;
56ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
57ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
58ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Return true if the given <code>TimeZoneRule</code> objects are semantically unequal. Objects
59ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * of different subclasses are considered unequal.
60ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param that  The object to be compared with.
61ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if the given <code>TimeZoneRule</code> objects are semantically unequal.
6285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
63ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
64ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UBool operator!=(const TimeZoneRule& that) const;
65ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
66ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
67ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Fills in "name" with the name of this time zone.
68ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param name  Receives the name of this time zone.
69ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  A reference to "name"
7085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
71ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
72ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UnicodeString& getName(UnicodeString& name) const;
73ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
74ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
75ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Gets the standard time offset.
76ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  The standard time offset from UTC in milliseconds.
7785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
78ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
79ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    int32_t getRawOffset(void) const;
80ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
81ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
82ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Gets the amount of daylight saving delta time from the standard time.
83ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  The amount of daylight saving offset used by this rule
84ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *          in milliseconds.
8585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
86ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
87ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    int32_t getDSTSavings(void) const;
88ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
89ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
90ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Returns if this rule represents the same rule and offsets as another.
91ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * When two <code>TimeZoneRule</code> objects differ only its names, this method
92ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * returns true.
93ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param other The <code>TimeZoneRule</code> object to be compared with.
94ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if the other <code>TimeZoneRule</code> is the same as this one.
9585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
96ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
97ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UBool isEquivalentTo(const TimeZoneRule& other) const;
98ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
99ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
100ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Gets the very first time when this rule takes effect.
101ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevRawOffset     The standard time offset from UTC before this rule
102ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          takes effect in milliseconds.
103ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevDSTSavings    The amount of daylight saving offset from the
104ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          standard time.
105ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param result            Receives the very first time when this rule takes effect.
106ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if the start time is available.  When false is returned, output parameter
107ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *          "result" is unchanged.
10885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
109ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
110ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UBool getFirstStart(int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const = 0;
111ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
112ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
113ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Gets the final time when this rule takes effect.
114ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevRawOffset     The standard time offset from UTC before this rule
115ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          takes effect in milliseconds.
116ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevDSTSavings    The amount of daylight saving offset from the
117ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          standard time.
118ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param result            Receives the final time when this rule takes effect.
119ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if the start time is available.  When false is returned, output parameter
120ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *          "result" is unchanged.
12185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
122ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
123ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UBool getFinalStart(int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const = 0;
124ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
125ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
126ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Gets the first time when this rule takes effect after the specified time.
127ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param base              The first start time after this base time will be returned.
128ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevRawOffset     The standard time offset from UTC before this rule
129ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          takes effect in milliseconds.
130ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevDSTSavings    The amount of daylight saving offset from the
131ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          standard time.
132ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param inclusive         Whether the base time is inclusive or not.
133ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param result            Receives The first time when this rule takes effect after
134ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          the specified base time.
135ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if the start time is available.  When false is returned, output parameter
136ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *          "result" is unchanged.
13785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
138ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
139ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UBool getNextStart(UDate base, int32_t prevRawOffset, int32_t prevDSTSavings,
140ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru        UBool inclusive, UDate& result) const = 0;
141ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
142ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
143ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Gets the most recent time when this rule takes effect before the specified time.
144ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param base              The most recent time before this base time will be returned.
145ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevRawOffset     The standard time offset from UTC before this rule
146ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          takes effect in milliseconds.
147ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevDSTSavings    The amount of daylight saving offset from the
148ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          standard time.
149ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param inclusive         Whether the base time is inclusive or not.
150ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param result            Receives The most recent time when this rule takes effect before
151ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          the specified base time.
152ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if the start time is available.  When false is returned, output parameter
153ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *          "result" is unchanged.
15485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
155ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
156ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UBool getPreviousStart(UDate base, int32_t prevRawOffset, int32_t prevDSTSavings,
157ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru        UBool inclusive, UDate& result) const = 0;
158ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
159ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruprotected:
160ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
161ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
162ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Constructs a <code>TimeZoneRule</code> with the name, the GMT offset of its
163ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * standard time and the amount of daylight saving offset adjustment.
164ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param name          The time zone name.
165ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param rawOffset     The UTC offset of its standard time in milliseconds.
166ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param dstSavings    The amount of daylight saving offset adjustment in milliseconds.
167ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                      If this ia a rule for standard time, the value of this argument is 0.
16885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
169ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
170ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    TimeZoneRule(const UnicodeString& name, int32_t rawOffset, int32_t dstSavings);
171ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
172ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
173ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Copy constructor.
174ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param source    The TimeZoneRule object to be copied.
17585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
176ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
177ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    TimeZoneRule(const TimeZoneRule& source);
178ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
179ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
180ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Assignment operator.
181ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param right The object to be copied.
18285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
183ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
184ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    TimeZoneRule& operator=(const TimeZoneRule& right);
185ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
186ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruprivate:
187ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UnicodeString fName; // time name
188ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    int32_t fRawOffset;  // UTC offset of the standard time in milliseconds
189ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    int32_t fDSTSavings; // DST saving amount in milliseconds
190ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru};
191ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
192ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/**
193ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <code>InitialTimeZoneRule</code> represents a time zone rule
194ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * representing a time zone effective from the beginning and
195ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * has no actual start times.
19685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * @stable ICU 3.8
197ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */
198ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruclass U_I18N_API InitialTimeZoneRule : public TimeZoneRule {
199ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querupublic:
200ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
201ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Constructs an <code>InitialTimeZoneRule</code> with the name, the GMT offset of its
202ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * standard time and the amount of daylight saving offset adjustment.
203ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param name          The time zone name.
204ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param rawOffset     The UTC offset of its standard time in milliseconds.
205ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param dstSavings    The amount of daylight saving offset adjustment in milliseconds.
206ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                      If this ia a rule for standard time, the value of this argument is 0.
20785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
208ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
209ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    InitialTimeZoneRule(const UnicodeString& name, int32_t rawOffset, int32_t dstSavings);
210ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
211ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
212ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Copy constructor.
213ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param source    The InitialTimeZoneRule object to be copied.
21485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
215ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
216ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    InitialTimeZoneRule(const InitialTimeZoneRule& source);
217ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
218ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
219ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Destructor.
22085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
221ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
222ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual ~InitialTimeZoneRule();
223ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
224ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
225ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Clone this InitialTimeZoneRule object polymorphically. The caller owns the result and
226ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * should delete it when done.
227ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return    A copy of the object.
22885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
229ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
230ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual InitialTimeZoneRule* clone(void) const;
231ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
232ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
233ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Assignment operator.
234ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param right The object to be copied.
23585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
236ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
237ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    InitialTimeZoneRule& operator=(const InitialTimeZoneRule& right);
238ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
239ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
240ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Return true if the given <code>TimeZoneRule</code> objects are semantically equal. Objects
241ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * of different subclasses are considered unequal.
242ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param that  The object to be compared with.
243ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if the given <code>TimeZoneRule</code> objects are semantically equal.
24485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
245ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
246ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UBool operator==(const TimeZoneRule& that) const;
247ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
248ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
249ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Return true if the given <code>TimeZoneRule</code> objects are semantically unequal. Objects
250ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * of different subclasses are considered unequal.
251ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param that  The object to be compared with.
252ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if the given <code>TimeZoneRule</code> objects are semantically unequal.
25385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
254ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
255ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UBool operator!=(const TimeZoneRule& that) const;
256ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
257ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
258ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Gets the time when this rule takes effect in the given year.
259ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param year              The Gregorian year, with 0 == 1 BCE, -1 == 2 BCE, etc.
260ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevRawOffset     The standard time offset from UTC before this rule
261ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          takes effect in milliseconds.
262ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevDSTSavings    The amount of daylight saving offset from the
263ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          standard time.
264ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param result            Receives the start time in the year.
265ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if this rule takes effect in the year and the result is set to
266ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *          "result".
26785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
268ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
269ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UBool getStartInYear(int32_t year, int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const;
270ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
271ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
272ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Returns if this rule represents the same rule and offsets as another.
273ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * When two <code>TimeZoneRule</code> objects differ only its names, this method
274ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * returns true.
275ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param that  The <code>TimeZoneRule</code> object to be compared with.
276ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if the other <code>TimeZoneRule</code> is equivalent to this one.
27785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
278ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
279ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UBool isEquivalentTo(const TimeZoneRule& that) const;
280ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
281ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
282ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Gets the very first time when this rule takes effect.
283ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevRawOffset     The standard time offset from UTC before this rule
284ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          takes effect in milliseconds.
285ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevDSTSavings    The amount of daylight saving offset from the
286ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          standard time.
287ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param result            Receives the very first time when this rule takes effect.
288ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if the start time is available.  When false is returned, output parameter
289ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *          "result" is unchanged.
29085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
291ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
292ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UBool getFirstStart(int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const;
293ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
294ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
295ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Gets the final time when this rule takes effect.
296ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevRawOffset     The standard time offset from UTC before this rule
297ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          takes effect in milliseconds.
298ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevDSTSavings    The amount of daylight saving offset from the
299ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          standard time.
300ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param result            Receives the final time when this rule takes effect.
301ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if the start time is available.  When false is returned, output parameter
302ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *          "result" is unchanged.
30385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
304ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
305ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UBool getFinalStart(int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const;
306ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
307ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
308ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Gets the first time when this rule takes effect after the specified time.
309ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param base              The first start time after this base time will be returned.
310ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevRawOffset     The standard time offset from UTC before this rule
311ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          takes effect in milliseconds.
312ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevDSTSavings    The amount of daylight saving offset from the
313ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          standard time.
314ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param inclusive         Whether the base time is inclusive or not.
315ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param result            Receives The first time when this rule takes effect after
316ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          the specified base time.
317ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if the start time is available.  When false is returned, output parameter
318ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *          "result" is unchanged.
31985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
320ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
321ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UBool getNextStart(UDate base, int32_t prevRawOffset, int32_t prevDSTSavings,
322ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru        UBool inclusive, UDate& result) const;
323ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
324ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
325ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Gets the most recent time when this rule takes effect before the specified time.
326ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param base              The most recent time before this base time will be returned.
327ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevRawOffset     The standard time offset from UTC before this rule
328ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          takes effect in milliseconds.
329ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevDSTSavings    The amount of daylight saving offset from the
330ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          standard time.
331ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param inclusive         Whether the base time is inclusive or not.
332ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param result            Receives The most recent time when this rule takes effect before
333ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          the specified base time.
334ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if the start time is available.  When false is returned, output parameter
335ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *          "result" is unchanged.
33685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
337ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
338ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UBool getPreviousStart(UDate base, int32_t prevRawOffset, int32_t prevDSTSavings,
339ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru        UBool inclusive, UDate& result) const;
340ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
341ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querupublic:
342ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
343ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Return the class ID for this class. This is useful only for comparing to
344ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * a return value from getDynamicClassID(). For example:
345ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * <pre>
346ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * .   Base* polymorphic_pointer = createPolymorphicObject();
347ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * .   if (polymorphic_pointer->getDynamicClassID() ==
348ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * .       erived::getStaticClassID()) ...
349ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * </pre>
350ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return          The class ID for all objects of this class.
35185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
352ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
353ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    static UClassID U_EXPORT2 getStaticClassID(void);
354ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
355ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
356ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This
357ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * method is to implement a simple version of RTTI, since not all C++
358ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * compilers support genuine RTTI. Polymorphic operator==() and clone()
359ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * methods call this method.
360ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
361ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return          The class ID for this object. All objects of a
362ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                  given class have the same class ID.  Objects of
363ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                  other classes have different class IDs.
36485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
365ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
366ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UClassID getDynamicClassID(void) const;
367ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru};
368ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
369ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/**
370ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <code>AnnualTimeZoneRule</code> is a class used for representing a time zone
371ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * rule which takes effect annually.  The calenday system used for the rule is
372ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * is based on Gregorian calendar
373ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
37485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * @stable ICU 3.8
375ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */
376ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruclass U_I18N_API AnnualTimeZoneRule : public TimeZoneRule {
377ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querupublic:
378ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
379ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * The constant representing the maximum year used for designating
380ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * a rule is permanent.
381ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
382ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    static const int32_t MAX_YEAR;
383ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
384ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
385ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Constructs a <code>AnnualTimeZoneRule</code> with the name, the GMT offset of its
386ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * standard time, the amount of daylight saving offset adjustment, the annual start
387ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * time rule and the start/until years.  The input DateTimeRule is copied by this
388ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * constructor, so the caller remains responsible for deleting the object.
389ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param name          The time zone name.
390ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param rawOffset     The GMT offset of its standard time in milliseconds.
391ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param dstSavings    The amount of daylight saving offset adjustment in
392ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                      milliseconds.  If this ia a rule for standard time,
393ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                      the value of this argument is 0.
394ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param dateTimeRule  The start date/time rule repeated annually.
395ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param startYear     The first year when this rule takes effect.
396ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param endYear       The last year when this rule takes effect.  If this
397ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                      rule is effective forever in future, specify MAX_YEAR.
39885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
399ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
400ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    AnnualTimeZoneRule(const UnicodeString& name, int32_t rawOffset, int32_t dstSavings,
401ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru            const DateTimeRule& dateTimeRule, int32_t startYear, int32_t endYear);
402ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
403ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
404ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Constructs a <code>AnnualTimeZoneRule</code> with the name, the GMT offset of its
405ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * standard time, the amount of daylight saving offset adjustment, the annual start
406ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * time rule and the start/until years.  The input DateTimeRule object is adopted
407ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * by this object, therefore, the caller must not delete the object.
408ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param name          The time zone name.
409ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param rawOffset     The GMT offset of its standard time in milliseconds.
410ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param dstSavings    The amount of daylight saving offset adjustment in
411ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                      milliseconds.  If this ia a rule for standard time,
412ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                      the value of this argument is 0.
413ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param dateTimeRule  The start date/time rule repeated annually.
414ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param startYear     The first year when this rule takes effect.
415ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param endYear       The last year when this rule takes effect.  If this
416ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                      rule is effective forever in future, specify MAX_YEAR.
41785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
418ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
419ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    AnnualTimeZoneRule(const UnicodeString& name, int32_t rawOffset, int32_t dstSavings,
420ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru            DateTimeRule* dateTimeRule, int32_t startYear, int32_t endYear);
421ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
422ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
423ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Copy constructor.
424ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param source    The AnnualTimeZoneRule object to be copied.
42585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
426ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
427ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    AnnualTimeZoneRule(const AnnualTimeZoneRule& source);
428ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
429ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
430ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Destructor.
43185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
432ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
433ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual ~AnnualTimeZoneRule();
434ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
435ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
436ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Clone this AnnualTimeZoneRule object polymorphically. The caller owns the result and
437ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * should delete it when done.
438ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return    A copy of the object.
43985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
440ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
441ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual AnnualTimeZoneRule* clone(void) const;
442ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
443ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
444ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Assignment operator.
445ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param right The object to be copied.
44685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
447ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
448ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    AnnualTimeZoneRule& operator=(const AnnualTimeZoneRule& right);
449ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
450ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
451ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Return true if the given <code>TimeZoneRule</code> objects are semantically equal. Objects
452ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * of different subclasses are considered unequal.
453ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param that  The object to be compared with.
454ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if the given <code>TimeZoneRule</code> objects are semantically equal.
45585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
456ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
457ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UBool operator==(const TimeZoneRule& that) const;
458ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
459ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
460ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Return true if the given <code>TimeZoneRule</code> objects are semantically unequal. Objects
461ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * of different subclasses are considered unequal.
462ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param that  The object to be compared with.
463ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if the given <code>TimeZoneRule</code> objects are semantically unequal.
46485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
465ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
466ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UBool operator!=(const TimeZoneRule& that) const;
467ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
468ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
469ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Gets the start date/time rule used by this rule.
470ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  The <code>AnnualDateTimeRule</code> which represents the start date/time
471ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *          rule used by this time zone rule.
47285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
473ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
474ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    const DateTimeRule* getRule(void) const;
475ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
476ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
477ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Gets the first year when this rule takes effect.
478ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  The start year of this rule.  The year is in Gregorian calendar
479ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *          with 0 == 1 BCE, -1 == 2 BCE, etc.
48085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
481ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
482ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    int32_t getStartYear(void) const;
483ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
484ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
485ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Gets the end year when this rule takes effect.
486ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  The end year of this rule (inclusive). The year is in Gregorian calendar
487ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *          with 0 == 1 BCE, -1 == 2 BCE, etc.
48885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
489ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
490ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    int32_t getEndYear(void) const;
491ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
492ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
493ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Gets the time when this rule takes effect in the given year.
494ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param year              The Gregorian year, with 0 == 1 BCE, -1 == 2 BCE, etc.
495ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevRawOffset     The standard time offset from UTC before this rule
496ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          takes effect in milliseconds.
497ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevDSTSavings    The amount of daylight saving offset from the
498ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          standard time.
499ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param result            Receives the start time in the year.
500ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if this rule takes effect in the year and the result is set to
501ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *          "result".
50285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
503ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
504ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UBool getStartInYear(int32_t year, int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const;
505ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
506ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
507ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Returns if this rule represents the same rule and offsets as another.
508ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * When two <code>TimeZoneRule</code> objects differ only its names, this method
509ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * returns true.
510ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param that  The <code>TimeZoneRule</code> object to be compared with.
511ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if the other <code>TimeZoneRule</code> is equivalent to this one.
51285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
513ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
514ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UBool isEquivalentTo(const TimeZoneRule& that) const;
515ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
516ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
517ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Gets the very first time when this rule takes effect.
518ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevRawOffset     The standard time offset from UTC before this rule
519ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          takes effect in milliseconds.
520ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevDSTSavings    The amount of daylight saving offset from the
521ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          standard time.
522ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param result            Receives the very first time when this rule takes effect.
523ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if the start time is available.  When false is returned, output parameter
524ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *          "result" is unchanged.
52585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
526ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
527ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UBool getFirstStart(int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const;
528ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
529ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
530ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Gets the final time when this rule takes effect.
531ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevRawOffset     The standard time offset from UTC before this rule
532ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          takes effect in milliseconds.
533ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevDSTSavings    The amount of daylight saving offset from the
534ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          standard time.
535ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param result            Receives the final time when this rule takes effect.
536ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if the start time is available.  When false is returned, output parameter
537ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *          "result" is unchanged.
53885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
539ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
540ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UBool getFinalStart(int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const;
541ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
542ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
543ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Gets the first time when this rule takes effect after the specified time.
544ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param base              The first start time after this base time will be returned.
545ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevRawOffset     The standard time offset from UTC before this rule
546ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          takes effect in milliseconds.
547ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevDSTSavings    The amount of daylight saving offset from the
548ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          standard time.
549ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param inclusive         Whether the base time is inclusive or not.
550ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param result            Receives The first time when this rule takes effect after
551ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          the specified base time.
552ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if the start time is available.  When false is returned, output parameter
553ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *          "result" is unchanged.
55485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
555ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
556ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UBool getNextStart(UDate base, int32_t prevRawOffset, int32_t prevDSTSavings,
557ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru        UBool inclusive, UDate& result) const;
558ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
559ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
560ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Gets the most recent time when this rule takes effect before the specified time.
561ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param base              The most recent time before this base time will be returned.
562ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevRawOffset     The standard time offset from UTC before this rule
563ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          takes effect in milliseconds.
564ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevDSTSavings    The amount of daylight saving offset from the
565ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          standard time.
566ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param inclusive         Whether the base time is inclusive or not.
567ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param result            Receives The most recent time when this rule takes effect before
568ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          the specified base time.
569ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if the start time is available.  When false is returned, output parameter
570ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *          "result" is unchanged.
57185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
572ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
573ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UBool getPreviousStart(UDate base, int32_t prevRawOffset, int32_t prevDSTSavings,
574ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru        UBool inclusive, UDate& result) const;
575ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
576ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
577ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruprivate:
578ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    DateTimeRule* fDateTimeRule;
579ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    int32_t fStartYear;
580ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    int32_t fEndYear;
581ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
582ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querupublic:
583ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
584ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Return the class ID for this class. This is useful only for comparing to
585ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * a return value from getDynamicClassID(). For example:
586ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * <pre>
587ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * .   Base* polymorphic_pointer = createPolymorphicObject();
588ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * .   if (polymorphic_pointer->getDynamicClassID() ==
589ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * .       erived::getStaticClassID()) ...
590ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * </pre>
591ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return          The class ID for all objects of this class.
59285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
593ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
594ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    static UClassID U_EXPORT2 getStaticClassID(void);
595ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
596ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
597ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This
598ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * method is to implement a simple version of RTTI, since not all C++
599ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * compilers support genuine RTTI. Polymorphic operator==() and clone()
600ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * methods call this method.
601ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
602ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return          The class ID for this object. All objects of a
603ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                  given class have the same class ID.  Objects of
604ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                  other classes have different class IDs.
60585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
606ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
607ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UClassID getDynamicClassID(void) const;
608ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru};
609ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
610ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/**
611ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <code>TimeArrayTimeZoneRule</code> represents a time zone rule whose start times are
612ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * defined by an array of milliseconds since the standard base time.
613ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
61485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * @stable ICU 3.8
615ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */
616ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruclass U_I18N_API TimeArrayTimeZoneRule : public TimeZoneRule {
617ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querupublic:
618ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
619ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Constructs a <code>TimeArrayTimeZoneRule</code> with the name, the GMT offset of its
620ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * standard time, the amount of daylight saving offset adjustment and
621ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * the array of times when this rule takes effect.
622ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param name          The time zone name.
623ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param rawOffset     The UTC offset of its standard time in milliseconds.
624ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param dstSavings    The amount of daylight saving offset adjustment in
625ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                      milliseconds.  If this ia a rule for standard time,
626ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                      the value of this argument is 0.
627ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param startTimes    The array start times in milliseconds since the base time
628ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                      (January 1, 1970, 00:00:00).
629ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param numStartTimes The number of elements in the parameter "startTimes"
630ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param timeRuleType  The time type of the start times, which is one of
631ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                      <code>DataTimeRule::WALL_TIME</code>, <code>STANDARD_TIME</code>
63285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     *                      and <code>UTC_TIME</code>.
63385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
634ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
635ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    TimeArrayTimeZoneRule(const UnicodeString& name, int32_t rawOffset, int32_t dstSavings,
636ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru        const UDate* startTimes, int32_t numStartTimes, DateTimeRule::TimeRuleType timeRuleType);
637ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
638ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
639ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Copy constructor.
640ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param source    The TimeArrayTimeZoneRule object to be copied.
64185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
642ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
643ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    TimeArrayTimeZoneRule(const TimeArrayTimeZoneRule& source);
644ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
645ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
646ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Destructor.
64785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
648ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
649ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual ~TimeArrayTimeZoneRule();
650ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
651ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
652ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Clone this TimeArrayTimeZoneRule object polymorphically. The caller owns the result and
653ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * should delete it when done.
654ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return    A copy of the object.
65585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
656ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
657ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual TimeArrayTimeZoneRule* clone(void) const;
658ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
659ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
660ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Assignment operator.
661ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param right The object to be copied.
66285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
663ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
664ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    TimeArrayTimeZoneRule& operator=(const TimeArrayTimeZoneRule& right);
665ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
666ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
667ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Return true if the given <code>TimeZoneRule</code> objects are semantically equal. Objects
668ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * of different subclasses are considered unequal.
669ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param that  The object to be compared with.
670ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if the given <code>TimeZoneRule</code> objects are semantically equal.
67185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
672ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
673ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UBool operator==(const TimeZoneRule& that) const;
674ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
675ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
676ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Return true if the given <code>TimeZoneRule</code> objects are semantically unequal. Objects
677ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * of different subclasses are considered unequal.
678ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param that  The object to be compared with.
679ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if the given <code>TimeZoneRule</code> objects are semantically unequal.
68085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
681ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
682ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UBool operator!=(const TimeZoneRule& that) const;
683ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
684ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
685ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Gets the time type of the start times used by this rule.  The return value
686ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * is either <code>DateTimeRule::WALL_TIME</code> or <code>STANDARD_TIME</code>
68785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * or <code>UTC_TIME</code>.
688ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
689ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return The time type used of the start times used by this rule.
69085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
691ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
692ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    DateTimeRule::TimeRuleType getTimeType(void) const;
693ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
694ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
695ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Gets a start time at the index stored in this rule.
696ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param index     The index of start times
697ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param result    Receives the start time at the index
698ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if the index is within the valid range and
699ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *          and the result is set.  When false, the output
700ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *          parameger "result" is unchanged.
70185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
702ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
703ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UBool getStartTimeAt(int32_t index, UDate& result) const;
704ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
705ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
706ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Returns the number of start times stored in this rule
707ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return The number of start times.
70885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
709ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
710ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    int32_t countStartTimes(void) const;
711ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
712ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
713ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Returns if this rule represents the same rule and offsets as another.
714ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * When two <code>TimeZoneRule</code> objects differ only its names, this method
715ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * returns true.
716ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param that  The <code>TimeZoneRule</code> object to be compared with.
717ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if the other <code>TimeZoneRule</code> is equivalent to this one.
71885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
719ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
720ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UBool isEquivalentTo(const TimeZoneRule& that) const;
721ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
722ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
723ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Gets the very first time when this rule takes effect.
724ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevRawOffset     The standard time offset from UTC before this rule
725ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          takes effect in milliseconds.
726ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevDSTSavings    The amount of daylight saving offset from the
727ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          standard time.
728ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param result            Receives the very first time when this rule takes effect.
729ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if the start time is available.  When false is returned, output parameter
730ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *          "result" is unchanged.
73185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
732ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
733ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UBool getFirstStart(int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const;
734ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
735ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
736ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Gets the final time when this rule takes effect.
737ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevRawOffset     The standard time offset from UTC before this rule
738ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          takes effect in milliseconds.
739ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevDSTSavings    The amount of daylight saving offset from the
740ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          standard time.
741ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param result            Receives the final time when this rule takes effect.
742ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if the start time is available.  When false is returned, output parameter
743ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *          "result" is unchanged.
74485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
745ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
746ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UBool getFinalStart(int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const;
747ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
748ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
749ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Gets the first time when this rule takes effect after the specified time.
750ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param base              The first start time after this base time will be returned.
751ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevRawOffset     The standard time offset from UTC before this rule
752ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          takes effect in milliseconds.
753ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevDSTSavings    The amount of daylight saving offset from the
754ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          standard time.
755ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param inclusive         Whether the base time is inclusive or not.
756ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param result            Receives The first time when this rule takes effect after
757ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          the specified base time.
758ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if the start time is available.  When false is returned, output parameter
759ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *          "result" is unchanged.
76085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
761ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
762ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UBool getNextStart(UDate base, int32_t prevRawOffset, int32_t prevDSTSavings,
763ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru        UBool inclusive, UDate& result) const;
764ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
765ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
766ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Gets the most recent time when this rule takes effect before the specified time.
767ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param base              The most recent time before this base time will be returned.
768ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevRawOffset     The standard time offset from UTC before this rule
769ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          takes effect in milliseconds.
770ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevDSTSavings    The amount of daylight saving offset from the
771ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          standard time.
772ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param inclusive         Whether the base time is inclusive or not.
773ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param result            Receives The most recent time when this rule takes effect before
774ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          the specified base time.
775ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if the start time is available.  When false is returned, output parameter
776ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *          "result" is unchanged.
77785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
778ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
779ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UBool getPreviousStart(UDate base, int32_t prevRawOffset, int32_t prevDSTSavings,
780ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru        UBool inclusive, UDate& result) const;
781ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
782ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
783ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruprivate:
784ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    enum { TIMEARRAY_STACK_BUFFER_SIZE = 32 };
785ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UBool initStartTimes(const UDate source[], int32_t size, UErrorCode& ec);
786ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UDate getUTC(UDate time, int32_t raw, int32_t dst) const;
787ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
788ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    DateTimeRule::TimeRuleType  fTimeRuleType;
789ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    int32_t fNumStartTimes;
790ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UDate*  fStartTimes;
791ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UDate   fLocalStartTimes[TIMEARRAY_STACK_BUFFER_SIZE];
792ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
793ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querupublic:
794ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
795ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Return the class ID for this class. This is useful only for comparing to
796ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * a return value from getDynamicClassID(). For example:
797ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * <pre>
798ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * .   Base* polymorphic_pointer = createPolymorphicObject();
799ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * .   if (polymorphic_pointer->getDynamicClassID() ==
800ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * .       erived::getStaticClassID()) ...
801ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * </pre>
802ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return          The class ID for all objects of this class.
80385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
804ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
805ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    static UClassID U_EXPORT2 getStaticClassID(void);
806ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
807ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
808ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This
809ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * method is to implement a simple version of RTTI, since not all C++
810ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * compilers support genuine RTTI. Polymorphic operator==() and clone()
811ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * methods call this method.
812ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
813ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return          The class ID for this object. All objects of a
814ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                  given class have the same class ID.  Objects of
815ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                  other classes have different class IDs.
81685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
817ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
818ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UClassID getDynamicClassID(void) const;
819ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru};
820ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
821ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
822ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_NAMESPACE_END
823ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
824ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#endif /* #if !UCONFIG_NO_FORMATTING */
825ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
826ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#endif // TZRULE_H
827ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
828ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru//eof
829