intl/icu/source/i18n/unicode/timezone.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /*************************************************************************
michael@0 2 * Copyright (c) 1997-2013, International Business Machines Corporation
michael@0 3 * and others. All Rights Reserved.
michael@0 4 **************************************************************************
michael@0 5 *
michael@0 6 * File TIMEZONE.H
michael@0 7 *
michael@0 8 * Modification History:
michael@0 9 *
michael@0 10 * Date Name Description
michael@0 11 * 04/21/97 aliu Overhauled header.
michael@0 12 * 07/09/97 helena Changed createInstance to createDefault.
michael@0 13 * 08/06/97 aliu Removed dependency on internal header for Hashtable.
michael@0 14 * 08/10/98 stephen Changed getDisplayName() API conventions to match
michael@0 15 * 08/19/98 stephen Changed createTimeZone() to never return 0
michael@0 16 * 09/02/98 stephen Sync to JDK 1.2 8/31
michael@0 17 * - Added getOffset(... monthlen ...)
michael@0 18 * - Added hasSameRules()
michael@0 19 * 09/15/98 stephen Added getStaticClassID
michael@0 20 * 12/03/99 aliu Moved data out of static table into icudata.dll.
michael@0 21 * Hashtable replaced by new static data structures.
michael@0 22 * 12/14/99 aliu Made GMT public.
michael@0 23 * 08/15/01 grhoten Made GMT private and added the getGMT() function
michael@0 24 **************************************************************************
michael@0 25 */
michael@0 26
michael@0 27 #ifndef TIMEZONE_H
michael@0 28 #define TIMEZONE_H
michael@0 29
michael@0 30 #include "unicode/utypes.h"
michael@0 31
michael@0 32 /**
michael@0 33 * \file
michael@0 34 * \brief C++ API: TimeZone object
michael@0 35 */
michael@0 36
michael@0 37 #if !UCONFIG_NO_FORMATTING
michael@0 38
michael@0 39 #include "unicode/uobject.h"
michael@0 40 #include "unicode/unistr.h"
michael@0 41 #include "unicode/ures.h"
michael@0 42 #include "unicode/ucal.h"
michael@0 43
michael@0 44 U_NAMESPACE_BEGIN
michael@0 45
michael@0 46 class StringEnumeration;
michael@0 47
michael@0 48 /**
michael@0 49 *
michael@0 50 * <code>TimeZone</code> represents a time zone offset, and also figures out daylight
michael@0 51 * savings.
michael@0 52 *
michael@0 53 * <p>
michael@0 54 * Typically, you get a <code>TimeZone</code> using <code>createDefault</code>
michael@0 55 * which creates a <code>TimeZone</code> based on the time zone where the program
michael@0 56 * is running. For example, for a program running in Japan, <code>createDefault</code>
michael@0 57 * creates a <code>TimeZone</code> object based on Japanese Standard Time.
michael@0 58 *
michael@0 59 * <p>
michael@0 60 * You can also get a <code>TimeZone</code> using <code>createTimeZone</code> along
michael@0 61 * with a time zone ID. For instance, the time zone ID for the US Pacific
michael@0 62 * Time zone is "America/Los_Angeles". So, you can get a Pacific Time <code>TimeZone</code> object
michael@0 63 * with:
michael@0 64 * \htmlonly<blockquote>\endhtmlonly
michael@0 65 * <pre>
michael@0 66 * TimeZone *tz = TimeZone::createTimeZone("America/Los_Angeles");
michael@0 67 * </pre>
michael@0 68 * \htmlonly</blockquote>\endhtmlonly
michael@0 69 * You can use <code>getAvailableIDs</code> method to iterate through
michael@0 70 * all the supported time zone IDs, or getCanonicalID method to check
michael@0 71 * if a time zone ID is supported or not. You can then choose a
michael@0 72 * supported ID to get a <code>TimeZone</code>.
michael@0 73 * If the time zone you want is not represented by one of the
michael@0 74 * supported IDs, then you can create a custom time zone ID with
michael@0 75 * the following syntax:
michael@0 76 *
michael@0 77 * \htmlonly<blockquote>\endhtmlonly
michael@0 78 * <pre>
michael@0 79 * GMT[+|-]hh[[:]mm]
michael@0 80 * </pre>
michael@0 81 * \htmlonly</blockquote>\endhtmlonly
michael@0 82 *
michael@0 83 * For example, you might specify GMT+14:00 as a custom
michael@0 84 * time zone ID. The <code>TimeZone</code> that is returned
michael@0 85 * when you specify a custom time zone ID uses the specified
michael@0 86 * offset from GMT(=UTC) and does not observe daylight saving
michael@0 87 * time. For example, you might specify GMT+14:00 as a custom
michael@0 88 * time zone ID to create a TimeZone representing 14 hours ahead
michael@0 89 * of GMT (with no daylight saving time). In addition,
michael@0 90 * <code>getCanonicalID</code> can also be used to
michael@0 91 * normalize a custom time zone ID.
michael@0 92 *
michael@0 93 * TimeZone is an abstract class representing a time zone. A TimeZone is needed for
michael@0 94 * Calendar to produce local time for a particular time zone. A TimeZone comprises
michael@0 95 * three basic pieces of information:
michael@0 96 * <ul>
michael@0 97 * <li>A time zone offset; that, is the number of milliseconds to add or subtract
michael@0 98 * from a time expressed in terms of GMT to convert it to the same time in that
michael@0 99 * time zone (without taking daylight savings time into account).</li>
michael@0 100 * <li>Logic necessary to take daylight savings time into account if daylight savings
michael@0 101 * time is observed in that time zone (e.g., the days and hours on which daylight
michael@0 102 * savings time begins and ends).</li>
michael@0 103 * <li>An ID. This is a text string that uniquely identifies the time zone.</li>
michael@0 104 * </ul>
michael@0 105 *
michael@0 106 * (Only the ID is actually implemented in TimeZone; subclasses of TimeZone may handle
michael@0 107 * daylight savings time and GMT offset in different ways. Currently we have the following
michael@0 108 * TimeZone subclasses: RuleBasedTimeZone, SimpleTimeZone, and VTimeZone.)
michael@0 109 * <P>
michael@0 110 * The TimeZone class contains a static list containing a TimeZone object for every
michael@0 111 * combination of GMT offset and daylight-savings time rules currently in use in the
michael@0 112 * world, each with a unique ID. Each ID consists of a region (usually a continent or
michael@0 113 * ocean) and a city in that region, separated by a slash, (for example, US Pacific
michael@0 114 * Time is "America/Los_Angeles.") Because older versions of this class used
michael@0 115 * three- or four-letter abbreviations instead, there is also a table that maps the older
michael@0 116 * abbreviations to the newer ones (for example, "PST" maps to "America/Los_Angeles").
michael@0 117 * Anywhere the API requires an ID, you can use either form.
michael@0 118 * <P>
michael@0 119 * To create a new TimeZone, you call the factory function TimeZone::createTimeZone()
michael@0 120 * and pass it a time zone ID. You can use the createEnumeration() function to
michael@0 121 * obtain a list of all the time zone IDs recognized by createTimeZone().
michael@0 122 * <P>
michael@0 123 * You can also use TimeZone::createDefault() to create a TimeZone. This function uses
michael@0 124 * platform-specific APIs to produce a TimeZone for the time zone corresponding to
michael@0 125 * the client's computer's physical location. For example, if you're in Japan (assuming
michael@0 126 * your machine is set up correctly), TimeZone::createDefault() will return a TimeZone
michael@0 127 * for Japanese Standard Time ("Asia/Tokyo").
michael@0 128 */
michael@0 129 class U_I18N_API TimeZone : public UObject {
michael@0 130 public:
michael@0 131 /**
michael@0 132 * @stable ICU 2.0
michael@0 133 */
michael@0 134 virtual ~TimeZone();
michael@0 135
michael@0 136 /**
michael@0 137 * Returns the "unknown" time zone.
michael@0 138 * It behaves like the GMT/UTC time zone but has the
michael@0 139 * <code>UCAL_UNKNOWN_ZONE_ID</code> = "Etc/Unknown".
michael@0 140 * createTimeZone() returns a mutable clone of this time zone if the input ID is not recognized.
michael@0 141 *
michael@0 142 * @return the "unknown" time zone.
michael@0 143 * @see UCAL_UNKNOWN_ZONE_ID
michael@0 144 * @see createTimeZone
michael@0 145 * @see getGMT
michael@0 146 * @stable ICU 49
michael@0 147 */
michael@0 148 static const TimeZone& U_EXPORT2 getUnknown();
michael@0 149
michael@0 150 /**
michael@0 151 * The GMT (=UTC) time zone has a raw offset of zero and does not use daylight
michael@0 152 * savings time. This is a commonly used time zone.
michael@0 153 *
michael@0 154 * <p>Note: For backward compatibility reason, the ID used by the time
michael@0 155 * zone returned by this method is "GMT", although the ICU's canonical
michael@0 156 * ID for the GMT time zone is "Etc/GMT".
michael@0 157 *
michael@0 158 * @return the GMT/UTC time zone.
michael@0 159 * @see getUnknown
michael@0 160 * @stable ICU 2.0
michael@0 161 */
michael@0 162 static const TimeZone* U_EXPORT2 getGMT(void);
michael@0 163
michael@0 164 /**
michael@0 165 * Creates a <code>TimeZone</code> for the given ID.
michael@0 166 * @param ID the ID for a <code>TimeZone</code>, such as "America/Los_Angeles",
michael@0 167 * or a custom ID such as "GMT-8:00".
michael@0 168 * @return the specified <code>TimeZone</code>, or a mutable clone of getUnknown()
michael@0 169 * if the given ID cannot be understood or if the given ID is "Etc/Unknown".
michael@0 170 * The return result is guaranteed to be non-NULL.
michael@0 171 * If you require that the specific zone asked for be returned,
michael@0 172 * compare the result with getUnknown() or check the ID of the return result.
michael@0 173 * @stable ICU 2.0
michael@0 174 */
michael@0 175 static TimeZone* U_EXPORT2 createTimeZone(const UnicodeString& ID);
michael@0 176
michael@0 177 /**
michael@0 178 * Returns an enumeration over system time zone IDs with the given
michael@0 179 * filter conditions.
michael@0 180 * @param zoneType The system time zone type.
michael@0 181 * @param region The ISO 3166 two-letter country code or UN M.49
michael@0 182 * three-digit area code. When NULL, no filtering
michael@0 183 * done by region.
michael@0 184 * @param rawOffset An offset from GMT in milliseconds, ignoring
michael@0 185 * the effect of daylight savings time, if any.
michael@0 186 * When NULL, no filtering done by zone offset.
michael@0 187 * @param ec Output param to filled in with a success or
michael@0 188 * an error.
michael@0 189 * @return an enumeration object, owned by the caller.
michael@0 190 * @stable ICU 4.8
michael@0 191 */
michael@0 192 static StringEnumeration* U_EXPORT2 createTimeZoneIDEnumeration(
michael@0 193 USystemTimeZoneType zoneType,
michael@0 194 const char* region,
michael@0 195 const int32_t* rawOffset,
michael@0 196 UErrorCode& ec);
michael@0 197
michael@0 198 /**
michael@0 199 * Returns an enumeration over all recognized time zone IDs. (i.e.,
michael@0 200 * all strings that createTimeZone() accepts)
michael@0 201 *
michael@0 202 * @return an enumeration object, owned by the caller.
michael@0 203 * @stable ICU 2.4
michael@0 204 */
michael@0 205 static StringEnumeration* U_EXPORT2 createEnumeration();
michael@0 206
michael@0 207 /**
michael@0 208 * Returns an enumeration over time zone IDs with a given raw
michael@0 209 * offset from GMT. There may be several times zones with the
michael@0 210 * same GMT offset that differ in the way they handle daylight
michael@0 211 * savings time. For example, the state of Arizona doesn't
michael@0 212 * observe daylight savings time. If you ask for the time zone
michael@0 213 * IDs corresponding to GMT-7:00, you'll get back an enumeration
michael@0 214 * over two time zone IDs: "America/Denver," which corresponds to
michael@0 215 * Mountain Standard Time in the winter and Mountain Daylight Time
michael@0 216 * in the summer, and "America/Phoenix", which corresponds to
michael@0 217 * Mountain Standard Time year-round, even in the summer.
michael@0 218 *
michael@0 219 * @param rawOffset an offset from GMT in milliseconds, ignoring
michael@0 220 * the effect of daylight savings time, if any
michael@0 221 * @return an enumeration object, owned by the caller
michael@0 222 * @stable ICU 2.4
michael@0 223 */
michael@0 224 static StringEnumeration* U_EXPORT2 createEnumeration(int32_t rawOffset);
michael@0 225
michael@0 226 /**
michael@0 227 * Returns an enumeration over time zone IDs associated with the
michael@0 228 * given country. Some zones are affiliated with no country
michael@0 229 * (e.g., "UTC"); these may also be retrieved, as a group.
michael@0 230 *
michael@0 231 * @param country The ISO 3166 two-letter country code, or NULL to
michael@0 232 * retrieve zones not affiliated with any country.
michael@0 233 * @return an enumeration object, owned by the caller
michael@0 234 * @stable ICU 2.4
michael@0 235 */
michael@0 236 static StringEnumeration* U_EXPORT2 createEnumeration(const char* country);
michael@0 237
michael@0 238 /**
michael@0 239 * Returns the number of IDs in the equivalency group that
michael@0 240 * includes the given ID. An equivalency group contains zones
michael@0 241 * that have the same GMT offset and rules.
michael@0 242 *
michael@0 243 * <p>The returned count includes the given ID; it is always >= 1.
michael@0 244 * The given ID must be a system time zone. If it is not, returns
michael@0 245 * zero.
michael@0 246 * @param id a system time zone ID
michael@0 247 * @return the number of zones in the equivalency group containing
michael@0 248 * 'id', or zero if 'id' is not a valid system ID
michael@0 249 * @see #getEquivalentID
michael@0 250 * @stable ICU 2.0
michael@0 251 */
michael@0 252 static int32_t U_EXPORT2 countEquivalentIDs(const UnicodeString& id);
michael@0 253
michael@0 254 /**
michael@0 255 * Returns an ID in the equivalency group that
michael@0 256 * includes the given ID. An equivalency group contains zones
michael@0 257 * that have the same GMT offset and rules.
michael@0 258 *
michael@0 259 * <p>The given index must be in the range 0..n-1, where n is the
michael@0 260 * value returned by <code>countEquivalentIDs(id)</code>. For
michael@0 261 * some value of 'index', the returned value will be equal to the
michael@0 262 * given id. If the given id is not a valid system time zone, or
michael@0 263 * if 'index' is out of range, then returns an empty string.
michael@0 264 * @param id a system time zone ID
michael@0 265 * @param index a value from 0 to n-1, where n is the value
michael@0 266 * returned by <code>countEquivalentIDs(id)</code>
michael@0 267 * @return the ID of the index-th zone in the equivalency group
michael@0 268 * containing 'id', or an empty string if 'id' is not a valid
michael@0 269 * system ID or 'index' is out of range
michael@0 270 * @see #countEquivalentIDs
michael@0 271 * @stable ICU 2.0
michael@0 272 */
michael@0 273 static const UnicodeString U_EXPORT2 getEquivalentID(const UnicodeString& id,
michael@0 274 int32_t index);
michael@0 275
michael@0 276 /**
michael@0 277 * Creates a new copy of the default TimeZone for this host. Unless the default time
michael@0 278 * zone has already been set using adoptDefault() or setDefault(), the default is
michael@0 279 * determined by querying the system using methods in TPlatformUtilities. If the
michael@0 280 * system routines fail, or if they specify a TimeZone or TimeZone offset which is not
michael@0 281 * recognized, the TimeZone indicated by the ID kLastResortID is instantiated
michael@0 282 * and made the default.
michael@0 283 *
michael@0 284 * @return A default TimeZone. Clients are responsible for deleting the time zone
michael@0 285 * object returned.
michael@0 286 * @stable ICU 2.0
michael@0 287 */
michael@0 288 static TimeZone* U_EXPORT2 createDefault(void);
michael@0 289
michael@0 290 /**
michael@0 291 * Sets the default time zone (i.e., what's returned by createDefault()) to be the
michael@0 292 * specified time zone. If NULL is specified for the time zone, the default time
michael@0 293 * zone is set to the default host time zone. This call adopts the TimeZone object
michael@0 294 * passed in; the client is no longer responsible for deleting it.
michael@0 295 *
michael@0 296 * <p>This function is not thread safe. It is an error for multiple threads
michael@0 297 * to concurrently attempt to set the default time zone, or for any thread
michael@0 298 * to attempt to reference the default zone while another thread is setting it.
michael@0 299 *
michael@0 300 * @param zone A pointer to the new TimeZone object to use as the default.
michael@0 301 * @stable ICU 2.0
michael@0 302 */
michael@0 303 static void U_EXPORT2 adoptDefault(TimeZone* zone);
michael@0 304
michael@0 305 #ifndef U_HIDE_SYSTEM_API
michael@0 306 /**
michael@0 307 * Same as adoptDefault(), except that the TimeZone object passed in is NOT adopted;
michael@0 308 * the caller remains responsible for deleting it.
michael@0 309 *
michael@0 310 * <p>See the thread safety note under adoptDefault().
michael@0 311 *
michael@0 312 * @param zone The given timezone.
michael@0 313 * @system
michael@0 314 * @stable ICU 2.0
michael@0 315 */
michael@0 316 static void U_EXPORT2 setDefault(const TimeZone& zone);
michael@0 317 #endif /* U_HIDE_SYSTEM_API */
michael@0 318
michael@0 319 /**
michael@0 320 * Returns the timezone data version currently used by ICU.
michael@0 321 * @param status Output param to filled in with a success or an error.
michael@0 322 * @return the version string, such as "2007f"
michael@0 323 * @stable ICU 3.8
michael@0 324 */
michael@0 325 static const char* U_EXPORT2 getTZDataVersion(UErrorCode& status);
michael@0 326
michael@0 327 /**
michael@0 328 * Returns the canonical system timezone ID or the normalized
michael@0 329 * custom time zone ID for the given time zone ID.
michael@0 330 * @param id The input time zone ID to be canonicalized.
michael@0 331 * @param canonicalID Receives the canonical system time zone ID
michael@0 332 * or the custom time zone ID in normalized format.
michael@0 333 * @param status Recevies the status. When the given time zone ID
michael@0 334 * is neither a known system time zone ID nor a
michael@0 335 * valid custom time zone ID, U_ILLEGAL_ARGUMENT_ERROR
michael@0 336 * is set.
michael@0 337 * @return A reference to the result.
michael@0 338 * @stable ICU 4.0
michael@0 339 */
michael@0 340 static UnicodeString& U_EXPORT2 getCanonicalID(const UnicodeString& id,
michael@0 341 UnicodeString& canonicalID, UErrorCode& status);
michael@0 342
michael@0 343 /**
michael@0 344 * Returns the canonical system time zone ID or the normalized
michael@0 345 * custom time zone ID for the given time zone ID.
michael@0 346 * @param id The input time zone ID to be canonicalized.
michael@0 347 * @param canonicalID Receives the canonical system time zone ID
michael@0 348 * or the custom time zone ID in normalized format.
michael@0 349 * @param isSystemID Receives if the given ID is a known system
michael@0 350 * time zone ID.
michael@0 351 * @param status Recevies the status. When the given time zone ID
michael@0 352 * is neither a known system time zone ID nor a
michael@0 353 * valid custom time zone ID, U_ILLEGAL_ARGUMENT_ERROR
michael@0 354 * is set.
michael@0 355 * @return A reference to the result.
michael@0 356 * @stable ICU 4.0
michael@0 357 */
michael@0 358 static UnicodeString& U_EXPORT2 getCanonicalID(const UnicodeString& id,
michael@0 359 UnicodeString& canonicalID, UBool& isSystemID, UErrorCode& status);
michael@0 360
michael@0 361 #ifndef U_HIDE_DRAFT_API
michael@0 362 /**
michael@0 363 * Converts a system time zone ID to an equivalent Windows time zone ID. For example,
michael@0 364 * Windows time zone ID "Pacific Standard Time" is returned for input "America/Los_Angeles".
michael@0 365 *
michael@0 366 * <p>There are system time zones that cannot be mapped to Windows zones. When the input
michael@0 367 * system time zone ID is unknown or unmappable to a Windows time zone, then the result will be
michael@0 368 * empty, but the operation itself remains successful (no error status set on return).
michael@0 369 *
michael@0 370 * <p>This implementation utilizes <a href="http://unicode.org/cldr/charts/supplemental/zone_tzid.html">
michael@0 371 * Zone-Tzid mapping data</a>. The mapping data is updated time to time. To get the latest changes,
michael@0 372 * please read the ICU user guide section <a href="http://userguide.icu-project.org/datetime/timezone#TOC-Updating-the-Time-Zone-Data">
michael@0 373 * Updating the Time Zone Data</a>.
michael@0 374 *
michael@0 375 * @param id A system time zone ID.
michael@0 376 * @param winid Receives a Windows time zone ID. When the input system time zone ID is unknown
michael@0 377 * or unmappable to a Windows time zone ID, then an empty string is set on return.
michael@0 378 * @param status Receives the status.
michael@0 379 * @return A reference to the result (<code>winid</code>).
michael@0 380 * @see getIDForWindowsID
michael@0 381 *
michael@0 382 * @draft ICU 52
michael@0 383 */
michael@0 384 static UnicodeString& U_EXPORT2 getWindowsID(const UnicodeString& id,
michael@0 385 UnicodeString& winid, UErrorCode& status);
michael@0 386
michael@0 387 /**
michael@0 388 * Converts a Windows time zone ID to an equivalent system time zone ID
michael@0 389 * for a region. For example, system time zone ID "America/Los_Angeles" is returned
michael@0 390 * for input Windows ID "Pacific Standard Time" and region "US" (or <code>null</code>),
michael@0 391 * "America/Vancouver" is returned for the same Windows ID "Pacific Standard Time" and
michael@0 392 * region "CA".
michael@0 393 *
michael@0 394 * <p>Not all Windows time zones can be mapped to system time zones. When the input
michael@0 395 * Windows time zone ID is unknown or unmappable to a system time zone, then the result
michael@0 396 * will be empty, but the operation itself remains successful (no error status set on return).
michael@0 397 *
michael@0 398 * <p>This implementation utilizes <a href="http://unicode.org/cldr/charts/supplemental/zone_tzid.html">
michael@0 399 * Zone-Tzid mapping data</a>. The mapping data is updated time to time. To get the latest changes,
michael@0 400 * please read the ICU user guide section <a href="http://userguide.icu-project.org/datetime/timezone#TOC-Updating-the-Time-Zone-Data">
michael@0 401 * Updating the Time Zone Data</a>.
michael@0 402 *
michael@0 403 * @param winid A Windows time zone ID.
michael@0 404 * @param region A null-terminated region code, or <code>NULL</code> if no regional preference.
michael@0 405 * @param id Receives a system time zone ID. When the input Windows time zone ID is unknown
michael@0 406 * or unmappable to a system time zone ID, then an empty string is set on return.
michael@0 407 * @param status Receives the status.
michael@0 408 * @return A reference to the result (<code>id</code>).
michael@0 409 * @see getWindowsID
michael@0 410 *
michael@0 411 * @draft ICU 52
michael@0 412 */
michael@0 413 static UnicodeString& U_EXPORT2 getIDForWindowsID(const UnicodeString& winid, const char* region,
michael@0 414 UnicodeString& id, UErrorCode& status);
michael@0 415
michael@0 416 #endif /* U_HIDE_DRAFT_API */
michael@0 417
michael@0 418 /**
michael@0 419 * Returns true if the two TimeZones are equal. (The TimeZone version only compares
michael@0 420 * IDs, but subclasses are expected to also compare the fields they add.)
michael@0 421 *
michael@0 422 * @param that The TimeZone object to be compared with.
michael@0 423 * @return True if the given TimeZone is equal to this TimeZone; false
michael@0 424 * otherwise.
michael@0 425 * @stable ICU 2.0
michael@0 426 */
michael@0 427 virtual UBool operator==(const TimeZone& that) const;
michael@0 428
michael@0 429 /**
michael@0 430 * Returns true if the two TimeZones are NOT equal; that is, if operator==() returns
michael@0 431 * false.
michael@0 432 *
michael@0 433 * @param that The TimeZone object to be compared with.
michael@0 434 * @return True if the given TimeZone is not equal to this TimeZone; false
michael@0 435 * otherwise.
michael@0 436 * @stable ICU 2.0
michael@0 437 */
michael@0 438 UBool operator!=(const TimeZone& that) const {return !operator==(that);}
michael@0 439
michael@0 440 /**
michael@0 441 * Returns the TimeZone's adjusted GMT offset (i.e., the number of milliseconds to add
michael@0 442 * to GMT to get local time in this time zone, taking daylight savings time into
michael@0 443 * account) as of a particular reference date. The reference date is used to determine
michael@0 444 * whether daylight savings time is in effect and needs to be figured into the offset
michael@0 445 * that is returned (in other words, what is the adjusted GMT offset in this time zone
michael@0 446 * at this particular date and time?). For the time zones produced by createTimeZone(),
michael@0 447 * the reference data is specified according to the Gregorian calendar, and the date
michael@0 448 * and time fields are local standard time.
michael@0 449 *
michael@0 450 * <p>Note: Don't call this method. Instead, call the getOffset(UDate...) overload,
michael@0 451 * which returns both the raw and the DST offset for a given time. This method
michael@0 452 * is retained only for backward compatibility.
michael@0 453 *
michael@0 454 * @param era The reference date's era
michael@0 455 * @param year The reference date's year
michael@0 456 * @param month The reference date's month (0-based; 0 is January)
michael@0 457 * @param day The reference date's day-in-month (1-based)
michael@0 458 * @param dayOfWeek The reference date's day-of-week (1-based; 1 is Sunday)
michael@0 459 * @param millis The reference date's milliseconds in day, local standard time
michael@0 460 * @param status Output param to filled in with a success or an error.
michael@0 461 * @return The offset in milliseconds to add to GMT to get local time.
michael@0 462 * @stable ICU 2.0
michael@0 463 */
michael@0 464 virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day,
michael@0 465 uint8_t dayOfWeek, int32_t millis, UErrorCode& status) const = 0;
michael@0 466
michael@0 467 /**
michael@0 468 * Gets the time zone offset, for current date, modified in case of
michael@0 469 * daylight savings. This is the offset to add *to* UTC to get local time.
michael@0 470 *
michael@0 471 * <p>Note: Don't call this method. Instead, call the getOffset(UDate...) overload,
michael@0 472 * which returns both the raw and the DST offset for a given time. This method
michael@0 473 * is retained only for backward compatibility.
michael@0 474 *
michael@0 475 * @param era the era of the given date.
michael@0 476 * @param year the year in the given date.
michael@0 477 * @param month the month in the given date.
michael@0 478 * Month is 0-based. e.g., 0 for January.
michael@0 479 * @param day the day-in-month of the given date.
michael@0 480 * @param dayOfWeek the day-of-week of the given date.
michael@0 481 * @param milliseconds the millis in day in <em>standard</em> local time.
michael@0 482 * @param monthLength the length of the given month in days.
michael@0 483 * @param status Output param to filled in with a success or an error.
michael@0 484 * @return the offset to add *to* GMT to get local time.
michael@0 485 * @stable ICU 2.0
michael@0 486 */
michael@0 487 virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day,
michael@0 488 uint8_t dayOfWeek, int32_t milliseconds,
michael@0 489 int32_t monthLength, UErrorCode& status) const = 0;
michael@0 490
michael@0 491 /**
michael@0 492 * Returns the time zone raw and GMT offset for the given moment
michael@0 493 * in time. Upon return, local-millis = GMT-millis + rawOffset +
michael@0 494 * dstOffset. All computations are performed in the proleptic
michael@0 495 * Gregorian calendar. The default implementation in the TimeZone
michael@0 496 * class delegates to the 8-argument getOffset().
michael@0 497 *
michael@0 498 * @param date moment in time for which to return offsets, in
michael@0 499 * units of milliseconds from January 1, 1970 0:00 GMT, either GMT
michael@0 500 * time or local wall time, depending on `local'.
michael@0 501 * @param local if true, `date' is local wall time; otherwise it
michael@0 502 * is in GMT time.
michael@0 503 * @param rawOffset output parameter to receive the raw offset, that
michael@0 504 * is, the offset not including DST adjustments
michael@0 505 * @param dstOffset output parameter to receive the DST offset,
michael@0 506 * that is, the offset to be added to `rawOffset' to obtain the
michael@0 507 * total offset between local and GMT time. If DST is not in
michael@0 508 * effect, this value is zero; otherwise it is a positive value,
michael@0 509 * typically one hour.
michael@0 510 * @param ec input-output error code
michael@0 511 *
michael@0 512 * @stable ICU 2.8
michael@0 513 */
michael@0 514 virtual void getOffset(UDate date, UBool local, int32_t& rawOffset,
michael@0 515 int32_t& dstOffset, UErrorCode& ec) const;
michael@0 516
michael@0 517 /**
michael@0 518 * Sets the TimeZone's raw GMT offset (i.e., the number of milliseconds to add
michael@0 519 * to GMT to get local time, before taking daylight savings time into account).
michael@0 520 *
michael@0 521 * @param offsetMillis The new raw GMT offset for this time zone.
michael@0 522 * @stable ICU 2.0
michael@0 523 */
michael@0 524 virtual void setRawOffset(int32_t offsetMillis) = 0;
michael@0 525
michael@0 526 /**
michael@0 527 * Returns the TimeZone's raw GMT offset (i.e., the number of milliseconds to add
michael@0 528 * to GMT to get local time, before taking daylight savings time into account).
michael@0 529 *
michael@0 530 * @return The TimeZone's raw GMT offset.
michael@0 531 * @stable ICU 2.0
michael@0 532 */
michael@0 533 virtual int32_t getRawOffset(void) const = 0;
michael@0 534
michael@0 535 /**
michael@0 536 * Fills in "ID" with the TimeZone's ID.
michael@0 537 *
michael@0 538 * @param ID Receives this TimeZone's ID.
michael@0 539 * @return A reference to 'ID'
michael@0 540 * @stable ICU 2.0
michael@0 541 */
michael@0 542 UnicodeString& getID(UnicodeString& ID) const;
michael@0 543
michael@0 544 /**
michael@0 545 * Sets the TimeZone's ID to the specified value. This doesn't affect any other
michael@0 546 * fields (for example, if you say<
michael@0 547 * blockquote><pre>
michael@0 548 * . TimeZone* foo = TimeZone::createTimeZone("America/New_York");
michael@0 549 * . foo.setID("America/Los_Angeles");
michael@0 550 * </pre>\htmlonly</blockquote>\endhtmlonly
michael@0 551 * the time zone's GMT offset and daylight-savings rules don't change to those for
michael@0 552 * Los Angeles. They're still those for New York. Only the ID has changed.)
michael@0 553 *
michael@0 554 * @param ID The new time zone ID.
michael@0 555 * @stable ICU 2.0
michael@0 556 */
michael@0 557 void setID(const UnicodeString& ID);
michael@0 558
michael@0 559 /**
michael@0 560 * Enum for use with getDisplayName
michael@0 561 * @stable ICU 2.4
michael@0 562 */
michael@0 563 enum EDisplayType {
michael@0 564 /**
michael@0 565 * Selector for short display name
michael@0 566 * @stable ICU 2.4
michael@0 567 */
michael@0 568 SHORT = 1,
michael@0 569 /**
michael@0 570 * Selector for long display name
michael@0 571 * @stable ICU 2.4
michael@0 572 */
michael@0 573 LONG,
michael@0 574 /**
michael@0 575 * Selector for short generic display name
michael@0 576 * @stable ICU 4.4
michael@0 577 */
michael@0 578 SHORT_GENERIC,
michael@0 579 /**
michael@0 580 * Selector for long generic display name
michael@0 581 * @stable ICU 4.4
michael@0 582 */
michael@0 583 LONG_GENERIC,
michael@0 584 /**
michael@0 585 * Selector for short display name derived
michael@0 586 * from time zone offset
michael@0 587 * @stable ICU 4.4
michael@0 588 */
michael@0 589 SHORT_GMT,
michael@0 590 /**
michael@0 591 * Selector for long display name derived
michael@0 592 * from time zone offset
michael@0 593 * @stable ICU 4.4
michael@0 594 */
michael@0 595 LONG_GMT,
michael@0 596 /**
michael@0 597 * Selector for short display name derived
michael@0 598 * from the time zone's fallback name
michael@0 599 * @stable ICU 4.4
michael@0 600 */
michael@0 601 SHORT_COMMONLY_USED,
michael@0 602 /**
michael@0 603 * Selector for long display name derived
michael@0 604 * from the time zone's fallback name
michael@0 605 * @stable ICU 4.4
michael@0 606 */
michael@0 607 GENERIC_LOCATION
michael@0 608 };
michael@0 609
michael@0 610 /**
michael@0 611 * Returns a name of this time zone suitable for presentation to the user
michael@0 612 * in the default locale.
michael@0 613 * This method returns the long name, not including daylight savings.
michael@0 614 * If the display name is not available for the locale,
michael@0 615 * then this method returns a string in the format
michael@0 616 * <code>GMT[+-]hh:mm</code>.
michael@0 617 * @param result the human-readable name of this time zone in the default locale.
michael@0 618 * @return A reference to 'result'.
michael@0 619 * @stable ICU 2.0
michael@0 620 */
michael@0 621 UnicodeString& getDisplayName(UnicodeString& result) const;
michael@0 622
michael@0 623 /**
michael@0 624 * Returns a name of this time zone suitable for presentation to the user
michael@0 625 * in the specified locale.
michael@0 626 * This method returns the long name, not including daylight savings.
michael@0 627 * If the display name is not available for the locale,
michael@0 628 * then this method returns a string in the format
michael@0 629 * <code>GMT[+-]hh:mm</code>.
michael@0 630 * @param locale the locale in which to supply the display name.
michael@0 631 * @param result the human-readable name of this time zone in the given locale
michael@0 632 * or in the default locale if the given locale is not recognized.
michael@0 633 * @return A reference to 'result'.
michael@0 634 * @stable ICU 2.0
michael@0 635 */
michael@0 636 UnicodeString& getDisplayName(const Locale& locale, UnicodeString& result) const;
michael@0 637
michael@0 638 /**
michael@0 639 * Returns a name of this time zone suitable for presentation to the user
michael@0 640 * in the default locale.
michael@0 641 * If the display name is not available for the locale,
michael@0 642 * then this method returns a string in the format
michael@0 643 * <code>GMT[+-]hh:mm</code>.
michael@0 644 * @param daylight if true, return the daylight savings name.
michael@0 645 * @param style
michael@0 646 * @param result the human-readable name of this time zone in the default locale.
michael@0 647 * @return A reference to 'result'.
michael@0 648 * @stable ICU 2.0
michael@0 649 */
michael@0 650 UnicodeString& getDisplayName(UBool daylight, EDisplayType style, UnicodeString& result) const;
michael@0 651
michael@0 652 /**
michael@0 653 * Returns a name of this time zone suitable for presentation to the user
michael@0 654 * in the specified locale.
michael@0 655 * If the display name is not available for the locale,
michael@0 656 * then this method returns a string in the format
michael@0 657 * <code>GMT[+-]hh:mm</code>.
michael@0 658 * @param daylight if true, return the daylight savings name.
michael@0 659 * @param style
michael@0 660 * @param locale the locale in which to supply the display name.
michael@0 661 * @param result the human-readable name of this time zone in the given locale
michael@0 662 * or in the default locale if the given locale is not recognized.
michael@0 663 * @return A refence to 'result'.
michael@0 664 * @stable ICU 2.0
michael@0 665 */
michael@0 666 UnicodeString& getDisplayName(UBool daylight, EDisplayType style, const Locale& locale, UnicodeString& result) const;
michael@0 667
michael@0 668 /**
michael@0 669 * Queries if this time zone uses daylight savings time.
michael@0 670 * @return true if this time zone uses daylight savings time,
michael@0 671 * false, otherwise.
michael@0 672 * <p><strong>Note:</strong>The default implementation of
michael@0 673 * ICU TimeZone uses the tz database, which supports historic
michael@0 674 * rule changes, for system time zones. With the implementation,
michael@0 675 * there are time zones that used daylight savings time in the
michael@0 676 * past, but no longer used currently. For example, Asia/Tokyo has
michael@0 677 * never used daylight savings time since 1951. Most clients would
michael@0 678 * expect that this method to return <code>FALSE</code> for such case.
michael@0 679 * The default implementation of this method returns <code>TRUE</code>
michael@0 680 * when the time zone uses daylight savings time in the current
michael@0 681 * (Gregorian) calendar year.
michael@0 682 * <p>In Java 7, <code>observesDaylightTime()</code> was added in
michael@0 683 * addition to <code>useDaylightTime()</code>. In Java, <code>useDaylightTime()</code>
michael@0 684 * only checks if daylight saving time is observed by the last known
michael@0 685 * rule. This specification might not be what most users would expect
michael@0 686 * if daylight saving time is currently observed, but not scheduled
michael@0 687 * in future. In this case, Java's <code>userDaylightTime()</code> returns
michael@0 688 * <code>false</code>. To resolve the issue, Java 7 added <code>observesDaylightTime()</code>,
michael@0 689 * which takes the current rule into account. The method <code>observesDaylightTime()</code>
michael@0 690 * was added in ICU4J for supporting API signature compatibility with JDK.
michael@0 691 * In general, ICU4C also provides JDK compatible methods, but the current
michael@0 692 * implementation <code>userDaylightTime()</code> serves the purpose
michael@0 693 * (takes the current rule into account), <code>observesDaylightTime()</code>
michael@0 694 * is not added in ICU4C. In addition to <code>useDaylightTime()</code>, ICU4C
michael@0 695 * <code>BasicTimeZone</code> class (Note that <code>TimeZone::createTimeZone(const UnicodeString &ID)</code>
michael@0 696 * always returns a <code>BasicTimeZone</code>) provides a series of methods allowing
michael@0 697 * historic and future time zone rule iteration, so you can check if daylight saving
michael@0 698 * time is observed or not within a given period.
michael@0 699 *
michael@0 700 * @stable ICU 2.0
michael@0 701 */
michael@0 702 virtual UBool useDaylightTime(void) const = 0;
michael@0 703
michael@0 704 /**
michael@0 705 * Queries if the given date is in daylight savings time in
michael@0 706 * this time zone.
michael@0 707 * This method is wasteful since it creates a new GregorianCalendar and
michael@0 708 * deletes it each time it is called. This is a deprecated method
michael@0 709 * and provided only for Java compatibility.
michael@0 710 *
michael@0 711 * @param date the given UDate.
michael@0 712 * @param status Output param filled in with success/error code.
michael@0 713 * @return true if the given date is in daylight savings time,
michael@0 714 * false, otherwise.
michael@0 715 * @deprecated ICU 2.4. Use Calendar::inDaylightTime() instead.
michael@0 716 */
michael@0 717 virtual UBool inDaylightTime(UDate date, UErrorCode& status) const = 0;
michael@0 718
michael@0 719 /**
michael@0 720 * Returns true if this zone has the same rule and offset as another zone.
michael@0 721 * That is, if this zone differs only in ID, if at all.
michael@0 722 * @param other the <code>TimeZone</code> object to be compared with
michael@0 723 * @return true if the given zone is the same as this one,
michael@0 724 * with the possible exception of the ID
michael@0 725 * @stable ICU 2.0
michael@0 726 */
michael@0 727 virtual UBool hasSameRules(const TimeZone& other) const;
michael@0 728
michael@0 729 /**
michael@0 730 * Clones TimeZone objects polymorphically. Clients are responsible for deleting
michael@0 731 * the TimeZone object cloned.
michael@0 732 *
michael@0 733 * @return A new copy of this TimeZone object.
michael@0 734 * @stable ICU 2.0
michael@0 735 */
michael@0 736 virtual TimeZone* clone(void) const = 0;
michael@0 737
michael@0 738 /**
michael@0 739 * Return the class ID for this class. This is useful only for
michael@0 740 * comparing to a return value from getDynamicClassID().
michael@0 741 * @return The class ID for all objects of this class.
michael@0 742 * @stable ICU 2.0
michael@0 743 */
michael@0 744 static UClassID U_EXPORT2 getStaticClassID(void);
michael@0 745
michael@0 746 /**
michael@0 747 * Returns a unique class ID POLYMORPHICALLY. This method is to
michael@0 748 * implement a simple version of RTTI, since not all C++ compilers support genuine
michael@0 749 * RTTI. Polymorphic operator==() and clone() methods call this method.
michael@0 750 * <P>
michael@0 751 * Concrete subclasses of TimeZone must use the UOBJECT_DEFINE_RTTI_IMPLEMENTATION
michael@0 752 * macro from uobject.h in their implementation to provide correct RTTI information.
michael@0 753 * @return The class ID for this object. All objects of a given class have the
michael@0 754 * same class ID. Objects of other classes have different class IDs.
michael@0 755 * @stable ICU 2.0
michael@0 756 */
michael@0 757 virtual UClassID getDynamicClassID(void) const = 0;
michael@0 758
michael@0 759 /**
michael@0 760 * Returns the amount of time to be added to local standard time
michael@0 761 * to get local wall clock time.
michael@0 762 * <p>
michael@0 763 * The default implementation always returns 3600000 milliseconds
michael@0 764 * (i.e., one hour) if this time zone observes Daylight Saving
michael@0 765 * Time. Otherwise, 0 (zero) is returned.
michael@0 766 * <p>
michael@0 767 * If an underlying TimeZone implementation subclass supports
michael@0 768 * historical Daylight Saving Time changes, this method returns
michael@0 769 * the known latest daylight saving value.
michael@0 770 *
michael@0 771 * @return the amount of saving time in milliseconds
michael@0 772 * @stable ICU 3.6
michael@0 773 */
michael@0 774 virtual int32_t getDSTSavings() const;
michael@0 775
michael@0 776 /**
michael@0 777 * Gets the region code associated with the given
michael@0 778 * system time zone ID. The region code is either ISO 3166
michael@0 779 * 2-letter country code or UN M.49 3-digit area code.
michael@0 780 * When the time zone is not associated with a specific location,
michael@0 781 * for example - "Etc/UTC", "EST5EDT", then this method returns
michael@0 782 * "001" (UN M.49 area code for World).
michael@0 783 *
michael@0 784 * @param id The system time zone ID.
michael@0 785 * @param region Output buffer for receiving the region code.
michael@0 786 * @param capacity The size of the output buffer.
michael@0 787 * @param status Receives the status. When the given time zone ID
michael@0 788 * is not a known system time zone ID,
michael@0 789 * U_ILLEGAL_ARGUMENT_ERROR is set.
michael@0 790 * @return The length of the output region code.
michael@0 791 * @stable ICU 4.8
michael@0 792 */
michael@0 793 static int32_t U_EXPORT2 getRegion(const UnicodeString& id,
michael@0 794 char *region, int32_t capacity, UErrorCode& status);
michael@0 795
michael@0 796 protected:
michael@0 797
michael@0 798 /**
michael@0 799 * Default constructor. ID is initialized to the empty string.
michael@0 800 * @stable ICU 2.0
michael@0 801 */
michael@0 802 TimeZone();
michael@0 803
michael@0 804 /**
michael@0 805 * Construct a TimeZone with a given ID.
michael@0 806 * @param id a system time zone ID
michael@0 807 * @stable ICU 2.0
michael@0 808 */
michael@0 809 TimeZone(const UnicodeString &id);
michael@0 810
michael@0 811 /**
michael@0 812 * Copy constructor.
michael@0 813 * @param source the object to be copied.
michael@0 814 * @stable ICU 2.0
michael@0 815 */
michael@0 816 TimeZone(const TimeZone& source);
michael@0 817
michael@0 818 /**
michael@0 819 * Default assignment operator.
michael@0 820 * @param right the object to be copied.
michael@0 821 * @stable ICU 2.0
michael@0 822 */
michael@0 823 TimeZone& operator=(const TimeZone& right);
michael@0 824
michael@0 825 #ifndef U_HIDE_INTERNAL_API
michael@0 826 /**
michael@0 827 * Utility function. For internally loading rule data.
michael@0 828 * @param top Top resource bundle for tz data
michael@0 829 * @param ruleid ID of rule to load
michael@0 830 * @param oldbundle Old bundle to reuse or NULL
michael@0 831 * @param status Status parameter
michael@0 832 * @return either a new bundle or *oldbundle
michael@0 833 * @internal
michael@0 834 */
michael@0 835 static UResourceBundle* loadRule(const UResourceBundle* top, const UnicodeString& ruleid, UResourceBundle* oldbundle, UErrorCode&status);
michael@0 836 #endif /* U_HIDE_INTERNAL_API */
michael@0 837
michael@0 838 private:
michael@0 839 friend class ZoneMeta;
michael@0 840
michael@0 841
michael@0 842 static TimeZone* createCustomTimeZone(const UnicodeString&); // Creates a time zone based on the string.
michael@0 843
michael@0 844 /**
michael@0 845 * Finds the given ID in the Olson tzdata. If the given ID is found in the tzdata,
michael@0 846 * returns the pointer to the ID resource. This method is exposed through ZoneMeta class
michael@0 847 * for ICU internal implementation and useful for building hashtable using a time zone
michael@0 848 * ID as a key.
michael@0 849 * @param id zone id string
michael@0 850 * @return the pointer of the ID resource, or NULL.
michael@0 851 */
michael@0 852 static const UChar* findID(const UnicodeString& id);
michael@0 853
michael@0 854 /**
michael@0 855 * Resolve a link in Olson tzdata. When the given id is known and it's not a link,
michael@0 856 * the id itself is returned. When the given id is known and it is a link, then
michael@0 857 * dereferenced zone id is returned. When the given id is unknown, then it returns
michael@0 858 * NULL.
michael@0 859 * @param id zone id string
michael@0 860 * @return the dereferenced zone or NULL
michael@0 861 */
michael@0 862 static const UChar* dereferOlsonLink(const UnicodeString& id);
michael@0 863
michael@0 864 /**
michael@0 865 * Returns the region code associated with the given zone,
michael@0 866 * or NULL if the zone is not known.
michael@0 867 * @param id zone id string
michael@0 868 * @return the region associated with the given zone
michael@0 869 */
michael@0 870 static const UChar* getRegion(const UnicodeString& id);
michael@0 871
michael@0 872 public:
michael@0 873 #ifndef U_HIDE_INTERNAL_API
michael@0 874 /**
michael@0 875 * Returns the region code associated with the given zone,
michael@0 876 * or NULL if the zone is not known.
michael@0 877 * @param id zone id string
michael@0 878 * @param status Status parameter
michael@0 879 * @return the region associated with the given zone
michael@0 880 * @internal
michael@0 881 */
michael@0 882 static const UChar* getRegion(const UnicodeString& id, UErrorCode& status);
michael@0 883 #endif /* U_HIDE_INTERNAL_API */
michael@0 884
michael@0 885 private:
michael@0 886 /**
michael@0 887 * Parses the given custom time zone identifier
michael@0 888 * @param id id A string of the form GMT[+-]hh:mm, GMT[+-]hhmm, or
michael@0 889 * GMT[+-]hh.
michael@0 890 * @param sign Receves parsed sign, 1 for positive, -1 for negative.
michael@0 891 * @param hour Receives parsed hour field
michael@0 892 * @param minute Receives parsed minute field
michael@0 893 * @param second Receives parsed second field
michael@0 894 * @return Returns TRUE when the given custom id is valid.
michael@0 895 */
michael@0 896 static UBool parseCustomID(const UnicodeString& id, int32_t& sign, int32_t& hour,
michael@0 897 int32_t& minute, int32_t& second);
michael@0 898
michael@0 899 /**
michael@0 900 * Parse a custom time zone identifier and return the normalized
michael@0 901 * custom time zone identifier for the given custom id string.
michael@0 902 * @param id a string of the form GMT[+-]hh:mm, GMT[+-]hhmm, or
michael@0 903 * GMT[+-]hh.
michael@0 904 * @param normalized Receives the normalized custom ID
michael@0 905 * @param status Receives the status. When the input ID string is invalid,
michael@0 906 * U_ILLEGAL_ARGUMENT_ERROR is set.
michael@0 907 * @return The normalized custom id string.
michael@0 908 */
michael@0 909 static UnicodeString& getCustomID(const UnicodeString& id, UnicodeString& normalized,
michael@0 910 UErrorCode& status);
michael@0 911
michael@0 912 /**
michael@0 913 * Returns the normalized custome time zone ID for the given offset fields.
michael@0 914 * @param hour offset hours
michael@0 915 * @param min offset minutes
michael@0 916 * @param sec offset seconds
michael@0 917 * @param negative sign of the offset, TRUE for negative offset.
michael@0 918 * @param id Receves the format result (normalized custom ID)
michael@0 919 * @return The reference to id
michael@0 920 */
michael@0 921 static UnicodeString& formatCustomID(int32_t hour, int32_t min, int32_t sec,
michael@0 922 UBool negative, UnicodeString& id);
michael@0 923
michael@0 924 UnicodeString fID; // this time zone's ID
michael@0 925
michael@0 926 friend class TZEnumeration;
michael@0 927 };
michael@0 928
michael@0 929
michael@0 930 // -------------------------------------
michael@0 931
michael@0 932 inline UnicodeString&
michael@0 933 TimeZone::getID(UnicodeString& ID) const
michael@0 934 {
michael@0 935 ID = fID;
michael@0 936 return ID;
michael@0 937 }
michael@0 938
michael@0 939 // -------------------------------------
michael@0 940
michael@0 941 inline void
michael@0 942 TimeZone::setID(const UnicodeString& ID)
michael@0 943 {
michael@0 944 fID = ID;
michael@0 945 }
michael@0 946 U_NAMESPACE_END
michael@0 947
michael@0 948 #endif /* #if !UCONFIG_NO_FORMATTING */
michael@0 949
michael@0 950 #endif //_TIMEZONE
michael@0 951 //eof

mercurial