jpayne@69
|
1 // © 2016 and later: Unicode, Inc. and others.
|
jpayne@69
|
2 // License & terms of use: http://www.unicode.org/copyright.html
|
jpayne@69
|
3 /*
|
jpayne@69
|
4 *******************************************************************************
|
jpayne@69
|
5 * Copyright (C) 2007-2013, International Business Machines Corporation and
|
jpayne@69
|
6 * others. All Rights Reserved.
|
jpayne@69
|
7 *******************************************************************************
|
jpayne@69
|
8 */
|
jpayne@69
|
9 #ifndef VTZONE_H
|
jpayne@69
|
10 #define VTZONE_H
|
jpayne@69
|
11
|
jpayne@69
|
12 #include "unicode/utypes.h"
|
jpayne@69
|
13
|
jpayne@69
|
14 #if U_SHOW_CPLUSPLUS_API
|
jpayne@69
|
15
|
jpayne@69
|
16 /**
|
jpayne@69
|
17 * \file
|
jpayne@69
|
18 * \brief C++ API: RFC2445 VTIMEZONE support
|
jpayne@69
|
19 */
|
jpayne@69
|
20
|
jpayne@69
|
21 #if !UCONFIG_NO_FORMATTING
|
jpayne@69
|
22
|
jpayne@69
|
23 #include "unicode/basictz.h"
|
jpayne@69
|
24
|
jpayne@69
|
25 U_NAMESPACE_BEGIN
|
jpayne@69
|
26
|
jpayne@69
|
27 class VTZWriter;
|
jpayne@69
|
28 class VTZReader;
|
jpayne@69
|
29 class UVector;
|
jpayne@69
|
30
|
jpayne@69
|
31 /**
|
jpayne@69
|
32 * <code>VTimeZone</code> is a class implementing RFC2445 VTIMEZONE. You can create a
|
jpayne@69
|
33 * <code>VTimeZone</code> instance from a time zone ID supported by <code>TimeZone</code>.
|
jpayne@69
|
34 * With the <code>VTimeZone</code> instance created from the ID, you can write out the rule
|
jpayne@69
|
35 * in RFC2445 VTIMEZONE format. Also, you can create a <code>VTimeZone</code> instance
|
jpayne@69
|
36 * from RFC2445 VTIMEZONE data stream, which allows you to calculate time
|
jpayne@69
|
37 * zone offset by the rules defined by the data. Or, you can create a
|
jpayne@69
|
38 * <code>VTimeZone</code> from any other ICU <code>BasicTimeZone</code>.
|
jpayne@69
|
39 * <br><br>
|
jpayne@69
|
40 * Note: The consumer of this class reading or writing VTIMEZONE data is responsible to
|
jpayne@69
|
41 * decode or encode Non-ASCII text. Methods reading/writing VTIMEZONE data in this class
|
jpayne@69
|
42 * do nothing with MIME encoding.
|
jpayne@69
|
43 * @stable ICU 3.8
|
jpayne@69
|
44 */
|
jpayne@69
|
45 class U_I18N_API VTimeZone : public BasicTimeZone {
|
jpayne@69
|
46 public:
|
jpayne@69
|
47 /**
|
jpayne@69
|
48 * Copy constructor.
|
jpayne@69
|
49 * @param source The <code>VTimeZone</code> object to be copied.
|
jpayne@69
|
50 * @stable ICU 3.8
|
jpayne@69
|
51 */
|
jpayne@69
|
52 VTimeZone(const VTimeZone& source);
|
jpayne@69
|
53
|
jpayne@69
|
54 /**
|
jpayne@69
|
55 * Destructor.
|
jpayne@69
|
56 * @stable ICU 3.8
|
jpayne@69
|
57 */
|
jpayne@69
|
58 virtual ~VTimeZone();
|
jpayne@69
|
59
|
jpayne@69
|
60 /**
|
jpayne@69
|
61 * Assignment operator.
|
jpayne@69
|
62 * @param right The object to be copied.
|
jpayne@69
|
63 * @stable ICU 3.8
|
jpayne@69
|
64 */
|
jpayne@69
|
65 VTimeZone& operator=(const VTimeZone& right);
|
jpayne@69
|
66
|
jpayne@69
|
67 /**
|
jpayne@69
|
68 * Return true if the given <code>TimeZone</code> objects are
|
jpayne@69
|
69 * semantically equal. Objects of different subclasses are considered unequal.
|
jpayne@69
|
70 * @param that The object to be compared with.
|
jpayne@69
|
71 * @return true if the given <code>TimeZone</code> objects are
|
jpayne@69
|
72 *semantically equal.
|
jpayne@69
|
73 * @stable ICU 3.8
|
jpayne@69
|
74 */
|
jpayne@69
|
75 virtual UBool operator==(const TimeZone& that) const;
|
jpayne@69
|
76
|
jpayne@69
|
77 /**
|
jpayne@69
|
78 * Return true if the given <code>TimeZone</code> objects are
|
jpayne@69
|
79 * semantically unequal. Objects of different subclasses are considered unequal.
|
jpayne@69
|
80 * @param that The object to be compared with.
|
jpayne@69
|
81 * @return true if the given <code>TimeZone</code> objects are
|
jpayne@69
|
82 * semantically unequal.
|
jpayne@69
|
83 * @stable ICU 3.8
|
jpayne@69
|
84 */
|
jpayne@69
|
85 virtual UBool operator!=(const TimeZone& that) const;
|
jpayne@69
|
86
|
jpayne@69
|
87 /**
|
jpayne@69
|
88 * Create a <code>VTimeZone</code> instance by the time zone ID.
|
jpayne@69
|
89 * @param ID The time zone ID, such as America/New_York
|
jpayne@69
|
90 * @return A <code>VTimeZone</code> object initialized by the time zone ID,
|
jpayne@69
|
91 * or NULL when the ID is unknown.
|
jpayne@69
|
92 * @stable ICU 3.8
|
jpayne@69
|
93 */
|
jpayne@69
|
94 static VTimeZone* createVTimeZoneByID(const UnicodeString& ID);
|
jpayne@69
|
95
|
jpayne@69
|
96 /**
|
jpayne@69
|
97 * Create a <code>VTimeZone</code> instance using a basic time zone.
|
jpayne@69
|
98 * @param basicTZ The basic time zone instance
|
jpayne@69
|
99 * @param status Output param to filled in with a success or an error.
|
jpayne@69
|
100 * @return A <code>VTimeZone</code> object initialized by the basic time zone.
|
jpayne@69
|
101 * @stable ICU 4.6
|
jpayne@69
|
102 */
|
jpayne@69
|
103 static VTimeZone* createVTimeZoneFromBasicTimeZone(const BasicTimeZone& basicTZ,
|
jpayne@69
|
104 UErrorCode &status);
|
jpayne@69
|
105
|
jpayne@69
|
106 /**
|
jpayne@69
|
107 * Create a <code>VTimeZone</code> instance by RFC2445 VTIMEZONE data
|
jpayne@69
|
108 *
|
jpayne@69
|
109 * @param vtzdata The string including VTIMEZONE data block
|
jpayne@69
|
110 * @param status Output param to filled in with a success or an error.
|
jpayne@69
|
111 * @return A <code>VTimeZone</code> initialized by the VTIMEZONE data or
|
jpayne@69
|
112 * NULL if failed to load the rule from the VTIMEZONE data.
|
jpayne@69
|
113 * @stable ICU 3.8
|
jpayne@69
|
114 */
|
jpayne@69
|
115 static VTimeZone* createVTimeZone(const UnicodeString& vtzdata, UErrorCode& status);
|
jpayne@69
|
116
|
jpayne@69
|
117 /**
|
jpayne@69
|
118 * Gets the RFC2445 TZURL property value. When a <code>VTimeZone</code> instance was
|
jpayne@69
|
119 * created from VTIMEZONE data, the initial value is set by the TZURL property value
|
jpayne@69
|
120 * in the data. Otherwise, the initial value is not set.
|
jpayne@69
|
121 * @param url Receives the RFC2445 TZURL property value.
|
jpayne@69
|
122 * @return TRUE if TZURL attribute is available and value is set.
|
jpayne@69
|
123 * @stable ICU 3.8
|
jpayne@69
|
124 */
|
jpayne@69
|
125 UBool getTZURL(UnicodeString& url) const;
|
jpayne@69
|
126
|
jpayne@69
|
127 /**
|
jpayne@69
|
128 * Sets the RFC2445 TZURL property value.
|
jpayne@69
|
129 * @param url The TZURL property value.
|
jpayne@69
|
130 * @stable ICU 3.8
|
jpayne@69
|
131 */
|
jpayne@69
|
132 void setTZURL(const UnicodeString& url);
|
jpayne@69
|
133
|
jpayne@69
|
134 /**
|
jpayne@69
|
135 * Gets the RFC2445 LAST-MODIFIED property value. When a <code>VTimeZone</code> instance
|
jpayne@69
|
136 * was created from VTIMEZONE data, the initial value is set by the LAST-MODIFIED property
|
jpayne@69
|
137 * value in the data. Otherwise, the initial value is not set.
|
jpayne@69
|
138 * @param lastModified Receives the last modified date.
|
jpayne@69
|
139 * @return TRUE if lastModified attribute is available and value is set.
|
jpayne@69
|
140 * @stable ICU 3.8
|
jpayne@69
|
141 */
|
jpayne@69
|
142 UBool getLastModified(UDate& lastModified) const;
|
jpayne@69
|
143
|
jpayne@69
|
144 /**
|
jpayne@69
|
145 * Sets the RFC2445 LAST-MODIFIED property value.
|
jpayne@69
|
146 * @param lastModified The LAST-MODIFIED date.
|
jpayne@69
|
147 * @stable ICU 3.8
|
jpayne@69
|
148 */
|
jpayne@69
|
149 void setLastModified(UDate lastModified);
|
jpayne@69
|
150
|
jpayne@69
|
151 /**
|
jpayne@69
|
152 * Writes RFC2445 VTIMEZONE data for this time zone
|
jpayne@69
|
153 * @param result Output param to filled in with the VTIMEZONE data.
|
jpayne@69
|
154 * @param status Output param to filled in with a success or an error.
|
jpayne@69
|
155 * @stable ICU 3.8
|
jpayne@69
|
156 */
|
jpayne@69
|
157 void write(UnicodeString& result, UErrorCode& status) const;
|
jpayne@69
|
158
|
jpayne@69
|
159 /**
|
jpayne@69
|
160 * Writes RFC2445 VTIMEZONE data for this time zone applicalbe
|
jpayne@69
|
161 * for dates after the specified start time.
|
jpayne@69
|
162 * @param start The start date.
|
jpayne@69
|
163 * @param result Output param to filled in with the VTIMEZONE data.
|
jpayne@69
|
164 * @param status Output param to filled in with a success or an error.
|
jpayne@69
|
165 * @stable ICU 3.8
|
jpayne@69
|
166 */
|
jpayne@69
|
167 void write(UDate start, UnicodeString& result, UErrorCode& status) const;
|
jpayne@69
|
168
|
jpayne@69
|
169 /**
|
jpayne@69
|
170 * Writes RFC2445 VTIMEZONE data applicalbe for the specified date.
|
jpayne@69
|
171 * Some common iCalendar implementations can only handle a single time
|
jpayne@69
|
172 * zone property or a pair of standard and daylight time properties using
|
jpayne@69
|
173 * BYDAY rule with day of week (such as BYDAY=1SUN). This method produce
|
jpayne@69
|
174 * the VTIMEZONE data which can be handled these implementations. The rules
|
jpayne@69
|
175 * produced by this method can be used only for calculating time zone offset
|
jpayne@69
|
176 * around the specified date.
|
jpayne@69
|
177 * @param time The date used for rule extraction.
|
jpayne@69
|
178 * @param result Output param to filled in with the VTIMEZONE data.
|
jpayne@69
|
179 * @param status Output param to filled in with a success or an error.
|
jpayne@69
|
180 * @stable ICU 3.8
|
jpayne@69
|
181 */
|
jpayne@69
|
182 void writeSimple(UDate time, UnicodeString& result, UErrorCode& status) const;
|
jpayne@69
|
183
|
jpayne@69
|
184 /**
|
jpayne@69
|
185 * Clones TimeZone objects polymorphically. Clients are responsible for deleting
|
jpayne@69
|
186 * the TimeZone object cloned.
|
jpayne@69
|
187 * @return A new copy of this TimeZone object.
|
jpayne@69
|
188 * @stable ICU 3.8
|
jpayne@69
|
189 */
|
jpayne@69
|
190 virtual VTimeZone* clone() const;
|
jpayne@69
|
191
|
jpayne@69
|
192 /**
|
jpayne@69
|
193 * Returns the TimeZone's adjusted GMT offset (i.e., the number of milliseconds to add
|
jpayne@69
|
194 * to GMT to get local time in this time zone, taking daylight savings time into
|
jpayne@69
|
195 * account) as of a particular reference date. The reference date is used to determine
|
jpayne@69
|
196 * whether daylight savings time is in effect and needs to be figured into the offset
|
jpayne@69
|
197 * that is returned (in other words, what is the adjusted GMT offset in this time zone
|
jpayne@69
|
198 * at this particular date and time?). For the time zones produced by createTimeZone(),
|
jpayne@69
|
199 * the reference data is specified according to the Gregorian calendar, and the date
|
jpayne@69
|
200 * and time fields are local standard time.
|
jpayne@69
|
201 *
|
jpayne@69
|
202 * <p>Note: Don't call this method. Instead, call the getOffset(UDate...) overload,
|
jpayne@69
|
203 * which returns both the raw and the DST offset for a given time. This method
|
jpayne@69
|
204 * is retained only for backward compatibility.
|
jpayne@69
|
205 *
|
jpayne@69
|
206 * @param era The reference date's era
|
jpayne@69
|
207 * @param year The reference date's year
|
jpayne@69
|
208 * @param month The reference date's month (0-based; 0 is January)
|
jpayne@69
|
209 * @param day The reference date's day-in-month (1-based)
|
jpayne@69
|
210 * @param dayOfWeek The reference date's day-of-week (1-based; 1 is Sunday)
|
jpayne@69
|
211 * @param millis The reference date's milliseconds in day, local standard time
|
jpayne@69
|
212 * @param status Output param to filled in with a success or an error.
|
jpayne@69
|
213 * @return The offset in milliseconds to add to GMT to get local time.
|
jpayne@69
|
214 * @stable ICU 3.8
|
jpayne@69
|
215 */
|
jpayne@69
|
216 virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day,
|
jpayne@69
|
217 uint8_t dayOfWeek, int32_t millis, UErrorCode& status) const;
|
jpayne@69
|
218
|
jpayne@69
|
219 /**
|
jpayne@69
|
220 * Gets the time zone offset, for current date, modified in case of
|
jpayne@69
|
221 * daylight savings. This is the offset to add *to* UTC to get local time.
|
jpayne@69
|
222 *
|
jpayne@69
|
223 * <p>Note: Don't call this method. Instead, call the getOffset(UDate...) overload,
|
jpayne@69
|
224 * which returns both the raw and the DST offset for a given time. This method
|
jpayne@69
|
225 * is retained only for backward compatibility.
|
jpayne@69
|
226 *
|
jpayne@69
|
227 * @param era The reference date's era
|
jpayne@69
|
228 * @param year The reference date's year
|
jpayne@69
|
229 * @param month The reference date's month (0-based; 0 is January)
|
jpayne@69
|
230 * @param day The reference date's day-in-month (1-based)
|
jpayne@69
|
231 * @param dayOfWeek The reference date's day-of-week (1-based; 1 is Sunday)
|
jpayne@69
|
232 * @param millis The reference date's milliseconds in day, local standard time
|
jpayne@69
|
233 * @param monthLength The length of the given month in days.
|
jpayne@69
|
234 * @param status Output param to filled in with a success or an error.
|
jpayne@69
|
235 * @return The offset in milliseconds to add to GMT to get local time.
|
jpayne@69
|
236 * @stable ICU 3.8
|
jpayne@69
|
237 */
|
jpayne@69
|
238 virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day,
|
jpayne@69
|
239 uint8_t dayOfWeek, int32_t millis,
|
jpayne@69
|
240 int32_t monthLength, UErrorCode& status) const;
|
jpayne@69
|
241
|
jpayne@69
|
242 /**
|
jpayne@69
|
243 * Returns the time zone raw and GMT offset for the given moment
|
jpayne@69
|
244 * in time. Upon return, local-millis = GMT-millis + rawOffset +
|
jpayne@69
|
245 * dstOffset. All computations are performed in the proleptic
|
jpayne@69
|
246 * Gregorian calendar. The default implementation in the TimeZone
|
jpayne@69
|
247 * class delegates to the 8-argument getOffset().
|
jpayne@69
|
248 *
|
jpayne@69
|
249 * @param date moment in time for which to return offsets, in
|
jpayne@69
|
250 * units of milliseconds from January 1, 1970 0:00 GMT, either GMT
|
jpayne@69
|
251 * time or local wall time, depending on `local'.
|
jpayne@69
|
252 * @param local if true, `date' is local wall time; otherwise it
|
jpayne@69
|
253 * is in GMT time.
|
jpayne@69
|
254 * @param rawOffset output parameter to receive the raw offset, that
|
jpayne@69
|
255 * is, the offset not including DST adjustments
|
jpayne@69
|
256 * @param dstOffset output parameter to receive the DST offset,
|
jpayne@69
|
257 * that is, the offset to be added to `rawOffset' to obtain the
|
jpayne@69
|
258 * total offset between local and GMT time. If DST is not in
|
jpayne@69
|
259 * effect, this value is zero; otherwise it is a positive value,
|
jpayne@69
|
260 * typically one hour.
|
jpayne@69
|
261 * @param ec input-output error code
|
jpayne@69
|
262 * @stable ICU 3.8
|
jpayne@69
|
263 */
|
jpayne@69
|
264 virtual void getOffset(UDate date, UBool local, int32_t& rawOffset,
|
jpayne@69
|
265 int32_t& dstOffset, UErrorCode& ec) const;
|
jpayne@69
|
266
|
jpayne@69
|
267 /**
|
jpayne@69
|
268 * Sets the TimeZone's raw GMT offset (i.e., the number of milliseconds to add
|
jpayne@69
|
269 * to GMT to get local time, before taking daylight savings time into account).
|
jpayne@69
|
270 *
|
jpayne@69
|
271 * @param offsetMillis The new raw GMT offset for this time zone.
|
jpayne@69
|
272 * @stable ICU 3.8
|
jpayne@69
|
273 */
|
jpayne@69
|
274 virtual void setRawOffset(int32_t offsetMillis);
|
jpayne@69
|
275
|
jpayne@69
|
276 /**
|
jpayne@69
|
277 * Returns the TimeZone's raw GMT offset (i.e., the number of milliseconds to add
|
jpayne@69
|
278 * to GMT to get local time, before taking daylight savings time into account).
|
jpayne@69
|
279 *
|
jpayne@69
|
280 * @return The TimeZone's raw GMT offset.
|
jpayne@69
|
281 * @stable ICU 3.8
|
jpayne@69
|
282 */
|
jpayne@69
|
283 virtual int32_t getRawOffset(void) const;
|
jpayne@69
|
284
|
jpayne@69
|
285 /**
|
jpayne@69
|
286 * Queries if this time zone uses daylight savings time.
|
jpayne@69
|
287 * @return true if this time zone uses daylight savings time,
|
jpayne@69
|
288 * false, otherwise.
|
jpayne@69
|
289 * @stable ICU 3.8
|
jpayne@69
|
290 */
|
jpayne@69
|
291 virtual UBool useDaylightTime(void) const;
|
jpayne@69
|
292
|
jpayne@69
|
293 #ifndef U_FORCE_HIDE_DEPRECATED_API
|
jpayne@69
|
294 /**
|
jpayne@69
|
295 * Queries if the given date is in daylight savings time in
|
jpayne@69
|
296 * this time zone.
|
jpayne@69
|
297 * This method is wasteful since it creates a new GregorianCalendar and
|
jpayne@69
|
298 * deletes it each time it is called. This is a deprecated method
|
jpayne@69
|
299 * and provided only for Java compatibility.
|
jpayne@69
|
300 *
|
jpayne@69
|
301 * @param date the given UDate.
|
jpayne@69
|
302 * @param status Output param filled in with success/error code.
|
jpayne@69
|
303 * @return true if the given date is in daylight savings time,
|
jpayne@69
|
304 * false, otherwise.
|
jpayne@69
|
305 * @deprecated ICU 2.4. Use Calendar::inDaylightTime() instead.
|
jpayne@69
|
306 */
|
jpayne@69
|
307 virtual UBool inDaylightTime(UDate date, UErrorCode& status) const;
|
jpayne@69
|
308 #endif // U_FORCE_HIDE_DEPRECATED_API
|
jpayne@69
|
309
|
jpayne@69
|
310 /**
|
jpayne@69
|
311 * Returns true if this zone has the same rule and offset as another zone.
|
jpayne@69
|
312 * That is, if this zone differs only in ID, if at all.
|
jpayne@69
|
313 * @param other the <code>TimeZone</code> object to be compared with
|
jpayne@69
|
314 * @return true if the given zone is the same as this one,
|
jpayne@69
|
315 * with the possible exception of the ID
|
jpayne@69
|
316 * @stable ICU 3.8
|
jpayne@69
|
317 */
|
jpayne@69
|
318 virtual UBool hasSameRules(const TimeZone& other) const;
|
jpayne@69
|
319
|
jpayne@69
|
320 /**
|
jpayne@69
|
321 * Gets the first time zone transition after the base time.
|
jpayne@69
|
322 * @param base The base time.
|
jpayne@69
|
323 * @param inclusive Whether the base time is inclusive or not.
|
jpayne@69
|
324 * @param result Receives the first transition after the base time.
|
jpayne@69
|
325 * @return TRUE if the transition is found.
|
jpayne@69
|
326 * @stable ICU 3.8
|
jpayne@69
|
327 */
|
jpayne@69
|
328 virtual UBool getNextTransition(UDate base, UBool inclusive, TimeZoneTransition& result) const;
|
jpayne@69
|
329
|
jpayne@69
|
330 /**
|
jpayne@69
|
331 * Gets the most recent time zone transition before the base time.
|
jpayne@69
|
332 * @param base The base time.
|
jpayne@69
|
333 * @param inclusive Whether the base time is inclusive or not.
|
jpayne@69
|
334 * @param result Receives the most recent transition before the base time.
|
jpayne@69
|
335 * @return TRUE if the transition is found.
|
jpayne@69
|
336 * @stable ICU 3.8
|
jpayne@69
|
337 */
|
jpayne@69
|
338 virtual UBool getPreviousTransition(UDate base, UBool inclusive, TimeZoneTransition& result) const;
|
jpayne@69
|
339
|
jpayne@69
|
340 /**
|
jpayne@69
|
341 * Returns the number of <code>TimeZoneRule</code>s which represents time transitions,
|
jpayne@69
|
342 * for this time zone, that is, all <code>TimeZoneRule</code>s for this time zone except
|
jpayne@69
|
343 * <code>InitialTimeZoneRule</code>. The return value range is 0 or any positive value.
|
jpayne@69
|
344 * @param status Receives error status code.
|
jpayne@69
|
345 * @return The number of <code>TimeZoneRule</code>s representing time transitions.
|
jpayne@69
|
346 * @stable ICU 3.8
|
jpayne@69
|
347 */
|
jpayne@69
|
348 virtual int32_t countTransitionRules(UErrorCode& status) const;
|
jpayne@69
|
349
|
jpayne@69
|
350 /**
|
jpayne@69
|
351 * Gets the <code>InitialTimeZoneRule</code> and the set of <code>TimeZoneRule</code>
|
jpayne@69
|
352 * which represent time transitions for this time zone. On successful return,
|
jpayne@69
|
353 * the argument initial points to non-NULL <code>InitialTimeZoneRule</code> and
|
jpayne@69
|
354 * the array trsrules is filled with 0 or multiple <code>TimeZoneRule</code>
|
jpayne@69
|
355 * instances up to the size specified by trscount. The results are referencing the
|
jpayne@69
|
356 * rule instance held by this time zone instance. Therefore, after this time zone
|
jpayne@69
|
357 * is destructed, they are no longer available.
|
jpayne@69
|
358 * @param initial Receives the initial timezone rule
|
jpayne@69
|
359 * @param trsrules Receives the timezone transition rules
|
jpayne@69
|
360 * @param trscount On input, specify the size of the array 'transitions' receiving
|
jpayne@69
|
361 * the timezone transition rules. On output, actual number of
|
jpayne@69
|
362 * rules filled in the array will be set.
|
jpayne@69
|
363 * @param status Receives error status code.
|
jpayne@69
|
364 * @stable ICU 3.8
|
jpayne@69
|
365 */
|
jpayne@69
|
366 virtual void getTimeZoneRules(const InitialTimeZoneRule*& initial,
|
jpayne@69
|
367 const TimeZoneRule* trsrules[], int32_t& trscount, UErrorCode& status) const;
|
jpayne@69
|
368
|
jpayne@69
|
369 private:
|
jpayne@69
|
370 enum { DEFAULT_VTIMEZONE_LINES = 100 };
|
jpayne@69
|
371
|
jpayne@69
|
372 /**
|
jpayne@69
|
373 * Default constructor.
|
jpayne@69
|
374 */
|
jpayne@69
|
375 VTimeZone();
|
jpayne@69
|
376 static VTimeZone* createVTimeZone(VTZReader* reader);
|
jpayne@69
|
377 void write(VTZWriter& writer, UErrorCode& status) const;
|
jpayne@69
|
378 void write(UDate start, VTZWriter& writer, UErrorCode& status) const;
|
jpayne@69
|
379 void writeSimple(UDate time, VTZWriter& writer, UErrorCode& status) const;
|
jpayne@69
|
380 void load(VTZReader& reader, UErrorCode& status);
|
jpayne@69
|
381 void parse(UErrorCode& status);
|
jpayne@69
|
382
|
jpayne@69
|
383 void writeZone(VTZWriter& w, BasicTimeZone& basictz, UVector* customProps,
|
jpayne@69
|
384 UErrorCode& status) const;
|
jpayne@69
|
385
|
jpayne@69
|
386 void writeHeaders(VTZWriter& w, UErrorCode& status) const;
|
jpayne@69
|
387 void writeFooter(VTZWriter& writer, UErrorCode& status) const;
|
jpayne@69
|
388
|
jpayne@69
|
389 void writeZonePropsByTime(VTZWriter& writer, UBool isDst, const UnicodeString& zonename,
|
jpayne@69
|
390 int32_t fromOffset, int32_t toOffset, UDate time, UBool withRDATE,
|
jpayne@69
|
391 UErrorCode& status) const;
|
jpayne@69
|
392 void writeZonePropsByDOM(VTZWriter& writer, UBool isDst, const UnicodeString& zonename,
|
jpayne@69
|
393 int32_t fromOffset, int32_t toOffset,
|
jpayne@69
|
394 int32_t month, int32_t dayOfMonth, UDate startTime, UDate untilTime,
|
jpayne@69
|
395 UErrorCode& status) const;
|
jpayne@69
|
396 void writeZonePropsByDOW(VTZWriter& writer, UBool isDst, const UnicodeString& zonename,
|
jpayne@69
|
397 int32_t fromOffset, int32_t toOffset,
|
jpayne@69
|
398 int32_t month, int32_t weekInMonth, int32_t dayOfWeek,
|
jpayne@69
|
399 UDate startTime, UDate untilTime, UErrorCode& status) const;
|
jpayne@69
|
400 void writeZonePropsByDOW_GEQ_DOM(VTZWriter& writer, UBool isDst, const UnicodeString& zonename,
|
jpayne@69
|
401 int32_t fromOffset, int32_t toOffset,
|
jpayne@69
|
402 int32_t month, int32_t dayOfMonth, int32_t dayOfWeek,
|
jpayne@69
|
403 UDate startTime, UDate untilTime, UErrorCode& status) const;
|
jpayne@69
|
404 void writeZonePropsByDOW_GEQ_DOM_sub(VTZWriter& writer, int32_t month, int32_t dayOfMonth,
|
jpayne@69
|
405 int32_t dayOfWeek, int32_t numDays,
|
jpayne@69
|
406 UDate untilTime, int32_t fromOffset, UErrorCode& status) const;
|
jpayne@69
|
407 void writeZonePropsByDOW_LEQ_DOM(VTZWriter& writer, UBool isDst, const UnicodeString& zonename,
|
jpayne@69
|
408 int32_t fromOffset, int32_t toOffset,
|
jpayne@69
|
409 int32_t month, int32_t dayOfMonth, int32_t dayOfWeek,
|
jpayne@69
|
410 UDate startTime, UDate untilTime, UErrorCode& status) const;
|
jpayne@69
|
411 void writeFinalRule(VTZWriter& writer, UBool isDst, const AnnualTimeZoneRule* rule,
|
jpayne@69
|
412 int32_t fromRawOffset, int32_t fromDSTSavings,
|
jpayne@69
|
413 UDate startTime, UErrorCode& status) const;
|
jpayne@69
|
414
|
jpayne@69
|
415 void beginZoneProps(VTZWriter& writer, UBool isDst, const UnicodeString& zonename,
|
jpayne@69
|
416 int32_t fromOffset, int32_t toOffset, UDate startTime, UErrorCode& status) const;
|
jpayne@69
|
417 void endZoneProps(VTZWriter& writer, UBool isDst, UErrorCode& status) const;
|
jpayne@69
|
418 void beginRRULE(VTZWriter& writer, int32_t month, UErrorCode& status) const;
|
jpayne@69
|
419 void appendUNTIL(VTZWriter& writer, const UnicodeString& until, UErrorCode& status) const;
|
jpayne@69
|
420
|
jpayne@69
|
421 BasicTimeZone *tz;
|
jpayne@69
|
422 UVector *vtzlines;
|
jpayne@69
|
423 UnicodeString tzurl;
|
jpayne@69
|
424 UDate lastmod;
|
jpayne@69
|
425 UnicodeString olsonzid;
|
jpayne@69
|
426 UnicodeString icutzver;
|
jpayne@69
|
427
|
jpayne@69
|
428 public:
|
jpayne@69
|
429 /**
|
jpayne@69
|
430 * Return the class ID for this class. This is useful only for comparing to
|
jpayne@69
|
431 * a return value from getDynamicClassID(). For example:
|
jpayne@69
|
432 * <pre>
|
jpayne@69
|
433 * . Base* polymorphic_pointer = createPolymorphicObject();
|
jpayne@69
|
434 * . if (polymorphic_pointer->getDynamicClassID() ==
|
jpayne@69
|
435 * . erived::getStaticClassID()) ...
|
jpayne@69
|
436 * </pre>
|
jpayne@69
|
437 * @return The class ID for all objects of this class.
|
jpayne@69
|
438 * @stable ICU 3.8
|
jpayne@69
|
439 */
|
jpayne@69
|
440 static UClassID U_EXPORT2 getStaticClassID(void);
|
jpayne@69
|
441
|
jpayne@69
|
442 /**
|
jpayne@69
|
443 * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This
|
jpayne@69
|
444 * method is to implement a simple version of RTTI, since not all C++
|
jpayne@69
|
445 * compilers support genuine RTTI. Polymorphic operator==() and clone()
|
jpayne@69
|
446 * methods call this method.
|
jpayne@69
|
447 *
|
jpayne@69
|
448 * @return The class ID for this object. All objects of a
|
jpayne@69
|
449 * given class have the same class ID. Objects of
|
jpayne@69
|
450 * other classes have different class IDs.
|
jpayne@69
|
451 * @stable ICU 3.8
|
jpayne@69
|
452 */
|
jpayne@69
|
453 virtual UClassID getDynamicClassID(void) const;
|
jpayne@69
|
454 };
|
jpayne@69
|
455
|
jpayne@69
|
456 U_NAMESPACE_END
|
jpayne@69
|
457
|
jpayne@69
|
458 #endif /* #if !UCONFIG_NO_FORMATTING */
|
jpayne@69
|
459
|
jpayne@69
|
460 #endif /* U_SHOW_CPLUSPLUS_API */
|
jpayne@69
|
461
|
jpayne@69
|
462 #endif // VTZONE_H
|
jpayne@69
|
463 //eof
|