164339d36f8bd4db5025fe2988eda22b491a9219cFredrik Roubert// Copyright (C) 2016 and later: Unicode, Inc. and others.
264339d36f8bd4db5025fe2988eda22b491a9219cFredrik Roubert// License & terms of use: http://www.unicode.org/copyright.html
3ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/*
4ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru*******************************************************************************
585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho* Copyright (C) 2007-2008, International Business Machines Corporation and    *
6ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* others. All Rights Reserved.                                                *
7ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru*******************************************************************************
8ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru*/
9ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#ifndef TZRULE_H
10ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#define TZRULE_H
11ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
12ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/**
13ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * \file
14ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * \brief C++ API: Time zone rule classes
15ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */
16ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
17ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "unicode/utypes.h"
18ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
19ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#if !UCONFIG_NO_FORMATTING
20ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
21ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "unicode/uobject.h"
22ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "unicode/unistr.h"
23ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "unicode/dtrule.h"
24ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
25ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_NAMESPACE_BEGIN
26ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
27ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/**
28ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <code>TimeZoneRule</code> is a class representing a rule for time zone.
29ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <code>TimeZoneRule</code> has a set of time zone attributes, such as zone name,
30ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * raw offset (UTC offset for standard time) and daylight saving time offset.
31ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
3285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * @stable ICU 3.8
33ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */
34ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruclass U_I18N_API TimeZoneRule : public UObject {
35ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querupublic:
36ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
37ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Destructor.
3885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
39ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
40ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual ~TimeZoneRule();
41ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
42ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
43ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Clone this TimeZoneRule object polymorphically. The caller owns the result and
44ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * should delete it when done.
45ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  A copy of the object.
4685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
47ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
48ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual TimeZoneRule* clone(void) const = 0;
49ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
50ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
51ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Return true if the given <code>TimeZoneRule</code> objects are semantically equal. Objects
52ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * of different subclasses are considered unequal.
53ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param that  The object to be compared with.
54ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if the given <code>TimeZoneRule</code> objects are semantically equal.
5585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
56ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
57ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UBool operator==(const TimeZoneRule& that) const;
58ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
59ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
60ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Return true if the given <code>TimeZoneRule</code> objects are semantically unequal. Objects
61ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * of different subclasses are considered unequal.
62ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param that  The object to be compared with.
63ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if the given <code>TimeZoneRule</code> objects are semantically unequal.
6485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
65ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
66ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UBool operator!=(const TimeZoneRule& that) const;
67ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
68ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
69ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Fills in "name" with the name of this time zone.
70ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param name  Receives the name of this time zone.
71ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  A reference to "name"
7285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
73ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
74ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UnicodeString& getName(UnicodeString& name) const;
75ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
76ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
77ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Gets the standard time offset.
78ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  The standard time offset from UTC in milliseconds.
7985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
80ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
81ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    int32_t getRawOffset(void) const;
82ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
83ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
84ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Gets the amount of daylight saving delta time from the standard time.
85ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  The amount of daylight saving offset used by this rule
86ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *          in milliseconds.
8785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
88ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
89ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    int32_t getDSTSavings(void) const;
90ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
91ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
92ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Returns if this rule represents the same rule and offsets as another.
93ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * When two <code>TimeZoneRule</code> objects differ only its names, this method
94ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * returns true.
95ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param other The <code>TimeZoneRule</code> object to be compared with.
96ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if the other <code>TimeZoneRule</code> is the same as this one.
9785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
98ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
99ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UBool isEquivalentTo(const TimeZoneRule& other) const;
100ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
101ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
102ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Gets the very first time when this rule takes effect.
103ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevRawOffset     The standard time offset from UTC before this rule
104ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          takes effect in milliseconds.
105ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevDSTSavings    The amount of daylight saving offset from the
106ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          standard time.
107ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param result            Receives the very first time when this rule takes effect.
108ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if the start time is available.  When false is returned, output parameter
109ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *          "result" is unchanged.
11085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
111ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
112ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UBool getFirstStart(int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const = 0;
113ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
114ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
115ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Gets the final time when this rule takes effect.
116ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevRawOffset     The standard time offset from UTC before this rule
117ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          takes effect in milliseconds.
118ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevDSTSavings    The amount of daylight saving offset from the
119ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          standard time.
120ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param result            Receives the final time when this rule takes effect.
121ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if the start time is available.  When false is returned, output parameter
122ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *          "result" is unchanged.
12385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
124ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
125ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UBool getFinalStart(int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const = 0;
126ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
127ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
128ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Gets the first time when this rule takes effect after the specified time.
129ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param base              The first start time after this base time will be returned.
130ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevRawOffset     The standard time offset from UTC before this rule
131ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          takes effect in milliseconds.
132ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevDSTSavings    The amount of daylight saving offset from the
133ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          standard time.
134ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param inclusive         Whether the base time is inclusive or not.
135ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param result            Receives The first time when this rule takes effect after
136ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          the specified base time.
137ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if the start time is available.  When false is returned, output parameter
138ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *          "result" is unchanged.
13985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
140ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
141ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UBool getNextStart(UDate base, int32_t prevRawOffset, int32_t prevDSTSavings,
142ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru        UBool inclusive, UDate& result) const = 0;
143ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
144ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
145ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Gets the most recent time when this rule takes effect before the specified time.
146ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param base              The most recent time before this base time will be returned.
147ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevRawOffset     The standard time offset from UTC before this rule
148ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          takes effect in milliseconds.
149ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevDSTSavings    The amount of daylight saving offset from the
150ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          standard time.
151ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param inclusive         Whether the base time is inclusive or not.
152ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param result            Receives The most recent time when this rule takes effect before
153ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          the specified base time.
154ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if the start time is available.  When false is returned, output parameter
155ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *          "result" is unchanged.
15685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
157ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
158ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UBool getPreviousStart(UDate base, int32_t prevRawOffset, int32_t prevDSTSavings,
159ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru        UBool inclusive, UDate& result) const = 0;
160ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
161ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruprotected:
162ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
163ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
164ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Constructs a <code>TimeZoneRule</code> with the name, the GMT offset of its
165ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * standard time and the amount of daylight saving offset adjustment.
166ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param name          The time zone name.
167ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param rawOffset     The UTC offset of its standard time in milliseconds.
168ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param dstSavings    The amount of daylight saving offset adjustment in milliseconds.
169ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                      If this ia a rule for standard time, the value of this argument is 0.
17085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
171ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
172ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    TimeZoneRule(const UnicodeString& name, int32_t rawOffset, int32_t dstSavings);
173ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
174ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
175ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Copy constructor.
176ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param source    The TimeZoneRule object to be copied.
17785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
178ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
179ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    TimeZoneRule(const TimeZoneRule& source);
180ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
181ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
182ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Assignment operator.
183ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param right The object to be copied.
18485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
185ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
186ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    TimeZoneRule& operator=(const TimeZoneRule& right);
187ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
188ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruprivate:
189ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UnicodeString fName; // time name
190ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    int32_t fRawOffset;  // UTC offset of the standard time in milliseconds
191ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    int32_t fDSTSavings; // DST saving amount in milliseconds
192ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru};
193ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
194ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/**
195ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <code>InitialTimeZoneRule</code> represents a time zone rule
196ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * representing a time zone effective from the beginning and
197ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * has no actual start times.
19885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * @stable ICU 3.8
199ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */
200ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruclass U_I18N_API InitialTimeZoneRule : public TimeZoneRule {
201ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querupublic:
202ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
203ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Constructs an <code>InitialTimeZoneRule</code> with the name, the GMT offset of its
204ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * standard time and the amount of daylight saving offset adjustment.
205ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param name          The time zone name.
206ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param rawOffset     The UTC offset of its standard time in milliseconds.
207ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param dstSavings    The amount of daylight saving offset adjustment in milliseconds.
208ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                      If this ia a rule for standard time, the value of this argument is 0.
20985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
210ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
211ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    InitialTimeZoneRule(const UnicodeString& name, int32_t rawOffset, int32_t dstSavings);
212ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
213ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
214ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Copy constructor.
215ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param source    The InitialTimeZoneRule object to be copied.
21685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
217ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
218ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    InitialTimeZoneRule(const InitialTimeZoneRule& source);
219ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
220ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
221ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Destructor.
22285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
223ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
224ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual ~InitialTimeZoneRule();
225ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
226ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
227ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Clone this InitialTimeZoneRule object polymorphically. The caller owns the result and
228ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * should delete it when done.
229ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return    A copy of the object.
23085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
231ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
232ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual InitialTimeZoneRule* clone(void) const;
233ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
234ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
235ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Assignment operator.
236ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param right The object to be copied.
23785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
238ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
239ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    InitialTimeZoneRule& operator=(const InitialTimeZoneRule& right);
240ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
241ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
242ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Return true if the given <code>TimeZoneRule</code> objects are semantically equal. Objects
243ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * of different subclasses are considered unequal.
244ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param that  The object to be compared with.
245ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if the given <code>TimeZoneRule</code> objects are semantically equal.
24685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
247ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
248ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UBool operator==(const TimeZoneRule& that) const;
249ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
250ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
251ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Return true if the given <code>TimeZoneRule</code> objects are semantically unequal. Objects
252ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * of different subclasses are considered unequal.
253ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param that  The object to be compared with.
254ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if the given <code>TimeZoneRule</code> objects are semantically unequal.
25585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
256ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
257ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UBool operator!=(const TimeZoneRule& that) const;
258ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
259ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
260ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Gets the time when this rule takes effect in the given year.
261ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param year              The Gregorian year, with 0 == 1 BCE, -1 == 2 BCE, etc.
262ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevRawOffset     The standard time offset from UTC before this rule
263ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          takes effect in milliseconds.
264ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevDSTSavings    The amount of daylight saving offset from the
265ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          standard time.
266ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param result            Receives the start time in the year.
267ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if this rule takes effect in the year and the result is set to
268ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *          "result".
26985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
270ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
271ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UBool getStartInYear(int32_t year, int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const;
272ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
273ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
274ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Returns if this rule represents the same rule and offsets as another.
275ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * When two <code>TimeZoneRule</code> objects differ only its names, this method
276ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * returns true.
277ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param that  The <code>TimeZoneRule</code> object to be compared with.
278ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if the other <code>TimeZoneRule</code> is equivalent to this one.
27985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
280ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
281ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UBool isEquivalentTo(const TimeZoneRule& that) const;
282ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
283ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
284ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Gets the very first time when this rule takes effect.
285ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevRawOffset     The standard time offset from UTC before this rule
286ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          takes effect in milliseconds.
287ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevDSTSavings    The amount of daylight saving offset from the
288ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          standard time.
289ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param result            Receives the very first time when this rule takes effect.
290ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if the start time is available.  When false is returned, output parameter
291ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *          "result" is unchanged.
29285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
293ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
294ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UBool getFirstStart(int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const;
295ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
296ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
297ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Gets the final time when this rule takes effect.
298ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevRawOffset     The standard time offset from UTC before this rule
299ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          takes effect in milliseconds.
300ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevDSTSavings    The amount of daylight saving offset from the
301ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          standard time.
302ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param result            Receives the final time when this rule takes effect.
303ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if the start time is available.  When false is returned, output parameter
304ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *          "result" is unchanged.
30585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
306ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
307ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UBool getFinalStart(int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const;
308ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
309ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
310ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Gets the first time when this rule takes effect after the specified time.
311ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param base              The first start time after this base time will be returned.
312ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevRawOffset     The standard time offset from UTC before this rule
313ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          takes effect in milliseconds.
314ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevDSTSavings    The amount of daylight saving offset from the
315ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          standard time.
316ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param inclusive         Whether the base time is inclusive or not.
317ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param result            Receives The first time when this rule takes effect after
318ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          the specified base time.
319ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if the start time is available.  When false is returned, output parameter
320ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *          "result" is unchanged.
32185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
322ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
323ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UBool getNextStart(UDate base, int32_t prevRawOffset, int32_t prevDSTSavings,
324ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru        UBool inclusive, UDate& result) const;
325ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
326ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
327ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Gets the most recent time when this rule takes effect before the specified time.
328ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param base              The most recent time before this base time will be returned.
329ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevRawOffset     The standard time offset from UTC before this rule
330ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          takes effect in milliseconds.
331ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevDSTSavings    The amount of daylight saving offset from the
332ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          standard time.
333ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param inclusive         Whether the base time is inclusive or not.
334ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param result            Receives The most recent time when this rule takes effect before
335ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          the specified base time.
336ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if the start time is available.  When false is returned, output parameter
337ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *          "result" is unchanged.
33885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
339ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
340ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UBool getPreviousStart(UDate base, int32_t prevRawOffset, int32_t prevDSTSavings,
341ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru        UBool inclusive, UDate& result) const;
342ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
343ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querupublic:
344ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
345ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Return the class ID for this class. This is useful only for comparing to
346ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * a return value from getDynamicClassID(). For example:
347ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * <pre>
348ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * .   Base* polymorphic_pointer = createPolymorphicObject();
349ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * .   if (polymorphic_pointer->getDynamicClassID() ==
350ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * .       erived::getStaticClassID()) ...
351ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * </pre>
352ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return          The class ID for all objects of this class.
35385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
354ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
355ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    static UClassID U_EXPORT2 getStaticClassID(void);
356ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
357ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
358ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This
359ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * method is to implement a simple version of RTTI, since not all C++
360ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * compilers support genuine RTTI. Polymorphic operator==() and clone()
361ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * methods call this method.
362ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
363ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return          The class ID for this object. All objects of a
364ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                  given class have the same class ID.  Objects of
365ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                  other classes have different class IDs.
36685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
367ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
368ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UClassID getDynamicClassID(void) const;
369ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru};
370ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
371ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/**
372ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <code>AnnualTimeZoneRule</code> is a class used for representing a time zone
373ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * rule which takes effect annually.  The calenday system used for the rule is
374ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * is based on Gregorian calendar
375ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
37685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * @stable ICU 3.8
377ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */
378ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruclass U_I18N_API AnnualTimeZoneRule : public TimeZoneRule {
379ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querupublic:
380ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
381ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * The constant representing the maximum year used for designating
382ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * a rule is permanent.
383ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
384ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    static const int32_t MAX_YEAR;
385ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
386ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
387ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Constructs a <code>AnnualTimeZoneRule</code> with the name, the GMT offset of its
388ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * standard time, the amount of daylight saving offset adjustment, the annual start
389ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * time rule and the start/until years.  The input DateTimeRule is copied by this
390ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * constructor, so the caller remains responsible for deleting the object.
391ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param name          The time zone name.
392ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param rawOffset     The GMT offset of its standard time in milliseconds.
393ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param dstSavings    The amount of daylight saving offset adjustment in
394ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                      milliseconds.  If this ia a rule for standard time,
395ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                      the value of this argument is 0.
396ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param dateTimeRule  The start date/time rule repeated annually.
397ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param startYear     The first year when this rule takes effect.
398ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param endYear       The last year when this rule takes effect.  If this
399ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                      rule is effective forever in future, specify MAX_YEAR.
40085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
401ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
402ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    AnnualTimeZoneRule(const UnicodeString& name, int32_t rawOffset, int32_t dstSavings,
403ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru            const DateTimeRule& dateTimeRule, int32_t startYear, int32_t endYear);
404ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
405ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
406ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Constructs a <code>AnnualTimeZoneRule</code> with the name, the GMT offset of its
407ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * standard time, the amount of daylight saving offset adjustment, the annual start
408ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * time rule and the start/until years.  The input DateTimeRule object is adopted
409ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * by this object, therefore, the caller must not delete the object.
410ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param name          The time zone name.
411ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param rawOffset     The GMT offset of its standard time in milliseconds.
412ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param dstSavings    The amount of daylight saving offset adjustment in
413ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                      milliseconds.  If this ia a rule for standard time,
414ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                      the value of this argument is 0.
415ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param dateTimeRule  The start date/time rule repeated annually.
416ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param startYear     The first year when this rule takes effect.
417ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param endYear       The last year when this rule takes effect.  If this
418ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                      rule is effective forever in future, specify MAX_YEAR.
41985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
420ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
421ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    AnnualTimeZoneRule(const UnicodeString& name, int32_t rawOffset, int32_t dstSavings,
422ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru            DateTimeRule* dateTimeRule, int32_t startYear, int32_t endYear);
423ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
424ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
425ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Copy constructor.
426ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param source    The AnnualTimeZoneRule object to be copied.
42785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
428ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
429ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    AnnualTimeZoneRule(const AnnualTimeZoneRule& source);
430ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
431ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
432ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Destructor.
43385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
434ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
435ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual ~AnnualTimeZoneRule();
436ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
437ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
438ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Clone this AnnualTimeZoneRule object polymorphically. The caller owns the result and
439ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * should delete it when done.
440ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return    A copy of the object.
44185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
442ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
443ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual AnnualTimeZoneRule* clone(void) const;
444ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
445ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
446ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Assignment operator.
447ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param right The object to be copied.
44885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
449ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
450ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    AnnualTimeZoneRule& operator=(const AnnualTimeZoneRule& right);
451ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
452ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
453ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Return true if the given <code>TimeZoneRule</code> objects are semantically equal. Objects
454ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * of different subclasses are considered unequal.
455ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param that  The object to be compared with.
456ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if the given <code>TimeZoneRule</code> objects are semantically equal.
45785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
458ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
459ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UBool operator==(const TimeZoneRule& that) const;
460ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
461ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
462ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Return true if the given <code>TimeZoneRule</code> objects are semantically unequal. Objects
463ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * of different subclasses are considered unequal.
464ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param that  The object to be compared with.
465ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if the given <code>TimeZoneRule</code> objects are semantically unequal.
46685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
467ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
468ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UBool operator!=(const TimeZoneRule& that) const;
469ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
470ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
471ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Gets the start date/time rule used by this rule.
472ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  The <code>AnnualDateTimeRule</code> which represents the start date/time
473ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *          rule used by this time zone rule.
47485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
475ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
476ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    const DateTimeRule* getRule(void) const;
477ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
478ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
479ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Gets the first year when this rule takes effect.
480ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  The start year of this rule.  The year is in Gregorian calendar
481ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *          with 0 == 1 BCE, -1 == 2 BCE, etc.
48285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
483ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
484ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    int32_t getStartYear(void) const;
485ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
486ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
487ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Gets the end year when this rule takes effect.
488ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  The end year of this rule (inclusive). The year is in Gregorian calendar
489ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *          with 0 == 1 BCE, -1 == 2 BCE, etc.
49085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
491ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
492ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    int32_t getEndYear(void) const;
493ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
494ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
495ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Gets the time when this rule takes effect in the given year.
496ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param year              The Gregorian year, with 0 == 1 BCE, -1 == 2 BCE, etc.
497ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevRawOffset     The standard time offset from UTC before this rule
498ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          takes effect in milliseconds.
499ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevDSTSavings    The amount of daylight saving offset from the
500ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          standard time.
501ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param result            Receives the start time in the year.
502ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if this rule takes effect in the year and the result is set to
503ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *          "result".
50485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
505ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
506ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UBool getStartInYear(int32_t year, int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const;
507ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
508ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
509ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Returns if this rule represents the same rule and offsets as another.
510ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * When two <code>TimeZoneRule</code> objects differ only its names, this method
511ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * returns true.
512ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param that  The <code>TimeZoneRule</code> object to be compared with.
513ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if the other <code>TimeZoneRule</code> is equivalent to this one.
51485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
515ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
516ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UBool isEquivalentTo(const TimeZoneRule& that) const;
517ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
518ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
519ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Gets the very first time when this rule takes effect.
520ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevRawOffset     The standard time offset from UTC before this rule
521ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          takes effect in milliseconds.
522ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevDSTSavings    The amount of daylight saving offset from the
523ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          standard time.
524ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param result            Receives the very first time when this rule takes effect.
525ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if the start time is available.  When false is returned, output parameter
526ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *          "result" is unchanged.
52785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
528ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
529ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UBool getFirstStart(int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const;
530ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
531ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
532ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Gets the final time when this rule takes effect.
533ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevRawOffset     The standard time offset from UTC before this rule
534ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          takes effect in milliseconds.
535ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevDSTSavings    The amount of daylight saving offset from the
536ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          standard time.
537ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param result            Receives the final time when this rule takes effect.
538ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if the start time is available.  When false is returned, output parameter
539ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *          "result" is unchanged.
54085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
541ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
542ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UBool getFinalStart(int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const;
543ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
544ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
545ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Gets the first time when this rule takes effect after the specified time.
546ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param base              The first start time after this base time will be returned.
547ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevRawOffset     The standard time offset from UTC before this rule
548ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          takes effect in milliseconds.
549ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevDSTSavings    The amount of daylight saving offset from the
550ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          standard time.
551ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param inclusive         Whether the base time is inclusive or not.
552ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param result            Receives The first time when this rule takes effect after
553ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          the specified base time.
554ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if the start time is available.  When false is returned, output parameter
555ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *          "result" is unchanged.
55685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
557ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
558ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UBool getNextStart(UDate base, int32_t prevRawOffset, int32_t prevDSTSavings,
559ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru        UBool inclusive, UDate& result) const;
560ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
561ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
562ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Gets the most recent time when this rule takes effect before the specified time.
563ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param base              The most recent time before this base time will be returned.
564ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevRawOffset     The standard time offset from UTC before this rule
565ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          takes effect in milliseconds.
566ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevDSTSavings    The amount of daylight saving offset from the
567ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          standard time.
568ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param inclusive         Whether the base time is inclusive or not.
569ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param result            Receives The most recent time when this rule takes effect before
570ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          the specified base time.
571ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if the start time is available.  When false is returned, output parameter
572ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *          "result" is unchanged.
57385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
574ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
575ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UBool getPreviousStart(UDate base, int32_t prevRawOffset, int32_t prevDSTSavings,
576ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru        UBool inclusive, UDate& result) const;
577ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
578ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
579ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruprivate:
580ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    DateTimeRule* fDateTimeRule;
581ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    int32_t fStartYear;
582ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    int32_t fEndYear;
583ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
584ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querupublic:
585ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
586ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Return the class ID for this class. This is useful only for comparing to
587ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * a return value from getDynamicClassID(). For example:
588ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * <pre>
589ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * .   Base* polymorphic_pointer = createPolymorphicObject();
590ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * .   if (polymorphic_pointer->getDynamicClassID() ==
591ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * .       erived::getStaticClassID()) ...
592ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * </pre>
593ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return          The class ID for all objects of this class.
59485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
595ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
596ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    static UClassID U_EXPORT2 getStaticClassID(void);
597ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
598ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
599ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This
600ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * method is to implement a simple version of RTTI, since not all C++
601ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * compilers support genuine RTTI. Polymorphic operator==() and clone()
602ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * methods call this method.
603ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
604ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return          The class ID for this object. All objects of a
605ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                  given class have the same class ID.  Objects of
606ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                  other classes have different class IDs.
60785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
608ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
609ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UClassID getDynamicClassID(void) const;
610ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru};
611ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
612ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/**
613ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <code>TimeArrayTimeZoneRule</code> represents a time zone rule whose start times are
614ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * defined by an array of milliseconds since the standard base time.
615ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
61685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * @stable ICU 3.8
617ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */
618ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruclass U_I18N_API TimeArrayTimeZoneRule : public TimeZoneRule {
619ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querupublic:
620ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
621ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Constructs a <code>TimeArrayTimeZoneRule</code> with the name, the GMT offset of its
622ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * standard time, the amount of daylight saving offset adjustment and
623ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * the array of times when this rule takes effect.
624ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param name          The time zone name.
625ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param rawOffset     The UTC offset of its standard time in milliseconds.
626ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param dstSavings    The amount of daylight saving offset adjustment in
627ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                      milliseconds.  If this ia a rule for standard time,
628ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                      the value of this argument is 0.
629ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param startTimes    The array start times in milliseconds since the base time
630ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                      (January 1, 1970, 00:00:00).
631ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param numStartTimes The number of elements in the parameter "startTimes"
632ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param timeRuleType  The time type of the start times, which is one of
633ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                      <code>DataTimeRule::WALL_TIME</code>, <code>STANDARD_TIME</code>
63485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     *                      and <code>UTC_TIME</code>.
63585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
636ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
637ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    TimeArrayTimeZoneRule(const UnicodeString& name, int32_t rawOffset, int32_t dstSavings,
638ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru        const UDate* startTimes, int32_t numStartTimes, DateTimeRule::TimeRuleType timeRuleType);
639ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
640ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
641ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Copy constructor.
642ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param source    The TimeArrayTimeZoneRule object to be copied.
64385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
644ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
645ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    TimeArrayTimeZoneRule(const TimeArrayTimeZoneRule& source);
646ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
647ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
648ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Destructor.
64985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
650ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
651ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual ~TimeArrayTimeZoneRule();
652ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
653ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
654ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Clone this TimeArrayTimeZoneRule object polymorphically. The caller owns the result and
655ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * should delete it when done.
656ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return    A copy of the object.
65785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
658ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
659ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual TimeArrayTimeZoneRule* clone(void) const;
660ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
661ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
662ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Assignment operator.
663ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param right The object to be copied.
66485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
665ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
666ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    TimeArrayTimeZoneRule& operator=(const TimeArrayTimeZoneRule& right);
667ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
668ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
669ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Return true if the given <code>TimeZoneRule</code> objects are semantically equal. Objects
670ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * of different subclasses are considered unequal.
671ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param that  The object to be compared with.
672ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if the given <code>TimeZoneRule</code> objects are semantically equal.
67385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
674ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
675ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UBool operator==(const TimeZoneRule& that) const;
676ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
677ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
678ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Return true if the given <code>TimeZoneRule</code> objects are semantically unequal. Objects
679ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * of different subclasses are considered unequal.
680ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param that  The object to be compared with.
681ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if the given <code>TimeZoneRule</code> objects are semantically unequal.
68285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
683ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
684ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UBool operator!=(const TimeZoneRule& that) const;
685ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
686ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
687ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Gets the time type of the start times used by this rule.  The return value
688ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * is either <code>DateTimeRule::WALL_TIME</code> or <code>STANDARD_TIME</code>
68985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * or <code>UTC_TIME</code>.
690ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
691ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return The time type used of the start times used by this rule.
69285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
693ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
694ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    DateTimeRule::TimeRuleType getTimeType(void) const;
695ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
696ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
697ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Gets a start time at the index stored in this rule.
698ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param index     The index of start times
699ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param result    Receives the start time at the index
700ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if the index is within the valid range and
701ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *          and the result is set.  When false, the output
702ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *          parameger "result" is unchanged.
70385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
704ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
705ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UBool getStartTimeAt(int32_t index, UDate& result) const;
706ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
707ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
708ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Returns the number of start times stored in this rule
709ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return The number of start times.
71085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
711ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
712ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    int32_t countStartTimes(void) const;
713ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
714ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
715ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Returns if this rule represents the same rule and offsets as another.
716ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * When two <code>TimeZoneRule</code> objects differ only its names, this method
717ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * returns true.
718ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param that  The <code>TimeZoneRule</code> object to be compared with.
719ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if the other <code>TimeZoneRule</code> is equivalent to this one.
72085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
721ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
722ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UBool isEquivalentTo(const TimeZoneRule& that) const;
723ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
724ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
725ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Gets the very first time when this rule takes effect.
726ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevRawOffset     The standard time offset from UTC before this rule
727ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          takes effect in milliseconds.
728ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevDSTSavings    The amount of daylight saving offset from the
729ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          standard time.
730ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param result            Receives the very first time when this rule takes effect.
731ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if the start time is available.  When false is returned, output parameter
732ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *          "result" is unchanged.
73385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
734ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
735ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UBool getFirstStart(int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const;
736ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
737ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
738ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Gets the final time when this rule takes effect.
739ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevRawOffset     The standard time offset from UTC before this rule
740ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          takes effect in milliseconds.
741ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevDSTSavings    The amount of daylight saving offset from the
742ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          standard time.
743ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param result            Receives the final time when this rule takes effect.
744ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if the start time is available.  When false is returned, output parameter
745ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *          "result" is unchanged.
74685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
747ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
748ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UBool getFinalStart(int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const;
749ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
750ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
751ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Gets the first time when this rule takes effect after the specified time.
752ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param base              The first start time after this base time will be returned.
753ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevRawOffset     The standard time offset from UTC before this rule
754ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          takes effect in milliseconds.
755ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevDSTSavings    The amount of daylight saving offset from the
756ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          standard time.
757ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param inclusive         Whether the base time is inclusive or not.
758ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param result            Receives The first time when this rule takes effect after
759ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          the specified base time.
760ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if the start time is available.  When false is returned, output parameter
761ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *          "result" is unchanged.
76285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
763ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
764ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UBool getNextStart(UDate base, int32_t prevRawOffset, int32_t prevDSTSavings,
765ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru        UBool inclusive, UDate& result) const;
766ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
767ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
768ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Gets the most recent time when this rule takes effect before the specified time.
769ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param base              The most recent time before this base time will be returned.
770ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevRawOffset     The standard time offset from UTC before this rule
771ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          takes effect in milliseconds.
772ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param prevDSTSavings    The amount of daylight saving offset from the
773ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          standard time.
774ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param inclusive         Whether the base time is inclusive or not.
775ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param result            Receives The most recent time when this rule takes effect before
776ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          the specified base time.
777ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return  true if the start time is available.  When false is returned, output parameter
778ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *          "result" is unchanged.
77985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
780ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
781ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UBool getPreviousStart(UDate base, int32_t prevRawOffset, int32_t prevDSTSavings,
782ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru        UBool inclusive, UDate& result) const;
783ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
784ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
785ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruprivate:
786ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    enum { TIMEARRAY_STACK_BUFFER_SIZE = 32 };
787ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UBool initStartTimes(const UDate source[], int32_t size, UErrorCode& ec);
788ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UDate getUTC(UDate time, int32_t raw, int32_t dst) const;
789ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
790ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    DateTimeRule::TimeRuleType  fTimeRuleType;
791ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    int32_t fNumStartTimes;
792ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UDate*  fStartTimes;
793ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UDate   fLocalStartTimes[TIMEARRAY_STACK_BUFFER_SIZE];
794ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
795ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querupublic:
796ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
797ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Return the class ID for this class. This is useful only for comparing to
798ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * a return value from getDynamicClassID(). For example:
799ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * <pre>
800ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * .   Base* polymorphic_pointer = createPolymorphicObject();
801ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * .   if (polymorphic_pointer->getDynamicClassID() ==
802ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * .       erived::getStaticClassID()) ...
803ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * </pre>
804ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return          The class ID for all objects of this class.
80585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
806ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
807ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    static UClassID U_EXPORT2 getStaticClassID(void);
808ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
809ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
810ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This
811ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * method is to implement a simple version of RTTI, since not all C++
812ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * compilers support genuine RTTI. Polymorphic operator==() and clone()
813ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * methods call this method.
814ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
815ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return          The class ID for this object. All objects of a
816ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                  given class have the same class ID.  Objects of
817ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                  other classes have different class IDs.
81885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @stable ICU 3.8
819ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
820ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UClassID getDynamicClassID(void) const;
821ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru};
822ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
823ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
824ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_NAMESPACE_END
825ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
826ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#endif /* #if !UCONFIG_NO_FORMATTING */
827ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
828ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#endif // TZRULE_H
829ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
830ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru//eof
831