blob: 34b371b16bf887f07a51e20ea42a3c7b6d66e883 [file] [log] [blame]
Fredrik Roubert0596fae2017-04-18 21:34:02 +02001// © 2016 and later: Unicode, Inc. and others.
Fredrik Roubert64339d32016-10-21 19:43:16 +02002// License & terms of use: http://www.unicode.org/copyright.html
Jean-Baptiste Queruac04d0b2009-07-17 17:11:19 -07003/*
4*******************************************************************************
Craig Cornelius83933352013-06-14 14:20:29 -07005* Copyright (C) 2007-2013, International Business Machines Corporation and
Craig Cornelius103e9ff2012-10-09 17:03:29 -07006* others. All Rights Reserved.
Jean-Baptiste Queruac04d0b2009-07-17 17:11:19 -07007*******************************************************************************
8*/
9#ifndef VTZONE_H
10#define VTZONE_H
11
12#include "unicode/utypes.h"
13
Nikita Iashchenko4c0e2862019-11-05 16:38:00 +000014#if U_SHOW_CPLUSPLUS_API
15
Jean-Baptiste Queruac04d0b2009-07-17 17:11:19 -070016/**
17 * \file
18 * \brief C++ API: RFC2445 VTIMEZONE support
19 */
20
21#if !UCONFIG_NO_FORMATTING
22
23#include "unicode/basictz.h"
24
25U_NAMESPACE_BEGIN
26
27class VTZWriter;
28class VTZReader;
29class UVector;
30
31/**
32 * <code>VTimeZone</code> is a class implementing RFC2445 VTIMEZONE. You can create a
33 * <code>VTimeZone</code> instance from a time zone ID supported by <code>TimeZone</code>.
34 * With the <code>VTimeZone</code> instance created from the ID, you can write out the rule
35 * in RFC2445 VTIMEZONE format. Also, you can create a <code>VTimeZone</code> instance
36 * from RFC2445 VTIMEZONE data stream, which allows you to calculate time
claireho27f65472011-06-09 11:11:49 -070037 * zone offset by the rules defined by the data. Or, you can create a
38 * <code>VTimeZone</code> from any other ICU <code>BasicTimeZone</code>.
39 * <br><br>
Jean-Baptiste Queruac04d0b2009-07-17 17:11:19 -070040 * Note: The consumer of this class reading or writing VTIMEZONE data is responsible to
41 * decode or encode Non-ASCII text. Methods reading/writing VTIMEZONE data in this class
42 * do nothing with MIME encoding.
Claire Ho85bf2e22009-11-24 14:23:02 -080043 * @stable ICU 3.8
Jean-Baptiste Queruac04d0b2009-07-17 17:11:19 -070044 */
45class U_I18N_API VTimeZone : public BasicTimeZone {
46public:
47 /**
48 * Copy constructor.
49 * @param source The <code>VTimeZone</code> object to be copied.
Claire Ho85bf2e22009-11-24 14:23:02 -080050 * @stable ICU 3.8
Jean-Baptiste Queruac04d0b2009-07-17 17:11:19 -070051 */
52 VTimeZone(const VTimeZone& source);
53
54 /**
55 * Destructor.
Claire Ho85bf2e22009-11-24 14:23:02 -080056 * @stable ICU 3.8
Jean-Baptiste Queruac04d0b2009-07-17 17:11:19 -070057 */
58 virtual ~VTimeZone();
59
60 /**
61 * Assignment operator.
62 * @param right The object to be copied.
Claire Ho85bf2e22009-11-24 14:23:02 -080063 * @stable ICU 3.8
Jean-Baptiste Queruac04d0b2009-07-17 17:11:19 -070064 */
65 VTimeZone& operator=(const VTimeZone& right);
66
67 /**
68 * Return true if the given <code>TimeZone</code> objects are
69 * semantically equal. Objects of different subclasses are considered unequal.
70 * @param that The object to be compared with.
71 * @return true if the given <code>TimeZone</code> objects are
72 *semantically equal.
Claire Ho85bf2e22009-11-24 14:23:02 -080073 * @stable ICU 3.8
Jean-Baptiste Queruac04d0b2009-07-17 17:11:19 -070074 */
75 virtual UBool operator==(const TimeZone& that) const;
76
77 /**
78 * Return true if the given <code>TimeZone</code> objects are
79 * semantically unequal. Objects of different subclasses are considered unequal.
80 * @param that The object to be compared with.
81 * @return true if the given <code>TimeZone</code> objects are
82 * semantically unequal.
Claire Ho85bf2e22009-11-24 14:23:02 -080083 * @stable ICU 3.8
Jean-Baptiste Queruac04d0b2009-07-17 17:11:19 -070084 */
85 virtual UBool operator!=(const TimeZone& that) const;
86
87 /**
88 * Create a <code>VTimeZone</code> instance by the time zone ID.
89 * @param ID The time zone ID, such as America/New_York
90 * @return A <code>VTimeZone</code> object initialized by the time zone ID,
91 * or NULL when the ID is unknown.
Claire Ho85bf2e22009-11-24 14:23:02 -080092 * @stable ICU 3.8
Jean-Baptiste Queruac04d0b2009-07-17 17:11:19 -070093 */
94 static VTimeZone* createVTimeZoneByID(const UnicodeString& ID);
95
96 /**
claireho27f65472011-06-09 11:11:49 -070097 * Create a <code>VTimeZone</code> instance using a basic time zone.
98 * @param basicTZ The basic time zone instance
99 * @param status Output param to filled in with a success or an error.
100 * @return A <code>VTimeZone</code> object initialized by the basic time zone.
Craig Cornelius103e9ff2012-10-09 17:03:29 -0700101 * @stable ICU 4.6
claireho27f65472011-06-09 11:11:49 -0700102 */
103 static VTimeZone* createVTimeZoneFromBasicTimeZone(const BasicTimeZone& basicTZ,
104 UErrorCode &status);
105
106 /**
Jean-Baptiste Queruac04d0b2009-07-17 17:11:19 -0700107 * Create a <code>VTimeZone</code> instance by RFC2445 VTIMEZONE data
108 *
109 * @param vtzdata The string including VTIMEZONE data block
110 * @param status Output param to filled in with a success or an error.
111 * @return A <code>VTimeZone</code> initialized by the VTIMEZONE data or
112 * NULL if failed to load the rule from the VTIMEZONE data.
Claire Ho85bf2e22009-11-24 14:23:02 -0800113 * @stable ICU 3.8
Jean-Baptiste Queruac04d0b2009-07-17 17:11:19 -0700114 */
115 static VTimeZone* createVTimeZone(const UnicodeString& vtzdata, UErrorCode& status);
116
117 /**
118 * Gets the RFC2445 TZURL property value. When a <code>VTimeZone</code> instance was
119 * created from VTIMEZONE data, the initial value is set by the TZURL property value
120 * in the data. Otherwise, the initial value is not set.
121 * @param url Receives the RFC2445 TZURL property value.
Victor Chang978167a2021-01-18 17:56:33 +0000122 * @return true if TZURL attribute is available and value is set.
Claire Ho85bf2e22009-11-24 14:23:02 -0800123 * @stable ICU 3.8
Jean-Baptiste Queruac04d0b2009-07-17 17:11:19 -0700124 */
125 UBool getTZURL(UnicodeString& url) const;
126
127 /**
128 * Sets the RFC2445 TZURL property value.
129 * @param url The TZURL property value.
Claire Ho85bf2e22009-11-24 14:23:02 -0800130 * @stable ICU 3.8
Jean-Baptiste Queruac04d0b2009-07-17 17:11:19 -0700131 */
132 void setTZURL(const UnicodeString& url);
133
134 /**
135 * Gets the RFC2445 LAST-MODIFIED property value. When a <code>VTimeZone</code> instance
136 * was created from VTIMEZONE data, the initial value is set by the LAST-MODIFIED property
137 * value in the data. Otherwise, the initial value is not set.
138 * @param lastModified Receives the last modified date.
Victor Chang978167a2021-01-18 17:56:33 +0000139 * @return true if lastModified attribute is available and value is set.
Claire Ho85bf2e22009-11-24 14:23:02 -0800140 * @stable ICU 3.8
Jean-Baptiste Queruac04d0b2009-07-17 17:11:19 -0700141 */
142 UBool getLastModified(UDate& lastModified) const;
143
144 /**
145 * Sets the RFC2445 LAST-MODIFIED property value.
146 * @param lastModified The LAST-MODIFIED date.
Claire Ho85bf2e22009-11-24 14:23:02 -0800147 * @stable ICU 3.8
Jean-Baptiste Queruac04d0b2009-07-17 17:11:19 -0700148 */
149 void setLastModified(UDate lastModified);
150
151 /**
152 * Writes RFC2445 VTIMEZONE data for this time zone
153 * @param result Output param to filled in with the VTIMEZONE data.
154 * @param status Output param to filled in with a success or an error.
Claire Ho85bf2e22009-11-24 14:23:02 -0800155 * @stable ICU 3.8
Jean-Baptiste Queruac04d0b2009-07-17 17:11:19 -0700156 */
157 void write(UnicodeString& result, UErrorCode& status) const;
158
159 /**
160 * Writes RFC2445 VTIMEZONE data for this time zone applicalbe
161 * for dates after the specified start time.
162 * @param start The start date.
163 * @param result Output param to filled in with the VTIMEZONE data.
164 * @param status Output param to filled in with a success or an error.
Claire Ho85bf2e22009-11-24 14:23:02 -0800165 * @stable ICU 3.8
Jean-Baptiste Queruac04d0b2009-07-17 17:11:19 -0700166 */
Craig Cornelius83933352013-06-14 14:20:29 -0700167 void write(UDate start, UnicodeString& result, UErrorCode& status) const;
Jean-Baptiste Queruac04d0b2009-07-17 17:11:19 -0700168
169 /**
170 * Writes RFC2445 VTIMEZONE data applicalbe for the specified date.
171 * Some common iCalendar implementations can only handle a single time
172 * zone property or a pair of standard and daylight time properties using
173 * BYDAY rule with day of week (such as BYDAY=1SUN). This method produce
174 * the VTIMEZONE data which can be handled these implementations. The rules
175 * produced by this method can be used only for calculating time zone offset
176 * around the specified date.
177 * @param time The date used for rule extraction.
178 * @param result Output param to filled in with the VTIMEZONE data.
179 * @param status Output param to filled in with a success or an error.
Claire Ho85bf2e22009-11-24 14:23:02 -0800180 * @stable ICU 3.8
Jean-Baptiste Queruac04d0b2009-07-17 17:11:19 -0700181 */
Craig Cornelius83933352013-06-14 14:20:29 -0700182 void writeSimple(UDate time, UnicodeString& result, UErrorCode& status) const;
Jean-Baptiste Queruac04d0b2009-07-17 17:11:19 -0700183
184 /**
185 * Clones TimeZone objects polymorphically. Clients are responsible for deleting
186 * the TimeZone object cloned.
187 * @return A new copy of this TimeZone object.
Claire Ho85bf2e22009-11-24 14:23:02 -0800188 * @stable ICU 3.8
Jean-Baptiste Queruac04d0b2009-07-17 17:11:19 -0700189 */
Nikita Iashchenko4c0e2862019-11-05 16:38:00 +0000190 virtual VTimeZone* clone() const;
Jean-Baptiste Queruac04d0b2009-07-17 17:11:19 -0700191
192 /**
193 * Returns the TimeZone's adjusted GMT offset (i.e., the number of milliseconds to add
194 * to GMT to get local time in this time zone, taking daylight savings time into
195 * account) as of a particular reference date. The reference date is used to determine
196 * whether daylight savings time is in effect and needs to be figured into the offset
197 * that is returned (in other words, what is the adjusted GMT offset in this time zone
198 * at this particular date and time?). For the time zones produced by createTimeZone(),
199 * the reference data is specified according to the Gregorian calendar, and the date
200 * and time fields are local standard time.
201 *
202 * <p>Note: Don't call this method. Instead, call the getOffset(UDate...) overload,
203 * which returns both the raw and the DST offset for a given time. This method
204 * is retained only for backward compatibility.
205 *
206 * @param era The reference date's era
207 * @param year The reference date's year
208 * @param month The reference date's month (0-based; 0 is January)
209 * @param day The reference date's day-in-month (1-based)
210 * @param dayOfWeek The reference date's day-of-week (1-based; 1 is Sunday)
211 * @param millis The reference date's milliseconds in day, local standard time
212 * @param status Output param to filled in with a success or an error.
213 * @return The offset in milliseconds to add to GMT to get local time.
Claire Ho85bf2e22009-11-24 14:23:02 -0800214 * @stable ICU 3.8
Jean-Baptiste Queruac04d0b2009-07-17 17:11:19 -0700215 */
216 virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day,
217 uint8_t dayOfWeek, int32_t millis, UErrorCode& status) const;
218
219 /**
220 * Gets the time zone offset, for current date, modified in case of
221 * daylight savings. This is the offset to add *to* UTC to get local time.
222 *
223 * <p>Note: Don't call this method. Instead, call the getOffset(UDate...) overload,
224 * which returns both the raw and the DST offset for a given time. This method
225 * is retained only for backward compatibility.
226 *
227 * @param era The reference date's era
228 * @param year The reference date's year
229 * @param month The reference date's month (0-based; 0 is January)
230 * @param day The reference date's day-in-month (1-based)
231 * @param dayOfWeek The reference date's day-of-week (1-based; 1 is Sunday)
232 * @param millis The reference date's milliseconds in day, local standard time
233 * @param monthLength The length of the given month in days.
234 * @param status Output param to filled in with a success or an error.
235 * @return The offset in milliseconds to add to GMT to get local time.
Claire Ho85bf2e22009-11-24 14:23:02 -0800236 * @stable ICU 3.8
Jean-Baptiste Queruac04d0b2009-07-17 17:11:19 -0700237 */
238 virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day,
239 uint8_t dayOfWeek, int32_t millis,
240 int32_t monthLength, UErrorCode& status) const;
241
242 /**
243 * Returns the time zone raw and GMT offset for the given moment
244 * in time. Upon return, local-millis = GMT-millis + rawOffset +
245 * dstOffset. All computations are performed in the proleptic
246 * Gregorian calendar. The default implementation in the TimeZone
247 * class delegates to the 8-argument getOffset().
248 *
249 * @param date moment in time for which to return offsets, in
250 * units of milliseconds from January 1, 1970 0:00 GMT, either GMT
251 * time or local wall time, depending on `local'.
252 * @param local if true, `date' is local wall time; otherwise it
253 * is in GMT time.
254 * @param rawOffset output parameter to receive the raw offset, that
255 * is, the offset not including DST adjustments
256 * @param dstOffset output parameter to receive the DST offset,
257 * that is, the offset to be added to `rawOffset' to obtain the
258 * total offset between local and GMT time. If DST is not in
259 * effect, this value is zero; otherwise it is a positive value,
260 * typically one hour.
261 * @param ec input-output error code
Claire Ho85bf2e22009-11-24 14:23:02 -0800262 * @stable ICU 3.8
Jean-Baptiste Queruac04d0b2009-07-17 17:11:19 -0700263 */
264 virtual void getOffset(UDate date, UBool local, int32_t& rawOffset,
265 int32_t& dstOffset, UErrorCode& ec) const;
266
267 /**
268 * Sets the TimeZone's raw GMT offset (i.e., the number of milliseconds to add
269 * to GMT to get local time, before taking daylight savings time into account).
270 *
271 * @param offsetMillis The new raw GMT offset for this time zone.
Claire Ho85bf2e22009-11-24 14:23:02 -0800272 * @stable ICU 3.8
Jean-Baptiste Queruac04d0b2009-07-17 17:11:19 -0700273 */
274 virtual void setRawOffset(int32_t offsetMillis);
275
276 /**
277 * Returns the TimeZone's raw GMT offset (i.e., the number of milliseconds to add
278 * to GMT to get local time, before taking daylight savings time into account).
279 *
280 * @return The TimeZone's raw GMT offset.
Claire Ho85bf2e22009-11-24 14:23:02 -0800281 * @stable ICU 3.8
Jean-Baptiste Queruac04d0b2009-07-17 17:11:19 -0700282 */
283 virtual int32_t getRawOffset(void) const;
284
285 /**
286 * Queries if this time zone uses daylight savings time.
287 * @return true if this time zone uses daylight savings time,
288 * false, otherwise.
Claire Ho85bf2e22009-11-24 14:23:02 -0800289 * @stable ICU 3.8
Jean-Baptiste Queruac04d0b2009-07-17 17:11:19 -0700290 */
291 virtual UBool useDaylightTime(void) const;
292
Nikita Iashchenko4c0e2862019-11-05 16:38:00 +0000293#ifndef U_FORCE_HIDE_DEPRECATED_API
Jean-Baptiste Queruac04d0b2009-07-17 17:11:19 -0700294 /**
295 * Queries if the given date is in daylight savings time in
296 * this time zone.
297 * This method is wasteful since it creates a new GregorianCalendar and
298 * deletes it each time it is called. This is a deprecated method
299 * and provided only for Java compatibility.
300 *
301 * @param date the given UDate.
302 * @param status Output param filled in with success/error code.
303 * @return true if the given date is in daylight savings time,
304 * false, otherwise.
305 * @deprecated ICU 2.4. Use Calendar::inDaylightTime() instead.
306 */
307 virtual UBool inDaylightTime(UDate date, UErrorCode& status) const;
Nikita Iashchenko4c0e2862019-11-05 16:38:00 +0000308#endif // U_FORCE_HIDE_DEPRECATED_API
Jean-Baptiste Queruac04d0b2009-07-17 17:11:19 -0700309
310 /**
311 * Returns true if this zone has the same rule and offset as another zone.
312 * That is, if this zone differs only in ID, if at all.
313 * @param other the <code>TimeZone</code> object to be compared with
314 * @return true if the given zone is the same as this one,
315 * with the possible exception of the ID
Claire Ho85bf2e22009-11-24 14:23:02 -0800316 * @stable ICU 3.8
Jean-Baptiste Queruac04d0b2009-07-17 17:11:19 -0700317 */
318 virtual UBool hasSameRules(const TimeZone& other) const;
319
320 /**
321 * Gets the first time zone transition after the base time.
322 * @param base The base time.
323 * @param inclusive Whether the base time is inclusive or not.
324 * @param result Receives the first transition after the base time.
Victor Chang978167a2021-01-18 17:56:33 +0000325 * @return true if the transition is found.
Claire Ho85bf2e22009-11-24 14:23:02 -0800326 * @stable ICU 3.8
Jean-Baptiste Queruac04d0b2009-07-17 17:11:19 -0700327 */
Craig Cornelius83933352013-06-14 14:20:29 -0700328 virtual UBool getNextTransition(UDate base, UBool inclusive, TimeZoneTransition& result) const;
Jean-Baptiste Queruac04d0b2009-07-17 17:11:19 -0700329
330 /**
331 * Gets the most recent time zone transition before the base time.
332 * @param base The base time.
333 * @param inclusive Whether the base time is inclusive or not.
334 * @param result Receives the most recent transition before the base time.
Victor Chang978167a2021-01-18 17:56:33 +0000335 * @return true if the transition is found.
Claire Ho85bf2e22009-11-24 14:23:02 -0800336 * @stable ICU 3.8
Jean-Baptiste Queruac04d0b2009-07-17 17:11:19 -0700337 */
Craig Cornelius83933352013-06-14 14:20:29 -0700338 virtual UBool getPreviousTransition(UDate base, UBool inclusive, TimeZoneTransition& result) const;
Jean-Baptiste Queruac04d0b2009-07-17 17:11:19 -0700339
340 /**
341 * Returns the number of <code>TimeZoneRule</code>s which represents time transitions,
342 * for this time zone, that is, all <code>TimeZoneRule</code>s for this time zone except
343 * <code>InitialTimeZoneRule</code>. The return value range is 0 or any positive value.
344 * @param status Receives error status code.
345 * @return The number of <code>TimeZoneRule</code>s representing time transitions.
Claire Ho85bf2e22009-11-24 14:23:02 -0800346 * @stable ICU 3.8
Jean-Baptiste Queruac04d0b2009-07-17 17:11:19 -0700347 */
Craig Cornelius83933352013-06-14 14:20:29 -0700348 virtual int32_t countTransitionRules(UErrorCode& status) const;
Jean-Baptiste Queruac04d0b2009-07-17 17:11:19 -0700349
350 /**
351 * Gets the <code>InitialTimeZoneRule</code> and the set of <code>TimeZoneRule</code>
352 * which represent time transitions for this time zone. On successful return,
353 * the argument initial points to non-NULL <code>InitialTimeZoneRule</code> and
354 * the array trsrules is filled with 0 or multiple <code>TimeZoneRule</code>
355 * instances up to the size specified by trscount. The results are referencing the
356 * rule instance held by this time zone instance. Therefore, after this time zone
357 * is destructed, they are no longer available.
358 * @param initial Receives the initial timezone rule
359 * @param trsrules Receives the timezone transition rules
360 * @param trscount On input, specify the size of the array 'transitions' receiving
361 * the timezone transition rules. On output, actual number of
362 * rules filled in the array will be set.
363 * @param status Receives error status code.
Claire Ho85bf2e22009-11-24 14:23:02 -0800364 * @stable ICU 3.8
Jean-Baptiste Queruac04d0b2009-07-17 17:11:19 -0700365 */
366 virtual void getTimeZoneRules(const InitialTimeZoneRule*& initial,
Craig Cornelius83933352013-06-14 14:20:29 -0700367 const TimeZoneRule* trsrules[], int32_t& trscount, UErrorCode& status) const;
Jean-Baptiste Queruac04d0b2009-07-17 17:11:19 -0700368
369private:
370 enum { DEFAULT_VTIMEZONE_LINES = 100 };
371
372 /**
373 * Default constructor.
374 */
375 VTimeZone();
376 static VTimeZone* createVTimeZone(VTZReader* reader);
377 void write(VTZWriter& writer, UErrorCode& status) const;
Craig Cornelius83933352013-06-14 14:20:29 -0700378 void write(UDate start, VTZWriter& writer, UErrorCode& status) const;
379 void writeSimple(UDate time, VTZWriter& writer, UErrorCode& status) const;
Jean-Baptiste Queruac04d0b2009-07-17 17:11:19 -0700380 void load(VTZReader& reader, UErrorCode& status);
381 void parse(UErrorCode& status);
382
383 void writeZone(VTZWriter& w, BasicTimeZone& basictz, UVector* customProps,
384 UErrorCode& status) const;
385
386 void writeHeaders(VTZWriter& w, UErrorCode& status) const;
387 void writeFooter(VTZWriter& writer, UErrorCode& status) const;
388
Claire Ho85bf2e22009-11-24 14:23:02 -0800389 void writeZonePropsByTime(VTZWriter& writer, UBool isDst, const UnicodeString& zonename,
Jean-Baptiste Queruac04d0b2009-07-17 17:11:19 -0700390 int32_t fromOffset, int32_t toOffset, UDate time, UBool withRDATE,
391 UErrorCode& status) const;
Claire Ho85bf2e22009-11-24 14:23:02 -0800392 void writeZonePropsByDOM(VTZWriter& writer, UBool isDst, const UnicodeString& zonename,
Jean-Baptiste Queruac04d0b2009-07-17 17:11:19 -0700393 int32_t fromOffset, int32_t toOffset,
394 int32_t month, int32_t dayOfMonth, UDate startTime, UDate untilTime,
395 UErrorCode& status) const;
Claire Ho85bf2e22009-11-24 14:23:02 -0800396 void writeZonePropsByDOW(VTZWriter& writer, UBool isDst, const UnicodeString& zonename,
Jean-Baptiste Queruac04d0b2009-07-17 17:11:19 -0700397 int32_t fromOffset, int32_t toOffset,
398 int32_t month, int32_t weekInMonth, int32_t dayOfWeek,
399 UDate startTime, UDate untilTime, UErrorCode& status) const;
Claire Ho85bf2e22009-11-24 14:23:02 -0800400 void writeZonePropsByDOW_GEQ_DOM(VTZWriter& writer, UBool isDst, const UnicodeString& zonename,
Jean-Baptiste Queruac04d0b2009-07-17 17:11:19 -0700401 int32_t fromOffset, int32_t toOffset,
402 int32_t month, int32_t dayOfMonth, int32_t dayOfWeek,
403 UDate startTime, UDate untilTime, UErrorCode& status) const;
404 void writeZonePropsByDOW_GEQ_DOM_sub(VTZWriter& writer, int32_t month, int32_t dayOfMonth,
405 int32_t dayOfWeek, int32_t numDays,
406 UDate untilTime, int32_t fromOffset, UErrorCode& status) const;
Claire Ho85bf2e22009-11-24 14:23:02 -0800407 void writeZonePropsByDOW_LEQ_DOM(VTZWriter& writer, UBool isDst, const UnicodeString& zonename,
Jean-Baptiste Queruac04d0b2009-07-17 17:11:19 -0700408 int32_t fromOffset, int32_t toOffset,
409 int32_t month, int32_t dayOfMonth, int32_t dayOfWeek,
410 UDate startTime, UDate untilTime, UErrorCode& status) const;
411 void writeFinalRule(VTZWriter& writer, UBool isDst, const AnnualTimeZoneRule* rule,
412 int32_t fromRawOffset, int32_t fromDSTSavings,
413 UDate startTime, UErrorCode& status) const;
414
Claire Ho85bf2e22009-11-24 14:23:02 -0800415 void beginZoneProps(VTZWriter& writer, UBool isDst, const UnicodeString& zonename,
Jean-Baptiste Queruac04d0b2009-07-17 17:11:19 -0700416 int32_t fromOffset, int32_t toOffset, UDate startTime, UErrorCode& status) const;
417 void endZoneProps(VTZWriter& writer, UBool isDst, UErrorCode& status) const;
418 void beginRRULE(VTZWriter& writer, int32_t month, UErrorCode& status) const;
419 void appendUNTIL(VTZWriter& writer, const UnicodeString& until, UErrorCode& status) const;
420
421 BasicTimeZone *tz;
422 UVector *vtzlines;
423 UnicodeString tzurl;
424 UDate lastmod;
425 UnicodeString olsonzid;
426 UnicodeString icutzver;
427
428public:
429 /**
430 * Return the class ID for this class. This is useful only for comparing to
431 * a return value from getDynamicClassID(). For example:
432 * <pre>
433 * . Base* polymorphic_pointer = createPolymorphicObject();
434 * . if (polymorphic_pointer->getDynamicClassID() ==
435 * . erived::getStaticClassID()) ...
436 * </pre>
437 * @return The class ID for all objects of this class.
Claire Ho85bf2e22009-11-24 14:23:02 -0800438 * @stable ICU 3.8
Jean-Baptiste Queruac04d0b2009-07-17 17:11:19 -0700439 */
440 static UClassID U_EXPORT2 getStaticClassID(void);
441
442 /**
443 * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This
444 * method is to implement a simple version of RTTI, since not all C++
445 * compilers support genuine RTTI. Polymorphic operator==() and clone()
446 * methods call this method.
447 *
448 * @return The class ID for this object. All objects of a
449 * given class have the same class ID. Objects of
450 * other classes have different class IDs.
Claire Ho85bf2e22009-11-24 14:23:02 -0800451 * @stable ICU 3.8
Jean-Baptiste Queruac04d0b2009-07-17 17:11:19 -0700452 */
453 virtual UClassID getDynamicClassID(void) const;
454};
455
456U_NAMESPACE_END
457
458#endif /* #if !UCONFIG_NO_FORMATTING */
459
Nikita Iashchenko4c0e2862019-11-05 16:38:00 +0000460#endif /* U_SHOW_CPLUSPLUS_API */
461
Jean-Baptiste Queruac04d0b2009-07-17 17:11:19 -0700462#endif // VTZONE_H
463//eof