Home | History | Annotate | Download | only in i18n
      1 /*
      2 *******************************************************************************
      3 * Copyright (C) 2011, International Business Machines Corporation and         *
      4 * others. All Rights Reserved.                                                *
      5 *******************************************************************************
      6 */
      7 #ifndef __TZNAMES_H
      8 #define __TZNAMES_H
      9 
     10 /**
     11  * \file
     12  * \brief C API: Time zone names class
     13  */
     14 #include "unicode/utypes.h"
     15 
     16 #if !UCONFIG_NO_FORMATTING
     17 
     18 #include "unicode/uloc.h"
     19 #include "unicode/unistr.h"
     20 
     21 U_CDECL_BEGIN
     22 
     23 typedef enum UTimeZoneNameType {
     24     UTZNM_UNKNOWN           = 0x00,
     25     UTZNM_LONG_GENERIC      = 0x01,
     26     UTZNM_LONG_STANDARD     = 0x02,
     27     UTZNM_LONG_DAYLIGHT     = 0x04,
     28     UTZNM_SHORT_GENERIC     = 0x08,
     29     UTZNM_SHORT_STANDARD    = 0x10,
     30     UTZNM_SHORT_DAYLIGHT    = 0x20,
     31     UTZNM_SHORT_STANDARD_COMMONLY_USED  = 0x40,
     32     UTZNM_SHORT_DAYLIGHT_COMMONLY_USED  = 0x80
     33 } UTimeZoneNameType;
     34 
     35 U_CDECL_END
     36 
     37 U_NAMESPACE_BEGIN
     38 
     39 class U_I18N_API TimeZoneNameMatchInfo : public UMemory {
     40 public:
     41     virtual ~TimeZoneNameMatchInfo();
     42 
     43     virtual int32_t size() const = 0;
     44     virtual UTimeZoneNameType getNameType(int32_t index) const = 0;
     45     virtual int32_t getMatchLength(int32_t index) const = 0;
     46     virtual UnicodeString& getTimeZoneID(int32_t index, UnicodeString& tzID) const = 0;
     47     virtual UnicodeString& getMetaZoneID(int32_t index, UnicodeString& mzID) const = 0;
     48 };
     49 
     50 inline
     51 TimeZoneNameMatchInfo::~TimeZoneNameMatchInfo() {
     52 }
     53 
     54 class U_I18N_API TimeZoneNames : public UMemory {
     55 public:
     56     virtual ~TimeZoneNames();
     57 
     58     static TimeZoneNames* U_EXPORT2 createInstance(const Locale& locale, UErrorCode& status);
     59 
     60     virtual StringEnumeration* getAvailableMetaZoneIDs(UErrorCode& status) const = 0;
     61     virtual StringEnumeration* getAvailableMetaZoneIDs(const UnicodeString& tzID, UErrorCode& status) const = 0;
     62 
     63     virtual UnicodeString& getMetaZoneID(const UnicodeString& tzID, UDate date, UnicodeString& mzID) const = 0;
     64     virtual UnicodeString& getReferenceZoneID(const UnicodeString& mzID, const char* region, UnicodeString& tzID) const = 0;
     65 
     66     virtual UnicodeString& getMetaZoneDisplayName(const UnicodeString& mzID, UTimeZoneNameType type, UnicodeString& name) const = 0;
     67     virtual UnicodeString& getTimeZoneDisplayName(const UnicodeString& tzID, UTimeZoneNameType type, UnicodeString& name) const = 0;
     68 
     69     virtual UnicodeString& getExemplarLocationName(const UnicodeString& tzID, UnicodeString& name) const;
     70     virtual UnicodeString& getDisplayName(const UnicodeString& tzID, UTimeZoneNameType type, UDate date, UnicodeString& name) const;
     71 
     72     virtual TimeZoneNameMatchInfo* find(const UnicodeString& text, int32_t start, uint32_t types, UErrorCode& status) const = 0;
     73 };
     74 
     75 inline
     76 TimeZoneNames::~TimeZoneNames() {
     77 }
     78 
     79 U_NAMESPACE_END
     80 #endif
     81 #endif
     82