ICU 49.1.1  49.1.1
tznames.h
Go to the documentation of this file.
00001 /*
00002 *******************************************************************************
00003 * Copyright (C) 2011-2012, International Business Machines Corporation and    *
00004 * others. All Rights Reserved.                                                *
00005 *******************************************************************************
00006 */
00007 #ifndef __TZNAMES_H
00008 #define __TZNAMES_H
00009 
00014 #include "unicode/utypes.h"
00015 
00016 #if !UCONFIG_NO_FORMATTING
00017 #ifndef U_HIDE_INTERNAL_API
00018 
00019 #include "unicode/uloc.h"
00020 #include "unicode/unistr.h"
00021 
00022 U_CDECL_BEGIN
00023 
00028 typedef enum UTimeZoneNameType {
00033     UTZNM_UNKNOWN           = 0x00,
00038     UTZNM_LONG_GENERIC      = 0x01,
00043     UTZNM_LONG_STANDARD     = 0x02,
00048     UTZNM_LONG_DAYLIGHT     = 0x04,
00053     UTZNM_SHORT_GENERIC     = 0x08,
00058     UTZNM_SHORT_STANDARD    = 0x10,
00063     UTZNM_SHORT_DAYLIGHT    = 0x20
00064 } UTimeZoneNameType;
00065 
00066 U_CDECL_END
00067 
00068 U_NAMESPACE_BEGIN
00069 
00070 class UVector;
00071 struct MatchInfo;
00072 
00116 class U_I18N_API TimeZoneNames : public UObject {
00117 public:
00122     virtual ~TimeZoneNames();
00123 
00130     virtual UBool operator==(const TimeZoneNames& other) const = 0;
00131 
00139     UBool operator!=(const TimeZoneNames& other) const { return !operator==(other); }
00140 
00147     virtual TimeZoneNames* clone() const = 0;
00148 
00157     static TimeZoneNames* U_EXPORT2 createInstance(const Locale& locale, UErrorCode& status);
00158 
00165     virtual StringEnumeration* getAvailableMetaZoneIDs(UErrorCode& status) const = 0;
00166 
00174     virtual StringEnumeration* getAvailableMetaZoneIDs(const UnicodeString& tzID, UErrorCode& status) const = 0;
00175 
00186     virtual UnicodeString& getMetaZoneID(const UnicodeString& tzID, UDate date, UnicodeString& mzID) const = 0;
00187 
00198     virtual UnicodeString& getReferenceZoneID(const UnicodeString& mzID, const char* region, UnicodeString& tzID) const = 0;
00199 
00210     virtual UnicodeString& getMetaZoneDisplayName(const UnicodeString& mzID, UTimeZoneNameType type, UnicodeString& name) const = 0;
00211 
00222     virtual UnicodeString& getTimeZoneDisplayName(const UnicodeString& tzID, UTimeZoneNameType type, UnicodeString& name) const = 0;
00223 
00243     virtual UnicodeString& getExemplarLocationName(const UnicodeString& tzID, UnicodeString& name) const;
00244 
00260     virtual UnicodeString& getDisplayName(const UnicodeString& tzID, UTimeZoneNameType type, UDate date, UnicodeString& name) const;
00261 
00267     class U_I18N_API MatchInfoCollection : public UMemory {
00268     public:
00273         MatchInfoCollection();
00278         virtual ~MatchInfoCollection();
00279 
00288         void addZone(UTimeZoneNameType nameType, int32_t matchLength,
00289             const UnicodeString& tzID, UErrorCode& status);
00290 
00299         void addMetaZone(UTimeZoneNameType nameType, int32_t matchLength,
00300             const UnicodeString& mzID, UErrorCode& status);
00301 
00307         int32_t size() const;
00308 
00317         UTimeZoneNameType getNameTypeAt(int32_t idx) const;
00318 
00327         int32_t getMatchLengthAt(int32_t idx) const;
00328 
00336         UBool getTimeZoneIDAt(int32_t idx, UnicodeString& tzID) const;
00337 
00346         UBool getMetaZoneIDAt(int32_t idx, UnicodeString& mzID) const;
00347 
00348     private:
00349         UVector* fMatches;  // vector of MatchEntry
00350 
00351         UVector* matches(UErrorCode& status);
00352     };
00353 
00367     virtual MatchInfoCollection* find(const UnicodeString& text, int32_t start, uint32_t types, UErrorCode& status) const = 0;
00368 
00369 private:
00370     // No ICU "poor man's RTTI" for this class nor its subclasses.
00371     virtual UClassID getDynamicClassID() const;
00372 };
00373 
00374 U_NAMESPACE_END
00375 
00376 #endif  /* U_HIDE_INTERNAL_API */
00377 #endif
00378 #endif