~ubuntu-branches/ubuntu/gutsy/icu/gutsy-updates

« back to all changes in this revision

Viewing changes to source/i18n/unicode/timezone.h

  • Committer: Package Import Robot
  • Author(s): Jay Berkenbilt
  • Date: 2005-11-19 11:29:31 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20051119112931-vcizkrp10tli4enw
Tags: 3.4-3
Explicitly build with g++ 3.4.  The current ICU fails its test suite
with 4.0 but not with 3.4.  Future versions should work properly with
4.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
* Copyright (C) {1997-2001}, International Business Machines Corporation and others. All Rights Reserved.
3
 
********************************************************************************
4
 
*
5
 
* File TIMEZONE.H
6
 
*
7
 
* Modification History:
8
 
*
9
 
*   Date        Name        Description
10
 
*   04/21/97    aliu        Overhauled header.
11
 
*   07/09/97    helena      Changed createInstance to createDefault.
12
 
*   08/06/97    aliu        Removed dependency on internal header for Hashtable.
13
 
*   08/10/98    stephen        Changed getDisplayName() API conventions to match
14
 
*   08/19/98    stephen        Changed createTimeZone() to never return 0
15
 
*   09/02/98    stephen        Sync to JDK 1.2 8/31
16
 
*                            - Added getOffset(... monthlen ...)
17
 
*                            - Added hasSameRules()
18
 
*   09/15/98    stephen        Added getStaticClassID
19
 
*   12/03/99    aliu        Moved data out of static table into icudata.dll.
20
 
*                           Hashtable replaced by new static data structures.
21
 
*   12/14/99    aliu        Made GMT public.
22
 
*   08/15/01    grhoten     Made GMT private and added the getGMT() function
23
 
********************************************************************************
24
 
*/
25
 
 
26
 
#ifndef TIMEZONE_H
27
 
#define TIMEZONE_H
28
 
 
29
 
#include "unicode/unistr.h"
30
 
 
31
 
U_NAMESPACE_BEGIN
32
 
 
33
 
/**
34
 
 * <code>TimeZone</code> represents a time zone offset, and also figures out daylight
35
 
 * savings.
36
 
 *
37
 
 * <p>
38
 
 * Typically, you get a <code>TimeZone</code> using <code>createDefault</code>
39
 
 * which creates a <code>TimeZone</code> based on the time zone where the program
40
 
 * is running. For example, for a program running in Japan, <code>createDefault</code>
41
 
 * creates a <code>TimeZone</code> object based on Japanese Standard Time.
42
 
 *
43
 
 * <p>
44
 
 * You can also get a <code>TimeZone</code> using <code>createTimeZone</code> along
45
 
 * with a time zone ID. For instance, the time zone ID for the Pacific
46
 
 * Standard Time zone is "PST". So, you can get a PST <code>TimeZone</code> object
47
 
 * with:
48
 
 * <blockquote>
49
 
 * <pre>
50
 
 * TimeZone *tz = TimeZone::createTimeZone("PST");
51
 
 * </pre>
52
 
 * </blockquote>
53
 
 * You can use <code>getAvailableIDs</code> method to iterate through
54
 
 * all the supported time zone IDs. You can then choose a
55
 
 * supported ID to get a <code>TimeZone</code>.
56
 
 * If the time zone you want is not represented by one of the
57
 
 * supported IDs, then you can create a custom time zone ID with
58
 
 * the following syntax:
59
 
 *
60
 
 * <blockquote>
61
 
 * <pre>
62
 
 * GMT[+|-]hh[[:]mm]
63
 
 * </pre>
64
 
 * </blockquote>
65
 
 *
66
 
 * For example, you might specify GMT+14:00 as a custom
67
 
 * time zone ID.  The <code>TimeZone</code> that is returned
68
 
 * when you specify a custom time zone ID does not include
69
 
 * daylight savings time.
70
 
 *
71
 
 * TimeZone is an abstract class representing a time zone.  A TimeZone is needed for
72
 
 * Calendar to produce local time for a particular time zone.  A TimeZone comprises
73
 
 * three basic pieces of information:<ul>
74
 
 *    <li>A time zone offset; that, is the number of milliseconds to add or subtract
75
 
 *      from a time expressed in terms of GMT to convert it to the same time in that
76
 
 *      time zone (without taking daylight savings time into account).
77
 
 *    <li>Logic necessary to take daylight savings time into account if daylight savings
78
 
 *      time is observed in that time zone (e.g., the days and hours on which daylight
79
 
 *      savings time begins and ends).
80
 
 *    <li>An ID.  This is a text string that uniquely identifies the time zone.</ul>
81
 
 *
82
 
 * (Only the ID is actually implemented in TimeZone; subclasses of TimeZone may handle
83
 
 * daylight savings time and GMT offset in different ways.  Currently we only have one
84
 
 * TimeZone subclass: SimpleTimeZone.)
85
 
 * <P>
86
 
 * The TimeZone class contains a static list containing a TimeZone object for every
87
 
 * combination of GMT offset and daylight-savings time rules currently in use in the
88
 
 * world, each with a unique ID.  Each ID consists of a region (usually a continent or
89
 
 * ocean) and a city in that region, separated by a slash, (for example, Pacific
90
 
 * Standard Time is "America/Los_Angeles.")  Because older versions of this class used
91
 
 * three- or four-letter abbreviations instead, there is also a table that maps the older
92
 
 * abbreviations to the newer ones (for example, "PST" maps to "America/LosAngeles").
93
 
 * Anywhere the API requires an ID, you can use either form.
94
 
 * <P>
95
 
 * To create a new TimeZone, you call the factory function TimeZone::createTimeZone()
96
 
 * and pass it a time zone ID.  You can use the createAvailableIDs() function to
97
 
 * obtain a list of all the time zone IDs recognized by createTimeZone().
98
 
 * <P>
99
 
 * You can also use TimeZone::createDefault() to create a TimeZone.  This function uses
100
 
 * platform-specific APIs to produce a TimeZone for the time zone corresponding to
101
 
 * the client's computer's physical location.  For example, if you're in Japan (assuming
102
 
 * your machine is set up correctly), TimeZone::createDefault() will return a TimeZone
103
 
 * for Japanese Standard Time ("Asia/Tokyo").
104
 
 */
105
 
class U_I18N_API TimeZone {
106
 
public:
107
 
    /**
108
 
     * @stable
109
 
     */
110
 
    virtual ~TimeZone();
111
 
 
112
 
#ifdef ICU_TIMEZONE_USE_DEPRECATES
113
 
    /**
114
 
     * The GMT zone has a raw offset of zero and does not use daylight
115
 
     * savings time.
116
 
     * @deprecated This variable can be improperly intialized when used during
117
 
     * the static initialization process.  Use getGMT() instead.
118
 
     */
119
 
    static const TimeZone* GMT;
120
 
#endif
121
 
 
122
 
    /**
123
 
     * The GMT time zone has a raw offset of zero and does not use daylight
124
 
     * savings time. This is a commonly used time zone.
125
 
     */
126
 
    static const TimeZone* getGMT(void);
127
 
 
128
 
    /**
129
 
     * Creates a <code>TimeZone</code> for the given ID.
130
 
     * @param ID the ID for a <code>TimeZone</code>, either an abbreviation such as
131
 
     * "PST", a full name such as "America/Los_Angeles", or a custom ID
132
 
     * such as "GMT-8:00".
133
 
     * @return the specified <code>TimeZone</code>, or the GMT zone if the given ID
134
 
     * cannot be understood.  Return result guaranteed to be non-null.  If you
135
 
     * require that the specific zone asked for be returned, check the ID of the
136
 
     * return result.
137
 
     * @stable
138
 
     */
139
 
    static TimeZone* createTimeZone(const UnicodeString& ID);
140
 
 
141
 
    /**
142
 
     * Returns a list of time zone IDs, one for each time zone with a given GMT offset.
143
 
     * The return value is a list because there may be several times zones with the same
144
 
     * GMT offset that differ in the way they handle daylight savings time.  For example,
145
 
     * the state of Arizona doesn't observe Daylight Savings time.  So if you ask for
146
 
     * the time zone IDs corresponding to GMT-7:00, you'll get back two time zone IDs:
147
 
     * "America/Denver," which corresponds to Mountain Standard Time in the winter and
148
 
     * Mountain Daylight Time in the summer, and "America/Phoenix", which corresponds to
149
 
     * Mountain Standard Time year-round, even in the summer.
150
 
     * <P>
151
 
     * The caller owns the list that is returned, but does not own the strings contained
152
 
     * in that list.  Delete the array, but DON'T delete the elements in the array.
153
 
     *
154
 
     * @param rawOffset  An offset from GMT in milliseconds.
155
 
     * @param numIDs     Receives the number of items in the array that is returned.
156
 
     * @return           An array of UnicodeString pointers, where each UnicodeString is
157
 
     *                   a time zone ID for a time zone with the given GMT offset.  If
158
 
     *                   there is no timezone that matches the GMT offset
159
 
     *                   specified, NULL is returned.
160
 
     * @stable
161
 
     */
162
 
    static const UnicodeString** createAvailableIDs(int32_t rawOffset, int32_t& numIDs);
163
 
 
164
 
    /**
165
 
     * Returns a list of time zone IDs associated with the given
166
 
     * country.  Some zones are affiliated with no country (e.g.,
167
 
     * "UTC"); these may also be retrieved, as a group.
168
 
     *
169
 
     * <P>The caller owns the list that is returned, but does not own
170
 
     * the strings contained in that list.  Delete the array, but
171
 
     * <b>DON'T</b> delete the elements in the array.
172
 
     *
173
 
     * @param country The ISO 3166 two-letter country code, or NULL to
174
 
     * retrieve zones not affiliated with any country.
175
 
     * @param numIDs Receives the number of items in the array that is
176
 
     * returned.
177
 
     * @return An array of UnicodeString pointers, where each
178
 
     * UnicodeString is a time zone ID for a time zone with the given
179
 
     * country.  If there is no timezone that matches the country
180
 
     * specified, NULL is returned.
181
 
     */
182
 
    static const UnicodeString** createAvailableIDs(const char* country,
183
 
                                                          int32_t& numIDs);
184
 
 
185
 
    /**
186
 
     * Returns a list of all time zone IDs supported by the TimeZone class (i.e., all
187
 
     * IDs that it's legal to pass to createTimeZone()).  The caller owns the list that
188
 
     * is returned, but does not own the strings contained in that list.  Delete the array,
189
 
     * but DON'T delete the elements in the array.
190
 
     *
191
 
     * @param numIDs  Receives the number of zone IDs returned.
192
 
     * @return        An array of UnicodeString pointers, where each is a time zone ID
193
 
     *                supported by the TimeZone class.
194
 
     * @stable
195
 
     */
196
 
    static const UnicodeString** createAvailableIDs(int32_t& numIDs);
197
 
 
198
 
    /**
199
 
     * Returns the number of IDs in the equivalency group that
200
 
     * includes the given ID.  An equivalency group contains zones
201
 
     * that have the same GMT offset and rules.
202
 
     *
203
 
     * <p>The returned count includes the given ID; it is always >= 1.
204
 
     * The given ID must be a system time zone.  If it is not, returns
205
 
     * zero.
206
 
     * @param id a system time zone ID
207
 
     * @return the number of zones in the equivalency group containing
208
 
     * 'id', or zero if 'id' is not a valid system ID
209
 
     * @see #getEquivalentID
210
 
     * @draft ICU 1.7
211
 
     */
212
 
    static int32_t countEquivalentIDs(const UnicodeString& id);
213
 
 
214
 
    /**
215
 
     * Returns an ID in the equivalency group that
216
 
     * includes the given ID.  An equivalency group contains zones
217
 
     * that have the same GMT offset and rules.
218
 
     *
219
 
     * <p>The given index must be in the range 0..n-1, where n is the
220
 
     * value returned by <code>countEquivalentIDs(id)</code>.  For
221
 
     * some value of 'index', the returned value will be equal to the
222
 
     * given id.  If the given id is not a valid system time zone, or
223
 
     * if 'index' is out of range, then returns an empty string.
224
 
     * @param id a system time zone ID
225
 
     * @param index a value from 0 to n-1, where n is the value
226
 
     * returned by <code>countEquivalentIDs(id)</code>
227
 
     * @return the ID of the index-th zone in the equivalency group
228
 
     * containing 'id', or an empty string if 'id' is not a valid
229
 
     * system ID or 'index' is out of range
230
 
     * @see #countEquivalentIDs
231
 
     * @draft ICU 1.7
232
 
     */
233
 
    static const UnicodeString getEquivalentID(const UnicodeString& id,
234
 
                                               int32_t index);
235
 
 
236
 
    /**
237
 
     * Creates a new copy of the default TimeZone for this host. Unless the default time
238
 
     * zone has already been set using adoptDefault() or setDefault(), the default is
239
 
     * determined by querying the system using methods in TPlatformUtilities. If the
240
 
     * system routines fail, or if they specify a TimeZone or TimeZone offset which is not
241
 
     * recognized, the TimeZone indicated by the ID kLastResortID is instantiated
242
 
     * and made the default.
243
 
     *
244
 
     * @return   A default TimeZone. Clients are responsible for deleting the time zone
245
 
     *           object returned.
246
 
     * @stable
247
 
     */
248
 
    static TimeZone* createDefault(void);
249
 
 
250
 
    /**
251
 
     * Sets the default time zone (i.e., what's returned by getDefault()) to be the
252
 
     * specified time zone.  If NULL is specified for the time zone, the default time
253
 
     * zone is set to the default host time zone.  This call adopts the TimeZone object
254
 
     * passed in; the clent is no longer responsible for deleting it.
255
 
     *
256
 
     * @param zone  A pointer to the new TimeZone object to use as the default.
257
 
     * @stable
258
 
     */
259
 
    static void adoptDefault(TimeZone* zone);
260
 
 
261
 
    /**
262
 
     * Same as adoptDefault(), except that the TimeZone object passed in is NOT adopted;
263
 
     * the caller remains responsible for deleting it.
264
 
     *
265
 
     * @param zone  The given timezone.
266
 
     * @system
267
 
     */
268
 
    static void setDefault(const TimeZone& zone);
269
 
 
270
 
    /**
271
 
     * Returns true if the two TimeZones are equal.  (The TimeZone version only compares
272
 
     * IDs, but subclasses are expected to also compare the fields they add.)
273
 
     *
274
 
     * @param that  The TimeZone object to be compared with.
275
 
     * @return      True if the given TimeZone is equal to this TimeZone; false
276
 
     *              otherwise.
277
 
     * @stable
278
 
     */
279
 
    virtual UBool operator==(const TimeZone& that) const;
280
 
 
281
 
    /**
282
 
     * Returns true if the two TimeZones are NOT equal; that is, if operator==() returns
283
 
     * false.
284
 
     *
285
 
     * @param that  The TimeZone object to be compared with.
286
 
     * @return      True if the given TimeZone is not equal to this TimeZone; false
287
 
     *              otherwise.
288
 
     * @stable
289
 
     */
290
 
    UBool operator!=(const TimeZone& that) const {return !operator==(that);}
291
 
 
292
 
    /**
293
 
     * Returns the TimeZone's adjusted GMT offset (i.e., the number of milliseconds to add
294
 
     * to GMT to get local time in this time zone, taking daylight savings time into
295
 
     * account) as of a particular reference date.  The reference date is used to determine
296
 
     * whether daylight savings time is in effect and needs to be figured into the offset
297
 
     * that is returned (in other words, what is the adjusted GMT offset in this time zone
298
 
     * at this particular date and time?).  For the time zones produced by createTimeZone(),
299
 
     * the reference data is specified according to the Gregorian calendar, and the date
300
 
     * and time fields are in GMT, NOT local time.
301
 
     *
302
 
     * @param era        The reference date's era
303
 
     * @param year       The reference date's year
304
 
     * @param month      The reference date's month (0-based; 0 is January)
305
 
     * @param day        The reference date's day-in-month (1-based)
306
 
     * @param dayOfWeek  The reference date's day-of-week (1-based; 1 is Sunday)
307
 
     * @param millis     The reference date's milliseconds in day, UTT (NOT local time).
308
 
     * @return           The offset in milliseconds to add to GMT to get local time.
309
 
     * @stable
310
 
     */
311
 
    virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day,
312
 
                              uint8_t dayOfWeek, int32_t millis, UErrorCode& status) const = 0;
313
 
    /**
314
 
     * @deprecated Remove after 2000-dec-31. Use the other getOffset().
315
 
     */
316
 
    virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day,
317
 
                              uint8_t dayOfWeek, int32_t millis) const = 0;
318
 
 
319
 
    /**
320
 
     * Gets the time zone offset, for current date, modified in case of
321
 
     * daylight savings. This is the offset to add *to* UTC to get local time.
322
 
     * @param era the era of the given date.
323
 
     * @param year the year in the given date.
324
 
     * @param month the month in the given date.
325
 
     * Month is 0-based. e.g., 0 for January.
326
 
     * @param day the day-in-month of the given date.
327
 
     * @param dayOfWeek the day-of-week of the given date.
328
 
     * @param milliseconds the millis in day in <em>standard</em> local time.
329
 
     * @param monthLength the length of the given month in days.
330
 
     * @return the offset to add *to* GMT to get local time.
331
 
     * @stable
332
 
     */
333
 
    virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day,
334
 
                           uint8_t dayOfWeek, int32_t milliseconds,
335
 
                           int32_t monthLength, UErrorCode& status) const = 0;
336
 
 
337
 
    /**
338
 
     * Sets the TimeZone's raw GMT offset (i.e., the number of milliseconds to add
339
 
     * to GMT to get local time, before taking daylight savings time into account).
340
 
     *
341
 
     * @param offsetMillis  The new raw GMT offset for this time zone.
342
 
     * @stable
343
 
     */
344
 
    virtual void setRawOffset(int32_t offsetMillis) = 0;
345
 
 
346
 
    /**
347
 
     * Returns the TimeZone's raw GMT offset (i.e., the number of milliseconds to add
348
 
     * to GMT to get local time, before taking daylight savings time into account).
349
 
     *
350
 
     * @return   The TimeZone's raw GMT offset.
351
 
     * @stable
352
 
     */
353
 
    virtual int32_t getRawOffset(void) const = 0;
354
 
 
355
 
    /**
356
 
     * Fills in "ID" with the TimeZone's ID.
357
 
     *
358
 
     * @param ID  Receives this TimeZone's ID.
359
 
     * @return    "ID"
360
 
     * @stable
361
 
     */
362
 
    UnicodeString& getID(UnicodeString& ID) const;
363
 
 
364
 
    /**
365
 
     * Sets the TimeZone's ID to the specified value.  This doesn't affect any other
366
 
     * fields (for example, if you say<
367
 
     * blockquote><pre>
368
 
     * .     TimeZone* foo = TimeZone::createTimeZone("America/New_York");
369
 
     * .     foo.setID("America/Los_Angeles");
370
 
     * </pre></blockquote>
371
 
     * the time zone's GMT offset and daylight-savings rules don't change to those for
372
 
     * Los Angeles.  They're still those for New York.  Only the ID has changed.)
373
 
     *
374
 
     * @param ID  The new timezone ID.
375
 
     * @stable
376
 
     */
377
 
    void setID(const UnicodeString& ID);
378
 
 
379
 
    /**
380
 
     * Enum for use with getDisplayName
381
 
     */
382
 
 
383
 
    enum EDisplayType {
384
 
        SHORT = 1,
385
 
        LONG
386
 
    };
387
 
 
388
 
    /**
389
 
     * Returns a name of this time zone suitable for presentation to the user
390
 
     * in the default locale.
391
 
     * This method returns the long name, not including daylight savings.
392
 
     * If the display name is not available for the locale,
393
 
     * then this method returns a string in the format
394
 
     * <code>GMT[+-]hh:mm</code>.
395
 
     * @return the human-readable name of this time zone in the default locale.
396
 
     * @stable
397
 
     */
398
 
    UnicodeString& getDisplayName(UnicodeString& result) const;
399
 
 
400
 
    /**
401
 
     * Returns a name of this time zone suitable for presentation to the user
402
 
     * in the specified locale.
403
 
     * This method returns the long name, not including daylight savings.
404
 
     * If the display name is not available for the locale,
405
 
     * then this method returns a string in the format
406
 
     * <code>GMT[+-]hh:mm</code>.
407
 
     * @param locale the locale in which to supply the display name.
408
 
     * @return the human-readable name of this time zone in the given locale
409
 
     * or in the default locale if the given locale is not recognized.
410
 
     * @stable
411
 
     */
412
 
    UnicodeString& getDisplayName(const Locale& locale, UnicodeString& result) const;
413
 
 
414
 
    /**
415
 
     * Returns a name of this time zone suitable for presentation to the user
416
 
     * in the default locale.
417
 
     * If the display name is not available for the locale,
418
 
     * then this method returns a string in the format
419
 
     * <code>GMT[+-]hh:mm</code>.
420
 
     * @param daylight if true, return the daylight savings name.
421
 
     * @param style either <code>LONG</code> or <code>SHORT</code>
422
 
     * @return the human-readable name of this time zone in the default locale.
423
 
     * @stable
424
 
     */
425
 
    UnicodeString& getDisplayName(UBool daylight, EDisplayType style, UnicodeString& result) const;
426
 
 
427
 
    /**
428
 
     * Returns a name of this time zone suitable for presentation to the user
429
 
     * in the specified locale.
430
 
     * If the display name is not available for the locale,
431
 
     * then this method returns a string in the format
432
 
     * <code>GMT[+-]hh:mm</code>.
433
 
     * @param daylight if true, return the daylight savings name.
434
 
     * @param style either <code>LONG</code> or <code>SHORT</code>
435
 
     * @param locale the locale in which to supply the display name.
436
 
     * @return the human-readable name of this time zone in the given locale
437
 
     * or in the default locale if the given locale is not recognized.
438
 
     * @stable
439
 
     */
440
 
    UnicodeString& getDisplayName(UBool daylight, EDisplayType style, const Locale& locale, UnicodeString& result) const;
441
 
 
442
 
    /**
443
 
     * Queries if this time zone uses daylight savings time.
444
 
     * @return true if this time zone uses daylight savings time,
445
 
     * false, otherwise.
446
 
     * @stable
447
 
     */
448
 
    virtual UBool useDaylightTime(void) const = 0;
449
 
 
450
 
    /**
451
 
     * Queries if the given date is in daylight savings time in
452
 
     * this time zone.
453
 
     * @param date the given UDate.
454
 
     * @return true if the given date is in daylight savings time,
455
 
     * false, otherwise.
456
 
     * @deprecated Remove after 2000-dec-31. Use useDaylightTime() instead.
457
 
     */
458
 
    virtual UBool inDaylightTime(UDate date, UErrorCode& status) const = 0;
459
 
 
460
 
    /**
461
 
     * Returns true if this zone has the same rule and offset as another zone.
462
 
     * That is, if this zone differs only in ID, if at all.
463
 
     * @param other the <code>TimeZone</code> object to be compared with
464
 
     * @return true if the given zone is the same as this one,
465
 
     * with the possible exception of the ID
466
 
     * @stable
467
 
     */
468
 
    virtual UBool hasSameRules(const TimeZone& other) const;
469
 
 
470
 
    /**
471
 
     * Clones TimeZone objects polymorphically. Clients are responsible for deleting
472
 
     * the TimeZone object cloned.
473
 
     *
474
 
     * @return   A new copy of this TimeZone object.
475
 
     * @stable
476
 
     */
477
 
    virtual TimeZone* clone(void) const = 0;
478
 
 
479
 
    /**
480
 
     * Return the class ID for this class.  This is useful only for
481
 
     * comparing to a return value from getDynamicClassID().  For example:
482
 
     * <pre>
483
 
     * .   Base* polymorphic_pointer = createPolymorphicObject();
484
 
     * .   if (polymorphic_pointer->getDynamicClassID() ==
485
 
     * .       Derived::getStaticClassID()) ...
486
 
     * </pre>
487
 
     * @return The class ID for all objects of this class.
488
 
     * @stable
489
 
     */
490
 
    static UClassID getStaticClassID(void) { return (UClassID)&fgClassID; }
491
 
 
492
 
    /**
493
 
     * Returns a unique class ID POLYMORPHICALLY. Pure virtual method. This method is to
494
 
     * implement a simple version of RTTI, since not all C++ compilers support genuine
495
 
     * RTTI. Polymorphic operator==() and clone() methods call this method.
496
 
     * <P>
497
 
     * Concrete subclasses of TimeZone must implement getDynamicClassID() and also a
498
 
     * static method and data member:
499
 
     * <pre>
500
 
     * .     static UClassID getStaticClassID() { return (UClassID)&fgClassID; }
501
 
     * .     static char fgClassID;
502
 
     * </pre>
503
 
     * @return   The class ID for this object. All objects of a given class have the
504
 
     *           same class ID. Objects of other classes have different class IDs.
505
 
     * @stable
506
 
     */
507
 
    virtual UClassID getDynamicClassID(void) const = 0;
508
 
 
509
 
protected:
510
 
 
511
 
    /**
512
 
     * Default constructor.  ID is initialized to the empty string.
513
 
     * @stable
514
 
     */
515
 
    TimeZone();
516
 
 
517
 
    /**
518
 
     * Construct a timezone with a given ID.
519
 
     * @stable
520
 
     */
521
 
    TimeZone(const UnicodeString &id);
522
 
 
523
 
    /**
524
 
     * Copy constructor.
525
 
     * @stable
526
 
     */
527
 
    TimeZone(const TimeZone& source);
528
 
 
529
 
    /**
530
 
     * Default assignment operator.
531
 
     * @stable
532
 
     */
533
 
    TimeZone& operator=(const TimeZone& right);
534
 
 
535
 
private:
536
 
    static const char fgClassID;
537
 
 
538
 
    static TimeZone*        createCustomTimeZone(const UnicodeString&); // Creates a time zone based on the string.
539
 
 
540
 
    /**
541
 
     * Responsible for setting up DEFAULT_ZONE.  Uses routines in TPlatformUtilities
542
 
     * (i.e., platform-specific calls) to get the current system time zone.  Failing
543
 
     * that, uses the platform-specific default time zone.  Failing that, uses GMT.
544
 
     */
545
 
    static void             initDefault(void);
546
 
 
547
 
    // See source file for documentation
548
 
    static TimeZone*        createSystemTimeZone(const UnicodeString& name);
549
 
 
550
 
    UnicodeString           fID;    // this time zone's ID
551
 
};
552
 
 
553
 
 
554
 
// -------------------------------------
555
 
 
556
 
inline UnicodeString&
557
 
TimeZone::getID(UnicodeString& ID) const
558
 
{
559
 
    ID = fID;
560
 
    return ID;
561
 
}
562
 
 
563
 
// -------------------------------------
564
 
 
565
 
inline void
566
 
TimeZone::setID(const UnicodeString& ID)
567
 
{
568
 
    fID = ID;
569
 
}
570
 
U_NAMESPACE_END
571
 
 
572
 
#endif //_TIMEZONE
573
 
//eof