Movatterモバイル変換


[0]ホーム

URL:


ICU 78.2  78.2
Data Structures |Public Member Functions |Static Public Member Functions
icu::TimeZoneNames Class Referenceabstract

TimeZoneNames is an abstract class representing the time zone display name data model defined byUTS#35 Unicode Locale Data Markup Language (LDML).More...

#include <tznames.h>

Inheritance diagram for icu::TimeZoneNames:

Data Structures

class  MatchInfoCollection
 MatchInfoCollection represents a collection of time zone name matches used byTimeZoneNames#find.More...
 

Public Member Functions

virtual ~TimeZoneNames ()
 Destructor.More...
 
virtual bool operator== (constTimeZoneNames &other) const =0
 Return true if the givenTimeZoneNames objects are semantically equal.More...
 
bool operator!= (constTimeZoneNames &other) const
 Return true if the givenTimeZoneNames objects are not semantically equal.More...
 
virtualTimeZoneNamesclone () const =0
 Clone this object polymorphically.More...
 
virtualStringEnumerationgetAvailableMetaZoneIDs (UErrorCode &status) const =0
 Returns an enumeration of all available meta zone IDs.More...
 
virtualStringEnumerationgetAvailableMetaZoneIDs (constUnicodeString &tzID,UErrorCode &status) const =0
 Returns an enumeration of all available meta zone IDs used by the given time zone.More...
 
virtualUnicodeStringgetMetaZoneID (constUnicodeString &tzID,UDate date,UnicodeString &mzID) const =0
 Returns the meta zone ID for the given canonical time zone ID at the given date.More...
 
virtualUnicodeStringgetReferenceZoneID (constUnicodeString &mzID, const char *region,UnicodeString &tzID) const =0
 Returns the reference zone ID for the given meta zone ID for the region.More...
 
virtualUnicodeStringgetMetaZoneDisplayName (constUnicodeString &mzID,UTimeZoneNameType type,UnicodeString &name) const =0
 Returns the display name of the meta zone.More...
 
virtualUnicodeStringgetTimeZoneDisplayName (constUnicodeString &tzID,UTimeZoneNameType type,UnicodeString &name) const =0
 Returns the display name of the time zone.More...
 
virtualUnicodeStringgetExemplarLocationName (constUnicodeString &tzID,UnicodeString &name) const
 Returns the exemplar location name for the given time zone.More...
 
virtualUnicodeStringgetDisplayName (constUnicodeString &tzID,UTimeZoneNameType type,UDate date,UnicodeString &name) const
 Returns the display name of the time zone at the given date.More...
 
virtual void loadAllDisplayNames (UErrorCode &status)
 
virtual void getDisplayNames (constUnicodeString &tzID, constUTimeZoneNameType types[], int32_t numTypes,UDate date,UnicodeString dest[],UErrorCode &status) const
 
virtualMatchInfoCollectionfind (constUnicodeString &text, int32_t start, uint32_t types,UErrorCode &status) const =0
 Finds time zone name prefix matches for the input text at the given offset and returns a collection of the matches.More...
 
- Public Member Functions inherited fromicu::UObject
virtual ~UObject ()
 Destructor.More...
 
virtualUClassID getDynamicClassID () const
 ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class.More...
 

Static Public Member Functions

staticTimeZoneNamescreateInstance (constLocale &locale,UErrorCode &status)
 Returns an instance ofTimeZoneNames for the specified locale.More...
 
staticTimeZoneNamescreateTZDBInstance (constLocale &locale,UErrorCode &status)
 Returns an instance ofTimeZoneNames containing only short specific zone names (SHORT_STANDARD and SHORT_DAYLIGHT), compatible with the IANA tz database's zone abbreviations (not localized).More...
 

Detailed Description

TimeZoneNames is an abstract class representing the time zone display name data model defined byUTS#35 Unicode Locale Data Markup Language (LDML).

The model defines meta zone, which is used for storing a set of display names. A meta zone can be shared by multiple time zones. Also a time zone may have multiple meta zone historic mappings.

For example, people in the United States refer the zone used by the east part of North America as "Eastern Time". The tz database contains multiple time zones "America/New_York", "America/Detroit", "America/Montreal" and some others that belong to "Eastern Time". However, assigning different display names to these time zones does not make much sense for most of people.

InCLDR (which uses LDML for representing locale data), the display name "Eastern Time" is stored as long generic display name of a meta zone identified by the ID "America_Eastern". Then, there is another table maintaining the historic mapping to meta zones for each time zone. The time zones in the above example ("America/New_York", "America/Detroit"...) are mapped to the meta zone "America_Eastern".

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.

Note: 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". SeeTimeZone#getCanonicalID(const UnicodeString& id, UnicodeString& canonicalID, UErrorCode& status) about ICU canonical time zone IDs.

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".

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 throughgetTimeZoneDisplayName, or only throughgetMetaZoneDisplayName, or both.

The defaultTimeZoneNames implementation returned bycreateInstance uses the locale data imported from CLDR. In CLDR, set of meta zone IDs and mappings between zone IDs and meta zone IDs are shared by all locales. Therefore, the behavior ofgetAvailableMetaZoneIDs,getMetaZoneID, andgetReferenceZoneID won't be changed no matter what locale is used for getting an instance ofTimeZoneNames.

Stable:
ICU 50

Definition at line131 of filetznames.h.

Constructor & Destructor Documentation

◆ ~TimeZoneNames()

virtual icu::TimeZoneNames::~TimeZoneNames()
virtual

Destructor.

Stable:
ICU 50

Member Function Documentation

◆ clone()

virtualTimeZoneNames* icu::TimeZoneNames::clone() const
pure virtual

Clone this object polymorphically.

The caller is responsible for deleting the result when done.

Returns
A copy of the object
Stable:
ICU 50

◆ createInstance()

staticTimeZoneNames* icu::TimeZoneNames::createInstance(constLocalelocale,
UErrorCodestatus 
)
static

Returns an instance ofTimeZoneNames for the specified locale.

Parameters
localeThe locale.
statusReceives the status.
Returns
An instance ofTimeZoneNames
Stable:
ICU 50

◆ createTZDBInstance()

staticTimeZoneNames* icu::TimeZoneNames::createTZDBInstance(constLocalelocale,
UErrorCodestatus 
)
static

Returns an instance ofTimeZoneNames containing only short specific zone names (SHORT_STANDARD and SHORT_DAYLIGHT), compatible with the IANA tz database's zone abbreviations (not localized).


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

◆ find()

virtualMatchInfoCollection* icu::TimeZoneNames::find(constUnicodeStringtext,
int32_t start,
uint32_t types,
UErrorCodestatus 
) const
pure virtual

Finds time zone name prefix matches for the input text at the given offset and returns a collection of the matches.

Parameters
textThe text.
startThe starting offset within the text.
typesThe set of name types represented by bitwise flags of UTimeZoneNameType enums, or UTZNM_UNKNOWN for all name types.
statusReceives the status.
Returns
A collection of matches (owned by the caller), or nullptr if no matches are found.
See also
UTimeZoneNameType
MatchInfoCollection
Internal:
Do not use. This API is for internal use only.

◆ getAvailableMetaZoneIDs()[1/2]

virtualStringEnumeration* icu::TimeZoneNames::getAvailableMetaZoneIDs(constUnicodeStringtzID,
UErrorCodestatus 
) const
pure virtual

Returns an enumeration of all available meta zone IDs used by the given time zone.

Parameters
tzIDThe canonical time zone ID.
statusReceives the status.
Returns
an enumeration object, owned by the caller.
Stable:
ICU 50

◆ getAvailableMetaZoneIDs()[2/2]

virtualStringEnumeration* icu::TimeZoneNames::getAvailableMetaZoneIDs(UErrorCodestatus) const
pure virtual

Returns an enumeration of all available meta zone IDs.

Parameters
statusReceives the status.
Returns
an enumeration object, owned by the caller.
Stable:
ICU 50

◆ getDisplayName()

virtualUnicodeString& icu::TimeZoneNames::getDisplayName(constUnicodeStringtzID,
UTimeZoneNameType type,
UDate date,
UnicodeStringname 
) const
virtual

Returns the display name of the time zone at the given date.

Note: This method calls the subclass'sgetTimeZoneDisplayName first. When the result is bogus, this method callsgetMetaZoneID to get the meta zone ID mapped from the time zone, then callsgetMetaZoneDisplayName.

Parameters
tzIDThe canonical time zone ID.
typeThe display name type. SeeUTimeZoneNameType.
dateThe date.
nameReceives 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.
Returns
A reference to the result.
Stable:
ICU 50

◆ getDisplayNames()

virtual void icu::TimeZoneNames::getDisplayNames(constUnicodeStringtzID,
constUTimeZoneNameType types[],
int32_t numTypes,
UDate date,
UnicodeString dest[],
UErrorCodestatus 
) const
virtual
Internal:
Do not use.

This API is for internal use only. ICU internal only, for specific users only until proposed publicly.

◆ getExemplarLocationName()

virtualUnicodeString& icu::TimeZoneNames::getExemplarLocationName(constUnicodeStringtzID,
UnicodeStringname 
) const
virtual

Returns the exemplar location name for the given time zone.

When this object does not have a localized location name, the default implementation may still returns a programmatically generated name with the logic described below.

  1. Check if the ID contains "/". If not, return null.
  2. Check if the ID does not start with "Etc/" or "SystemV/". If it does, return null.
  3. Extract a substring after the last occurrence of "/".
  4. Replace "_" with " ".

For example, "New York" is returned for the time zone ID "America/New_York" when this object does not have the localized location name.

Parameters
tzIDThe canonical time zone ID
nameReceives 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.
Returns
A reference to the result.
Stable:
ICU 50

◆ getMetaZoneDisplayName()

virtualUnicodeString& icu::TimeZoneNames::getMetaZoneDisplayName(constUnicodeStringmzID,
UTimeZoneNameType type,
UnicodeStringname 
) const
pure virtual

Returns the display name of the meta zone.

Parameters
mzIDThe meta zone ID.
typeThe display name type. SeeUTimeZoneNameType.
nameReceives the display name of the meta zone. When this object does not have a localized display name for the given meta zone with the specified type or the implementation does not provide any display names associated with meta zones, "bogus" state is set.
Returns
A reference to the result.
Stable:
ICU 50

◆ getMetaZoneID()

virtualUnicodeString& icu::TimeZoneNames::getMetaZoneID(constUnicodeStringtzID,
UDate date,
UnicodeStringmzID 
) const
pure virtual

Returns the meta zone ID for the given canonical time zone ID at the given date.

Parameters
tzIDThe canonical time zone ID.
dateThe date.
mzIDReceives the meta zone ID for the given time zone ID at the given date. If the time zone does not have a corresponding meta zone at the given date or the implementation does not support meta zones, "bogus" state is set.
Returns
A reference to the result.
Stable:
ICU 50

◆ getReferenceZoneID()

virtualUnicodeString& icu::TimeZoneNames::getReferenceZoneID(constUnicodeStringmzID,
const char * region,
UnicodeStringtzID 
) const
pure virtual

Returns the reference zone ID for the given meta zone ID for the region.

Note: Each meta zone must have a reference zone associated with a special region "001" (world). Some meta zones may have region specific reference zone IDs other than the special region "001". When a meta zone does not have any region specific reference zone IDs, this method return the reference zone ID for the special region "001" (world).

Parameters
mzIDThe meta zone ID.
regionThe region.
tzIDReceives the reference zone ID ("golden zone" in the LDML specification) for the given time zone ID for the region. If the meta zone is unknown or the implementation does not support meta zones, "bogus" state is set.
Returns
A reference to the result.
Stable:
ICU 50

◆ getTimeZoneDisplayName()

virtualUnicodeString& icu::TimeZoneNames::getTimeZoneDisplayName(constUnicodeStringtzID,
UTimeZoneNameType type,
UnicodeStringname 
) const
pure virtual

Returns the display name of the time zone.

UnlikegetDisplayName, this method does not get a name from a meta zone used by the time zone.

Parameters
tzIDThe canonical time zone ID.
typeThe display name type. SeeUTimeZoneNameType.
nameReceives 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.
Returns
A reference to the result.
Stable:
ICU 50

◆ loadAllDisplayNames()

virtual void icu::TimeZoneNames::loadAllDisplayNames(UErrorCodestatus)
virtual
Internal:
Do not use.

This API is for internal use only. ICU internal only, for specific users only until proposed publicly.

◆ operator!=()

bool icu::TimeZoneNames::operator!=(constTimeZoneNamesother) const
inline

Return true if the givenTimeZoneNames objects are not semantically equal.

Parameters
otherthe object to be compared with.
Returns
Return true if the givenFormat objects are not semantically equal.
Stable:
ICU 50

Definition at line154 of filetznames.h.

Referencesicu::operator==().

◆ operator==()

virtual bool icu::TimeZoneNames::operator==(constTimeZoneNamesother) const
pure virtual

Return true if the givenTimeZoneNames objects are semantically equal.

Parameters
otherthe object to be compared with.
Returns
Return true if the givenFormat objects are semantically equal.
Stable:
ICU 50

The documentation for this class was generated from the following file:

Generated by doxygen 1.9.1
[8]ページ先頭

©2009-2026 Movatter.jp