timezone.h

Go to the documentation of this file.
00001 /* 00002 * Copyright (C) {1997-2004}, International Business Machines Corporation and others. All Rights Reserved. 00003 ******************************************************************************** 00004 * 00005 * File TIMEZONE.H 00006 * 00007 * Modification History: 00008 * 00009 * Date Name Description 00010 * 04/21/97 aliu Overhauled header. 00011 * 07/09/97 helena Changed createInstance to createDefault. 00012 * 08/06/97 aliu Removed dependency on internal header for Hashtable. 00013 * 08/10/98 stephen Changed getDisplayName() API conventions to match 00014 * 08/19/98 stephen Changed createTimeZone() to never return 0 00015 * 09/02/98 stephen Sync to JDK 1.2 8/31 00016 * - Added getOffset(... monthlen ...) 00017 * - Added hasSameRules() 00018 * 09/15/98 stephen Added getStaticClassID 00019 * 12/03/99 aliu Moved data out of static table into icudata.dll. 00020 * Hashtable replaced by new static data structures. 00021 * 12/14/99 aliu Made GMT public. 00022 * 08/15/01 grhoten Made GMT private and added the getGMT() function 00023 ******************************************************************************** 00024 */ 00025 00026 #ifndef TIMEZONE_H 00027 #define TIMEZONE_H 00028 00029 #include "unicode/utypes.h" 00030 00031 #if !UCONFIG_NO_FORMATTING 00032 00033 #include "unicode/uobject.h" 00034 #include "unicode/unistr.h" 00035 #include "unicode/ures.h" 00036 00037 U_NAMESPACE_BEGIN 00038 00039 class StringEnumeration; 00040 00115 class U_I18N_API TimeZone : public UObject { 00116 public: 00120 virtual ~TimeZone(); 00121 00128 static const TimeZone* getGMT(void); 00129 00141 static TimeZone* createTimeZone(const UnicodeString& ID); 00142 00150 static StringEnumeration* createEnumeration(); 00151 00169 static StringEnumeration* createEnumeration(int32_t rawOffset); 00170 00181 static StringEnumeration* createEnumeration(const char* country); 00182 00183 #ifdef U_USE_TIMEZONE_OBSOLETE_2_8 00184 00207 static const UnicodeString** createAvailableIDs(int32_t rawOffset, int32_t& numIDs); 00208 00230 static const UnicodeString** createAvailableIDs(const char* country, 00231 int32_t& numIDs); 00232 00246 static const UnicodeString** createAvailableIDs(int32_t& numIDs); 00247 #endif 00248 00263 static int32_t countEquivalentIDs(const UnicodeString& id); 00264 00284 static const UnicodeString getEquivalentID(const UnicodeString& id, 00285 int32_t index); 00286 00299 static TimeZone* createDefault(void); 00300 00310 static void adoptDefault(TimeZone* zone); 00311 00319 static void setDefault(const TimeZone& zone); 00320 00330 virtual UBool operator==(const TimeZone& that) const; 00331 00341 UBool operator!=(const TimeZone& that) const {return !operator==(that);} 00342 00367 virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day, 00368 uint8_t dayOfWeek, int32_t millis, UErrorCode& status) const = 0; 00369 00390 virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day, 00391 uint8_t dayOfWeek, int32_t milliseconds, 00392 int32_t monthLength, UErrorCode& status) const = 0; 00393 00417 virtual void getOffset(UDate date, UBool local, int32_t& rawOffset, 00418 int32_t& dstOffset, UErrorCode& ec) const; 00419 00427 virtual void setRawOffset(int32_t offsetMillis) = 0; 00428 00436 virtual int32_t getRawOffset(void) const = 0; 00437 00445 UnicodeString& getID(UnicodeString& ID) const; 00446 00460 void setID(const UnicodeString& ID); 00461 00466 enum EDisplayType { 00471 SHORT = 1, 00476 LONG 00477 }; 00478 00490 UnicodeString& getDisplayName(UnicodeString& result) const; 00491 00505 UnicodeString& getDisplayName(const Locale& locale, UnicodeString& result) const; 00506 00519 UnicodeString& getDisplayName(UBool daylight, EDisplayType style, UnicodeString& result) const; 00520 00535 UnicodeString& getDisplayName(UBool daylight, EDisplayType style, const Locale& locale, UnicodeString& result) const; 00536 00543 virtual UBool useDaylightTime(void) const = 0; 00544 00558 virtual UBool inDaylightTime(UDate date, UErrorCode& status) const = 0; 00559 00568 virtual UBool hasSameRules(const TimeZone& other) const; 00569 00577 virtual TimeZone* clone(void) const = 0; 00578 00585 static UClassID getStaticClassID(void); 00586 00598 virtual UClassID getDynamicClassID(void) const = 0; 00599 00600 protected: 00601 00606 TimeZone(); 00607 00613 TimeZone(const UnicodeString &id); 00614 00620 TimeZone(const TimeZone& source); 00621 00627 TimeZone& operator=(const TimeZone& right); 00628 00638 static UResourceBundle* loadRule(const UResourceBundle* top, const UnicodeString& ruleid, UResourceBundle* oldbundle, UErrorCode&status); 00639 00640 private: 00641 static TimeZone* createCustomTimeZone(const UnicodeString&); // Creates a time zone based on the string. 00642 00648 static void initDefault(void); 00649 00650 // See source file for documentation 00658 static TimeZone* createSystemTimeZone(const UnicodeString& name); 00659 00660 UnicodeString fID; // this time zone's ID 00661 }; 00662 00663 00664 // ------------------------------------- 00665 00666 inline UnicodeString& 00667 TimeZone::getID(UnicodeString& ID) const 00668 { 00669 ID = fID; 00670 return ID; 00671 } 00672 00673 // ------------------------------------- 00674 00675 inline void 00676 TimeZone::setID(const UnicodeString& ID) 00677 { 00678 fID = ID; 00679 } 00680 U_NAMESPACE_END 00681 00682 #endif /* #if !UCONFIG_NO_FORMATTING */ 00683 00684 #endif //_TIMEZONE 00685 //eof

Generated on Fri Jun 18 12:35:59 2004 for ICU by doxygen 1.3.7