Main Page | Class Hierarchy | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

timezone.h

00001 /* 00002 * Copyright (C) {1997-2001}, 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/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** createAvailableIDs(int32_t rawOffset, int32_t& numIDs); 00163 00182 static const UnicodeString** createAvailableIDs(const char* country, 00183 int32_t& numIDs); 00184 00196 static const UnicodeString** 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&); // Creates a time zone based on the string. 00539 00545 static void initDefault(void); 00546 00547 // See source file for documentation 00548 static TimeZone* createSystemTimeZone(const UnicodeString& name); 00549 00550 UnicodeString fID; // this time zone's ID 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 //eof

Generated on Wed Jul 28 05:45:13 2004 for ICU 2.1 by doxygen 1.3.7