+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
-* Copyright (C) 2011-2013, International Business Machines Corporation and *
-* others. All Rights Reserved. *
+* Copyright (C) 2011-2016, International Business Machines Corporation and
+* others. All Rights Reserved.
*******************************************************************************
*/
#ifndef __TZNAMES_H
#define __TZNAMES_H
/**
- * \file
+ * \file
* \brief C++ API: TimeZoneNames
*/
#include "unicode/utypes.h"
#if !UCONFIG_NO_FORMATTING
-#ifndef U_HIDE_DRAFT_API
#include "unicode/uloc.h"
#include "unicode/unistr.h"
/**
* Constants for time zone display name types.
- * @draft ICU 50
+ * @stable ICU 50
*/
typedef enum UTimeZoneNameType {
/**
* Unknown display name type.
- * @draft ICU 50
+ * @stable ICU 50
*/
UTZNM_UNKNOWN = 0x00,
/**
* Long display name, such as "Eastern Time".
- * @draft ICU 50
+ * @stable ICU 50
*/
UTZNM_LONG_GENERIC = 0x01,
/**
* Long display name for standard time, such as "Eastern Standard Time".
- * @draft ICU 50
+ * @stable ICU 50
*/
UTZNM_LONG_STANDARD = 0x02,
/**
* Long display name for daylight saving time, such as "Eastern Daylight Time".
- * @draft ICU 50
+ * @stable ICU 50
*/
UTZNM_LONG_DAYLIGHT = 0x04,
/**
* Short display name, such as "ET".
- * @draft ICU 50
+ * @stable ICU 50
*/
UTZNM_SHORT_GENERIC = 0x08,
/**
* Short display name for standard time, such as "EST".
- * @draft ICU 50
+ * @stable ICU 50
*/
UTZNM_SHORT_STANDARD = 0x10,
/**
* Short display name for daylight saving time, such as "EDT".
- * @draft ICU 50
+ * @stable ICU 50
*/
UTZNM_SHORT_DAYLIGHT = 0x20,
-#ifndef U_HIDE_DRAFT_API
/**
* Exemplar location name, such as "Los Angeles".
- * @draft ICU 51
+ * @stable ICU 51
*/
UTZNM_EXEMPLAR_LOCATION = 0x40
-#endif /* U_HIDE_DRAFT_API */
} UTimeZoneNameType;
U_CDECL_END
+#if U_SHOW_CPLUSPLUS_API
U_NAMESPACE_BEGIN
class UVector;
* Sometimes, a time zone is mapped to a different time zone in the past. For example, "America/Indiana/Knox"
* had been moving "Eastern Time" and "Central Time" back and forth. Therefore, it is necessary that time zone
* to meta zones mapping data are stored by date range.
- *
+ *
* <p><b>Note:</b>
* The methods in this class assume that time zone IDs are already canonicalized. For example, you may not get proper
* result returned by a method with time zone ID "America/Indiana/Indianapolis", because it's not a canonical time zone
* ID (the canonical time zone ID for the time zone is "America/Indianapolis". See
* {@link TimeZone#getCanonicalID(const UnicodeString& id, UnicodeString& canonicalID, UErrorCode& status)} about ICU
* canonical time zone IDs.
- *
+ *
* <p>
* In CLDR, most of time zone display names except location names are provided through meta zones. But a time zone may
* have a specific name that is not shared with other time zones.
* For example, time zone "Europe/London" has English long name for standard time "Greenwich Mean Time", which is also
* shared with other time zones. However, the long name for daylight saving time is "British Summer Time", which is only
* used for "Europe/London".
- *
+ *
* <p>
* {@link #getTimeZoneDisplayName} is designed for accessing a name only used by a single time zone.
* But is not necessarily mean that a subclass implementation use the same model with CLDR. A subclass implementation
* may provide time zone names only through {@link #getTimeZoneDisplayName}, or only through {@link #getMetaZoneDisplayName},
* or both.
- *
+ *
* <p>
* The default <code>TimeZoneNames</code> implementation returned by {@link #createInstance}
* uses the locale data imported from CLDR. In CLDR, set of meta zone IDs and mappings between zone IDs and meta zone
* {@link #getMetaZoneID}, and {@link #getReferenceZoneID} won't be changed no matter
* what locale is used for getting an instance of <code>TimeZoneNames</code>.
*
- * @draft ICU 50
+ * @stable ICU 50
*/
class U_I18N_API TimeZoneNames : public UObject {
public:
/**
* Destructor.
- * @draft ICU 50
+ * @stable ICU 50
*/
virtual ~TimeZoneNames();
/**
- * Return true if the given TimeZoneNames objects are emantically equal.
+ * Return true if the given TimeZoneNames objects are semantically equal.
* @param other the object to be compared with.
* @return Return TRUE if the given Format objects are semantically equal.
- * @draft ICU 50
+ * @stable ICU 50
*/
virtual UBool operator==(const TimeZoneNames& other) const = 0;
* equal.
* @param other the object to be compared with.
* @return Return TRUE if the given Format objects are not semantically equal.
- * @draft ICU 50
+ * @stable ICU 50
*/
UBool operator!=(const TimeZoneNames& other) const { return !operator==(other); }
* Clone this object polymorphically. The caller is responsible
* for deleting the result when done.
* @return A copy of the object
- * @draft ICU 50
+ * @stable ICU 50
*/
virtual TimeZoneNames* clone() const = 0;
/**
- * Returns an instance of <code>TimeZoneDisplayNames</code> for the specified locale.
- *
+ * Returns an instance of <code>TimeZoneNames</code> for the specified locale.
+ *
* @param locale The locale.
- * @param status Recevies the status.
- * @return An instance of <code>TimeZoneDisplayNames</code>
- * @draft ICU 50
+ * @param status Receives the status.
+ * @return An instance of <code>TimeZoneNames</code>
+ * @stable ICU 50
*/
static TimeZoneNames* U_EXPORT2 createInstance(const Locale& locale, UErrorCode& status);
+ /**
+ * Returns an instance of <code>TimeZoneNames</code> containing only short specific
+ * zone names (SHORT_STANDARD and SHORT_DAYLIGHT),
+ * compatible with the IANA tz database's zone abbreviations (not localized).
+ * <br>
+ * Note: The input locale is used for resolving ambiguous names (e.g. "IST" is parsed
+ * as Israel Standard Time for Israel, while it is parsed as India Standard Time for
+ * all other regions). The zone names returned by this instance are not localized.
+ * @stable ICU 54
+ */
+ static TimeZoneNames* U_EXPORT2 createTZDBInstance(const Locale& locale, UErrorCode& status);
+
/**
* Returns an enumeration of all available meta zone IDs.
- * @param status Recevies the status.
+ * @param status Receives the status.
* @return an enumeration object, owned by the caller.
- * @draft ICU 50
+ * @stable ICU 50
*/
virtual StringEnumeration* getAvailableMetaZoneIDs(UErrorCode& status) const = 0;
/**
* Returns an enumeration of all available meta zone IDs used by the given time zone.
* @param tzID The canoical tiem zone ID.
- * @param status Recevies the status.
+ * @param status Receives the status.
* @return an enumeration object, owned by the caller.
- * @draft ICU 50
+ * @stable ICU 50
*/
virtual StringEnumeration* getAvailableMetaZoneIDs(const UnicodeString& tzID, UErrorCode& status) const = 0;
* corresponding meta zone at the given date or the implementation does not support meta zones, "bogus" state
* is set.
* @return A reference to the result.
- * @draft ICU 50
+ * @stable ICU 50
*/
virtual UnicodeString& getMetaZoneID(const UnicodeString& tzID, UDate date, UnicodeString& mzID) const = 0;
* region. If the meta zone is unknown or the implementation does not support meta zones, "bogus" state
* is set.
* @return A reference to the result.
- * @draft ICU 50
+ * @stable ICU 50
*/
virtual UnicodeString& getReferenceZoneID(const UnicodeString& mzID, const char* region, UnicodeString& tzID) const = 0;
* meta zone with the specified type or the implementation does not provide any display names associated
* with meta zones, "bogus" state is set.
* @return A reference to the result.
- * @draft ICU 50
+ * @stable ICU 50
*/
virtual UnicodeString& getMetaZoneDisplayName(const UnicodeString& mzID, UTimeZoneNameType type, UnicodeString& name) const = 0;
* @param name Receives the display name for the time zone. When this object does not have a localized display name for the given
* time zone with the specified type, "bogus" state is set.
* @return A reference to the result.
- * @draft ICU 50
+ * @stable ICU 50
*/
virtual UnicodeString& getTimeZoneDisplayName(const UnicodeString& tzID, UTimeZoneNameType type, UnicodeString& name) const = 0;
* </ol>
* For example, "New York" is returned for the time zone ID "America/New_York" when this object does not have the
* localized location name.
- *
+ *
* @param tzID The canonical time zone ID
* @param name Receives the exemplar location name for the given time zone, or "bogus" state is set when a localized
* location name is not available and the fallback logic described above cannot extract location from the ID.
* @return A reference to the result.
- * @draft ICU 50
+ * @stable ICU 50
*/
virtual UnicodeString& getExemplarLocationName(const UnicodeString& tzID, UnicodeString& name) const;
* <b>Note:</b> This method calls the subclass's {@link #getTimeZoneDisplayName} first. When the
* result is bogus, this method calls {@link #getMetaZoneID} to get the meta zone ID mapped from the
* time zone, then calls {@link #getMetaZoneDisplayName}.
- *
+ *
* @param tzID The canonical time zone ID.
* @param type The display name type. See {@link #UTimeZoneNameType}.
* @param date The date.
* @param name Receives the display name for the time zone at the given date. When this object does not have a localized display
* name for the time zone with the specified type and date, "bogus" state is set.
* @return A reference to the result.
- * @draft ICU 50
+ * @stable ICU 50
*/
virtual UnicodeString& getDisplayName(const UnicodeString& tzID, UTimeZoneNameType type, UDate date, UnicodeString& name) const;
+ /**
+ * @internal ICU internal only, for specific users only until proposed publicly.
+ */
+ virtual void loadAllDisplayNames(UErrorCode& status);
+
+ /**
+ * @internal ICU internal only, for specific users only until proposed publicly.
+ */
+ virtual void getDisplayNames(const UnicodeString& tzID, const UTimeZoneNameType types[], int32_t numTypes, UDate date, UnicodeString dest[], UErrorCode& status) const;
+
/**
* <code>MatchInfoCollection</code> represents a collection of time zone name matches used by
* {@link TimeZoneNames#find}.
};
U_NAMESPACE_END
+#endif // U_SHOW_CPLUSPLUS_API
-#endif /* U_HIDE_DRAFT_API */
#endif
#endif