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 
00031 #if !UCONFIG_NO_FORMATTING
00032 
00033 #include "unicode/uobject.h"
00034 #include "unicode/unistr.h"
00035 
00036 U_NAMESPACE_BEGIN
00037 
00038 class StringEnumeration;
00039 
00112 class U_I18N_API TimeZone : public UObject {
00113 public:
00117     virtual ~TimeZone();
00118 
00119 #ifdef ICU_TIMEZONE_USE_DEPRECATES
00120 
00125     static const TimeZone* GMT;
00126 #endif
00127 
00134     static const TimeZone* getGMT(void);
00135 
00147     static TimeZone* createTimeZone(const UnicodeString& ID);
00148 
00156     static StringEnumeration* createEnumeration();
00157 
00175     static StringEnumeration* createEnumeration(int32_t rawOffset);
00176 
00187     static StringEnumeration* createEnumeration(const char* country);
00188 
00212     static const UnicodeString** createAvailableIDs(int32_t rawOffset, int32_t& numIDs);
00213 
00235     static const UnicodeString** createAvailableIDs(const char* country,
00236                                                           int32_t& numIDs);
00237 
00251     static const UnicodeString** createAvailableIDs(int32_t& numIDs);
00252 
00267     static int32_t countEquivalentIDs(const UnicodeString& id);
00268 
00288     static const UnicodeString getEquivalentID(const UnicodeString& id,
00289                                                int32_t index);
00290 
00303     static TimeZone* createDefault(void);
00304 
00314     static void adoptDefault(TimeZone* zone);
00315 
00323     static void setDefault(const TimeZone& zone);
00324 
00334     virtual UBool operator==(const TimeZone& that) const;
00335 
00345     UBool operator!=(const TimeZone& that) const {return !operator==(that);}
00346 
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 
00370 #ifdef ICU_TIMEZONE_USE_DEPRECATES
00374     virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day,
00375                               uint8_t dayOfWeek, int32_t millis) const = 0;
00376 #endif /* ICU_TIMEZONE_USE_DEPRECATES */
00377 
00393     virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day,
00394                            uint8_t dayOfWeek, int32_t milliseconds,
00395                            int32_t monthLength, UErrorCode& status) const = 0;
00396 
00404     virtual void setRawOffset(int32_t offsetMillis) = 0;
00405 
00413     virtual int32_t getRawOffset(void) const = 0;
00414 
00422     UnicodeString& getID(UnicodeString& ID) const;
00423 
00437     void setID(const UnicodeString& ID);
00438 
00443     enum EDisplayType {
00448         SHORT = 1,
00453         LONG
00454     };
00455 
00467     UnicodeString& getDisplayName(UnicodeString& result) const;
00468 
00482     UnicodeString& getDisplayName(const Locale& locale, UnicodeString& result) const;
00483 
00496     UnicodeString& getDisplayName(UBool daylight, EDisplayType style, UnicodeString& result) const;
00497 
00512     UnicodeString& getDisplayName(UBool daylight, EDisplayType style, const Locale& locale, UnicodeString& result) const;
00513 
00520     virtual UBool useDaylightTime(void) const = 0;
00521 
00535     virtual UBool inDaylightTime(UDate date, UErrorCode& status) const = 0;
00536 
00545     virtual UBool hasSameRules(const TimeZone& other) const;
00546 
00554     virtual TimeZone* clone(void) const = 0;
00555 
00567     static UClassID getStaticClassID(void) { return (UClassID)&fgClassID; }
00568 
00584     virtual UClassID getDynamicClassID(void) const = 0;
00585 
00586 protected:
00587 
00592     TimeZone();
00593 
00599     TimeZone(const UnicodeString &id);
00600 
00606     TimeZone(const TimeZone& source);
00607 
00613     TimeZone& operator=(const TimeZone& right);
00614 
00615 private:
00616     static const char fgClassID;
00617 
00618     static TimeZone*        createCustomTimeZone(const UnicodeString&); // Creates a time zone based on the string.
00619 
00625     static void             initDefault(void);
00626 
00627     // See source file for documentation
00635     static TimeZone*        createSystemTimeZone(const UnicodeString& name);
00636 
00637     UnicodeString           fID;    // this time zone's ID
00638 };
00639 
00640 
00641 // -------------------------------------
00642 
00643 inline UnicodeString&
00644 TimeZone::getID(UnicodeString& ID) const
00645 {
00646     ID = fID;
00647     return ID;
00648 }
00649 
00650 // -------------------------------------
00651 
00652 inline void
00653 TimeZone::setID(const UnicodeString& ID)
00654 {
00655     fID = ID;
00656 }
00657 U_NAMESPACE_END
00658 
00659 #endif /* #if !UCONFIG_NO_FORMATTING */
00660 
00661 #endif //_TIMEZONE
00662 //eof

Generated on Wed Dec 18 16:49:49 2002 for ICU 2.4 by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001