ICU 62.1 62.1
tznames.h
Go to the documentation of this file.
1// © 2016 and later: Unicode, Inc. and others.
2// License & terms of use: http://www.unicode.org/copyright.html
3/*
4*******************************************************************************
5* Copyright (C) 2011-2016, International Business Machines Corporation and
6* others. All Rights Reserved.
7*******************************************************************************
8*/
9#ifndef __TZNAMES_H
10#define __TZNAMES_H
11
16#include "unicode/utypes.h"
17
18#if !UCONFIG_NO_FORMATTING
19
20#include "unicode/uloc.h"
21#include "unicode/unistr.h"
22
24
71
73
75
76class UVector;
77struct MatchInfo;
78
130public:
135 virtual ~TimeZoneNames();
136
143 virtual UBool operator==(const TimeZoneNames& other) const = 0;
144
153
160 virtual TimeZoneNames* clone() const = 0;
161
171
183
191
200
212
229 virtual UnicodeString& getReferenceZoneID(const UnicodeString& mzID, const char* region, UnicodeString& tzID) const = 0;
230
242
254
275
292
297
302
309 public:
320
321#ifndef U_HIDE_INTERNAL_API
332
343
349 int32_t size() const;
350
360
368 int32_t getMatchLengthAt(int32_t idx) const;
369
378
387#endif /* U_HIDE_INTERNAL_API */
388
389 private:
390 UVector* fMatches; // vector of MatchEntry
391
392 UVector* matches(UErrorCode& status);
393 };
394
408 virtual MatchInfoCollection* find(const UnicodeString& text, int32_t start, uint32_t types, UErrorCode& status) const = 0;
409};
410
412
413#endif
414#endif
"Smart pointer" base class; do not use directly: use LocalPointer etc.
A Locale object represents a specific geographical, political, or cultural region.
Definition locid.h:188
Base class for 'pure' C++ implementations of uenum api.
Definition strenum.h:57
MatchInfoCollection represents a collection of time zone name matches used by TimeZoneNames#find.
Definition tznames.h:308
void addMetaZone(UTimeZoneNameType nameType, int32_t matchLength, const UnicodeString &mzID, UErrorCode &status)
Adds a meata zone match.
void addZone(UTimeZoneNameType nameType, int32_t matchLength, const UnicodeString &tzID, UErrorCode &status)
Adds a zone match.
UTimeZoneNameType getNameTypeAt(int32_t idx) const
Returns the time zone name type of a match at the specified index.
virtual ~MatchInfoCollection()
Destructor.
int32_t getMatchLengthAt(int32_t idx) const
Returns the match length of a match at the specified index.
UBool getTimeZoneIDAt(int32_t idx, UnicodeString &tzID) const
Gets the zone ID of a match at the specified index.
UBool getMetaZoneIDAt(int32_t idx, UnicodeString &mzID) const
Gets the metazone ID of a match at the specified index.
int32_t size() const
Returns the number of entries available in this object.
TimeZoneNames is an abstract class representing the time zone display name data model defined by UTS#...
Definition tznames.h:129
virtual void loadAllDisplayNames(UErrorCode &status)
static TimeZoneNames * createInstance(const Locale &locale, UErrorCode &status)
Returns an instance of TimeZoneNames for the specified locale.
virtual UnicodeString & getExemplarLocationName(const UnicodeString &tzID, UnicodeString &name) const
Returns the exemplar location name for the given time zone.
virtual UnicodeString & getDisplayName(const UnicodeString &tzID, UTimeZoneNameType type, UDate date, UnicodeString &name) const
Returns the display name of the time zone at the given date.
virtual void getDisplayNames(const UnicodeString &tzID, const UTimeZoneNameType types[], int32_t numTypes, UDate date, UnicodeString dest[], UErrorCode &status) const
virtual UnicodeString & getMetaZoneID(const UnicodeString &tzID, UDate date, UnicodeString &mzID) const =0
Returns the meta zone ID for the given canonical time zone ID at the given date.
virtual ~TimeZoneNames()
Destructor.
virtual TimeZoneNames * clone() const =0
Clone this object polymorphically.
UBool operator!=(const TimeZoneNames &other) const
Return true if the given TimeZoneNames objects are not semantically equal.
Definition tznames.h:152
virtual StringEnumeration * getAvailableMetaZoneIDs(const UnicodeString &tzID, UErrorCode &status) const =0
Returns an enumeration of all available meta zone IDs used by the given time zone.
virtual UBool operator==(const TimeZoneNames &other) const =0
Return true if the given TimeZoneNames objects are semantically equal.
virtual UnicodeString & getReferenceZoneID(const UnicodeString &mzID, const char *region, UnicodeString &tzID) const =0
Returns the reference zone ID for the given meta zone ID for the region.
virtual UnicodeString & getTimeZoneDisplayName(const UnicodeString &tzID, UTimeZoneNameType type, UnicodeString &name) const =0
Returns the display name of the time zone.
virtual UnicodeString & getMetaZoneDisplayName(const UnicodeString &mzID, UTimeZoneNameType type, UnicodeString &name) const =0
Returns the display name of the meta zone.
virtual StringEnumeration * getAvailableMetaZoneIDs(UErrorCode &status) const =0
Returns an enumeration of all available meta zone IDs.
static TimeZoneNames * createTZDBInstance(const Locale &locale, UErrorCode &status)
Returns an instance of TimeZoneNames containing only short specific zone names (SHORT_STANDARD and SH...
virtual MatchInfoCollection * find(const UnicodeString &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 o...
UMemory is the common ICU base class.
Definition uobject.h:112
UObject is the common ICU "boilerplate" class.
Definition uobject.h:223
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition unistr.h:287
U_EXPORT UBool operator==(const StringPiece &x, const StringPiece &y)
Global operator == for StringPiece.
UTimeZoneNameType
Constants for time zone display name types.
Definition tznames.h:29
@ UTZNM_SHORT_STANDARD
Short display name for standard time, such as "EST".
Definition tznames.h:59
@ UTZNM_LONG_GENERIC
Long display name, such as "Eastern Time".
Definition tznames.h:39
@ UTZNM_SHORT_DAYLIGHT
Short display name for daylight saving time, such as "EDT".
Definition tznames.h:64
@ UTZNM_LONG_DAYLIGHT
Long display name for daylight saving time, such as "Eastern Daylight Time".
Definition tznames.h:49
@ UTZNM_SHORT_GENERIC
Short display name, such as "ET".
Definition tznames.h:54
@ UTZNM_EXEMPLAR_LOCATION
Exemplar location name, such as "Los Angeles".
Definition tznames.h:69
@ UTZNM_LONG_STANDARD
Long display name for standard time, such as "Eastern Standard Time".
Definition tznames.h:44
@ UTZNM_UNKNOWN
Unknown display name type.
Definition tznames.h:34
C API: Locale.
#define U_CDECL_END
This is used to end a declaration of a library private ICU C API.
Definition umachine.h:85
int8_t UBool
The ICU boolean type.
Definition umachine.h:236
#define U_CDECL_BEGIN
This is used to begin a declaration of a library private ICU C API.
Definition umachine.h:84
C++ API: Unicode String.
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers,...
Definition utypes.h:396
#define U_I18N_API
Set to export library symbols from inside the i18n library, and to import them from outside.
Definition utypes.h:360
double UDate
Date and Time data type.
Definition utypes.h:203
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition uversion.h:138
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition uversion.h:137