00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef TIMEZONE_H
00027 #define TIMEZONE_H
00028
00029 #include "unicode/unistr.h"
00030
00031 U_NAMESPACE_BEGIN
00032
00105 class U_I18N_API TimeZone {
00106 public:
00110 virtual ~TimeZone();
00111
00112 #ifdef ICU_TIMEZONE_USE_DEPRECATES
00113
00119 static const TimeZone* GMT;
00120 #endif
00121
00126 static const TimeZone* getGMT(void);
00127
00139 static TimeZone* createTimeZone(const UnicodeString& ID);
00140
00162 static const UnicodeString** const createAvailableIDs(int32_t rawOffset, int32_t& numIDs);
00163
00182 static const UnicodeString** const createAvailableIDs(const char* country,
00183 int32_t& numIDs);
00184
00196 static const UnicodeString** const createAvailableIDs(int32_t& numIDs);
00197
00212 static int32_t countEquivalentIDs(const UnicodeString& id);
00213
00233 static const UnicodeString getEquivalentID(const UnicodeString& id,
00234 int32_t index);
00235
00248 static TimeZone* createDefault(void);
00249
00259 static void adoptDefault(TimeZone* zone);
00260
00268 static void setDefault(const TimeZone& zone);
00269
00279 virtual UBool operator==(const TimeZone& that) const;
00280
00290 UBool operator!=(const TimeZone& that) const {return !operator==(that);}
00291
00311 virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day,
00312 uint8_t dayOfWeek, int32_t millis, UErrorCode& status) const = 0;
00316 virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day,
00317 uint8_t dayOfWeek, int32_t millis) const = 0;
00318
00333 virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day,
00334 uint8_t dayOfWeek, int32_t milliseconds,
00335 int32_t monthLength, UErrorCode& status) const = 0;
00336
00344 virtual void setRawOffset(int32_t offsetMillis) = 0;
00345
00353 virtual int32_t getRawOffset(void) const = 0;
00354
00362 UnicodeString& getID(UnicodeString& ID) const;
00363
00377 void setID(const UnicodeString& ID);
00378
00383 enum EDisplayType {
00384 SHORT = 1,
00385 LONG
00386 };
00387
00398 UnicodeString& getDisplayName(UnicodeString& result) const;
00399
00412 UnicodeString& getDisplayName(const Locale& locale, UnicodeString& result) const;
00413
00425 UnicodeString& getDisplayName(UBool daylight, EDisplayType style, UnicodeString& result) const;
00426
00440 UnicodeString& getDisplayName(UBool daylight, EDisplayType style, const Locale& locale, UnicodeString& result) const;
00441
00448 virtual UBool useDaylightTime(void) const = 0;
00449
00458 virtual UBool inDaylightTime(UDate date, UErrorCode& status) const = 0;
00459
00468 virtual UBool hasSameRules(const TimeZone& other) const;
00469
00477 virtual TimeZone* clone(void) const = 0;
00478
00490 static UClassID getStaticClassID(void) { return (UClassID)&fgClassID; }
00491
00507 virtual UClassID getDynamicClassID(void) const = 0;
00508
00509 protected:
00510
00515 TimeZone();
00516
00521 TimeZone(const UnicodeString &id);
00522
00527 TimeZone(const TimeZone& source);
00528
00533 TimeZone& operator=(const TimeZone& right);
00534
00535 private:
00536 static const char fgClassID;
00537
00538 static TimeZone* createCustomTimeZone(const UnicodeString&);
00539
00545 static void initDefault(void);
00546
00547
00548 static TimeZone* createSystemTimeZone(const UnicodeString& name);
00549
00550 UnicodeString fID;
00551 };
00552
00553
00554
00555
00556 inline UnicodeString&
00557 TimeZone::getID(UnicodeString& ID) const
00558 {
00559 ID = fID;
00560 return ID;
00561 }
00562
00563
00564
00565 inline void
00566 TimeZone::setID(const UnicodeString& ID)
00567 {
00568 fID = ID;
00569 }
00570 U_NAMESPACE_END
00571
00572 #endif //_TIMEZONE
00573