ICU 73.2  73.2
tznames.h
Go to the documentation of this file.
00001 // © 2016 and later: Unicode, Inc. and others.
00002 // License & terms of use: http://www.unicode.org/copyright.html
00003 /*
00004 *******************************************************************************
00005 * Copyright (C) 2011-2016, International Business Machines Corporation and
00006 * others. All Rights Reserved.
00007 *******************************************************************************
00008 */
00009 #ifndef __TZNAMES_H
00010 #define __TZNAMES_H
00011 
00016 #include "unicode/utypes.h"
00017 
00018 #if U_SHOW_CPLUSPLUS_API
00019 
00020 #if !UCONFIG_NO_FORMATTING
00021 
00022 #include "unicode/uloc.h"
00023 #include "unicode/unistr.h"
00024 
00025 U_CDECL_BEGIN
00026 
00031 typedef enum UTimeZoneNameType {
00036     UTZNM_UNKNOWN           = 0x00,
00041     UTZNM_LONG_GENERIC      = 0x01,
00046     UTZNM_LONG_STANDARD     = 0x02,
00051     UTZNM_LONG_DAYLIGHT     = 0x04,
00056     UTZNM_SHORT_GENERIC     = 0x08,
00061     UTZNM_SHORT_STANDARD    = 0x10,
00066     UTZNM_SHORT_DAYLIGHT    = 0x20,
00071     UTZNM_EXEMPLAR_LOCATION = 0x40
00072 } UTimeZoneNameType;
00073 
00074 U_CDECL_END
00075 
00076 U_NAMESPACE_BEGIN
00077 
00078 class UVector;
00079 struct MatchInfo;
00080 
00131 class U_I18N_API TimeZoneNames : public UObject {
00132 public:
00137     virtual ~TimeZoneNames();
00138 
00145     virtual bool operator==(const TimeZoneNames& other) const = 0;
00146 
00154     bool operator!=(const TimeZoneNames& other) const { return !operator==(other); }
00155 
00162     virtual TimeZoneNames* clone() const = 0;
00163 
00172     static TimeZoneNames* U_EXPORT2 createInstance(const Locale& locale, UErrorCode& status);
00173 
00184      static TimeZoneNames* U_EXPORT2 createTZDBInstance(const Locale& locale, UErrorCode& status);
00185 
00192     virtual StringEnumeration* getAvailableMetaZoneIDs(UErrorCode& status) const = 0;
00193 
00201     virtual StringEnumeration* getAvailableMetaZoneIDs(const UnicodeString& tzID, UErrorCode& status) const = 0;
00202 
00213     virtual UnicodeString& getMetaZoneID(const UnicodeString& tzID, UDate date, UnicodeString& mzID) const = 0;
00214 
00231     virtual UnicodeString& getReferenceZoneID(const UnicodeString& mzID, const char* region, UnicodeString& tzID) const = 0;
00232 
00243     virtual UnicodeString& getMetaZoneDisplayName(const UnicodeString& mzID, UTimeZoneNameType type, UnicodeString& name) const = 0;
00244 
00255     virtual UnicodeString& getTimeZoneDisplayName(const UnicodeString& tzID, UTimeZoneNameType type, UnicodeString& name) const = 0;
00256 
00276     virtual UnicodeString& getExemplarLocationName(const UnicodeString& tzID, UnicodeString& name) const;
00277 
00293     virtual UnicodeString& getDisplayName(const UnicodeString& tzID, UTimeZoneNameType type, UDate date, UnicodeString& name) const;
00294 
00298     virtual void loadAllDisplayNames(UErrorCode& status);
00299 
00303     virtual void getDisplayNames(const UnicodeString& tzID, const UTimeZoneNameType types[], int32_t numTypes, UDate date, UnicodeString dest[], UErrorCode& status) const;
00304 
00310     class U_I18N_API MatchInfoCollection : public UMemory {
00311     public:
00316         MatchInfoCollection();
00321         virtual ~MatchInfoCollection();
00322 
00323 #ifndef U_HIDE_INTERNAL_API
00324 
00332         void addZone(UTimeZoneNameType nameType, int32_t matchLength,
00333             const UnicodeString& tzID, UErrorCode& status);
00334 
00343         void addMetaZone(UTimeZoneNameType nameType, int32_t matchLength,
00344             const UnicodeString& mzID, UErrorCode& status);
00345 
00351         int32_t size() const;
00352 
00361         UTimeZoneNameType getNameTypeAt(int32_t idx) const;
00362 
00370         int32_t getMatchLengthAt(int32_t idx) const;
00371 
00379         UBool getTimeZoneIDAt(int32_t idx, UnicodeString& tzID) const;
00380 
00388         UBool getMetaZoneIDAt(int32_t idx, UnicodeString& mzID) const;
00389 #endif  /* U_HIDE_INTERNAL_API */
00390 
00391     private:
00392         UVector* fMatches;  // vector of MatchEntry
00393 
00394         UVector* matches(UErrorCode& status);
00395     };
00396 
00410     virtual MatchInfoCollection* find(const UnicodeString& text, int32_t start, uint32_t types, UErrorCode& status) const = 0;
00411 };
00412 
00413 U_NAMESPACE_END
00414 
00415 #endif
00416 
00417 #endif /* U_SHOW_CPLUSPLUS_API */
00418 
00419 #endif