Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

timezone.h

Go to the documentation of this file.
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/utypes.h"
00030 #include "unicode/uobject.h"
00031 #include "unicode/unistr.h"
00032 
00033 U_NAMESPACE_BEGIN
00034 
00107 class U_I18N_API TimeZone : public UObject {
00108 public:
00112     virtual ~TimeZone();
00113 
00114 #ifdef ICU_TIMEZONE_USE_DEPRECATES
00115 
00121     static const TimeZone* GMT;
00122 #endif
00123 
00130     static const TimeZone* getGMT(void);
00131 
00143     static TimeZone* createTimeZone(const UnicodeString& ID);
00144 
00166     static const UnicodeString** createAvailableIDs(int32_t rawOffset, int32_t& numIDs);
00167 
00186     static const UnicodeString** createAvailableIDs(const char* country,
00187                                                           int32_t& numIDs);
00188 
00200     static const UnicodeString** createAvailableIDs(int32_t& numIDs);
00201 
00216     static int32_t countEquivalentIDs(const UnicodeString& id);
00217 
00237     static const UnicodeString getEquivalentID(const UnicodeString& id,
00238                                                int32_t index);
00239 
00252     static TimeZone* createDefault(void);
00253 
00263     static void adoptDefault(TimeZone* zone);
00264 
00272     static void setDefault(const TimeZone& zone);
00273 
00283     virtual UBool operator==(const TimeZone& that) const;
00284 
00294     UBool operator!=(const TimeZone& that) const {return !operator==(that);}
00295 
00316     virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day,
00317                               uint8_t dayOfWeek, int32_t millis, UErrorCode& status) const = 0;
00321     virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day,
00322                               uint8_t dayOfWeek, int32_t millis) const = 0;
00323 
00339     virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day,
00340                            uint8_t dayOfWeek, int32_t milliseconds,
00341                            int32_t monthLength, UErrorCode& status) const = 0;
00342 
00350     virtual void setRawOffset(int32_t offsetMillis) = 0;
00351 
00359     virtual int32_t getRawOffset(void) const = 0;
00360 
00368     UnicodeString& getID(UnicodeString& ID) const;
00369 
00383     void setID(const UnicodeString& ID);
00384 
00389     enum EDisplayType {
00390         SHORT = 1,
00391         LONG
00392     };
00393 
00405     UnicodeString& getDisplayName(UnicodeString& result) const;
00406 
00420     UnicodeString& getDisplayName(const Locale& locale, UnicodeString& result) const;
00421 
00434     UnicodeString& getDisplayName(UBool daylight, EDisplayType style, UnicodeString& result) const;
00435 
00450     UnicodeString& getDisplayName(UBool daylight, EDisplayType style, const Locale& locale, UnicodeString& result) const;
00451 
00458     virtual UBool useDaylightTime(void) const = 0;
00459 
00469     virtual UBool inDaylightTime(UDate date, UErrorCode& status) const = 0;
00470 
00479     virtual UBool hasSameRules(const TimeZone& other) const;
00480 
00488     virtual TimeZone* clone(void) const = 0;
00489 
00501     static UClassID getStaticClassID(void) { return (UClassID)&fgClassID; }
00502 
00518     virtual UClassID getDynamicClassID(void) const = 0;
00519 
00520 protected:
00521 
00526     TimeZone();
00527 
00533     TimeZone(const UnicodeString &id);
00534 
00540     TimeZone(const TimeZone& source);
00541 
00547     TimeZone& operator=(const TimeZone& right);
00548 
00549 private:
00550     static const char fgClassID;
00551 
00552     static TimeZone*        createCustomTimeZone(const UnicodeString&); // Creates a time zone based on the string.
00553 
00559     static void             initDefault(void);
00560 
00561     // See source file for documentation
00569     static TimeZone*        createSystemTimeZone(const UnicodeString& name);
00570 
00571     UnicodeString           fID;    // this time zone's ID
00572 };
00573 
00574 
00575 // -------------------------------------
00576 
00577 inline UnicodeString&
00578 TimeZone::getID(UnicodeString& ID) const
00579 {
00580     ID = fID;
00581     return ID;
00582 }
00583 
00584 // -------------------------------------
00585 
00586 inline void
00587 TimeZone::setID(const UnicodeString& ID)
00588 {
00589     fID = ID;
00590 }
00591 U_NAMESPACE_END
00592 
00593 #endif //_TIMEZONE
00594 //eof

Generated on Thu Aug 15 14:13:29 2002 for ICU 2.2 by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001