ICU 60.2 60.2

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

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
23 U_CDECL_BEGIN
24
29 typedef enum UTimeZoneNameType {
34 UTZNM_UNKNOWN = 0x00,
39 UTZNM_LONG_GENERIC = 0x01,
44 UTZNM_LONG_STANDARD = 0x02,
49 UTZNM_LONG_DAYLIGHT = 0x04,
54 UTZNM_SHORT_GENERIC = 0x08,
59 UTZNM_SHORT_STANDARD = 0x10,
64 UTZNM_SHORT_DAYLIGHT = 0x20,
69 UTZNM_EXEMPLAR_LOCATION = 0x40
70 } UTimeZoneNameType;
71
72 U_CDECL_END
73
74 U_NAMESPACE_BEGIN
75
76 class UVector;
77 struct MatchInfo;
78
129 class U_I18N_API TimeZoneNames : public UObject {
130 public:
135 virtual ~TimeZoneNames();
136
143 virtual UBool operator==(const TimeZoneNames& other) const = 0;
144
152 UBool operator!=(const TimeZoneNames& other) const { return !operator==(other); }
153
160 virtual TimeZoneNames* clone() const = 0;
161
170 static TimeZoneNames* U_EXPORT2 createInstance(const Locale& locale, UErrorCode& status);
171
182 static TimeZoneNames* U_EXPORT2 createTZDBInstance(const Locale& locale, UErrorCode& status);
183
190 virtual StringEnumeration* getAvailableMetaZoneIDs(UErrorCode& status) const = 0;
191
199 virtual StringEnumeration* getAvailableMetaZoneIDs(const UnicodeString& tzID, UErrorCode& status) const = 0;
200
211 virtual UnicodeString& getMetaZoneID(const UnicodeString& tzID, UDate date, UnicodeString& mzID) const = 0;
212
229 virtual UnicodeString& getReferenceZoneID(const UnicodeString& mzID, const char* region, UnicodeString& tzID) const = 0;
230
241 virtual UnicodeString& getMetaZoneDisplayName(const UnicodeString& mzID, UTimeZoneNameType type, UnicodeString& name) const = 0;
242
253 virtual UnicodeString& getTimeZoneDisplayName(const UnicodeString& tzID, UTimeZoneNameType type, UnicodeString& name) const = 0;
254
274 virtual UnicodeString& getExemplarLocationName(const UnicodeString& tzID, UnicodeString& name) const;
275
291 virtual UnicodeString& getDisplayName(const UnicodeString& tzID, UTimeZoneNameType type, UDate date, UnicodeString& name) const;
292
296 virtual void loadAllDisplayNames(UErrorCode& status);
297
301 virtual void getDisplayNames(const UnicodeString& tzID, const UTimeZoneNameType types[], int32_t numTypes, UDate date, UnicodeString dest[], UErrorCode& status) const;
302
308 class U_I18N_API MatchInfoCollection : public UMemory {
309 public:
314 MatchInfoCollection();
319 virtual ~MatchInfoCollection();
320
321 #ifndef U_HIDE_INTERNAL_API
322
330 void addZone(UTimeZoneNameType nameType, int32_t matchLength,
331 const UnicodeString& tzID, UErrorCode& status);
332
341 void addMetaZone(UTimeZoneNameType nameType, int32_t matchLength,
342 const UnicodeString& mzID, UErrorCode& status);
343
349 int32_t size() const;
350
359 UTimeZoneNameType getNameTypeAt(int32_t idx) const;
360
368 int32_t getMatchLengthAt(int32_t idx) const;
369
377 UBool getTimeZoneIDAt(int32_t idx, UnicodeString& tzID) const;
378
386 UBool getMetaZoneIDAt(int32_t idx, UnicodeString& mzID) const;
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
411 U_NAMESPACE_END
412
413 #endif
414 #endif
UDate
double UDate
Date and Time data type.
Definition: utypes.h:203
unistr.h
C++ API: Unicode String.
icu::operator==
U_EXPORT UBool operator==(const StringPiece &x, const StringPiece &y)
Global operator == for StringPiece.
icu::StringEnumeration
Base class for &#39;pure&#39; C++ implementations of uenum api.
Definition: strenum.h:57
UTZNM_LONG_GENERIC
Long display name, such as "Eastern Time".
Definition: tznames.h:39
U_CDECL_BEGIN
#define U_CDECL_BEGIN
This is used to begin a declaration of a library private ICU C API.
Definition: umachine.h:84
UTZNM_SHORT_GENERIC
Short display name, such as "ET".
Definition: tznames.h:54
U_I18N_API
#define U_I18N_API
Set to export library symbols from inside the i18n library, and to import them from outside...
Definition: utypes.h:360
U_NAMESPACE_BEGIN
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:131
icu::TimeZoneNames::MatchInfoCollection
MatchInfoCollection represents a collection of time zone name matches used by TimeZoneNames#find.
Definition: tznames.h:308
UTZNM_LONG_STANDARD
Long display name for standard time, such as "Eastern Standard Time".
Definition: tznames.h:44
UTZNM_SHORT_STANDARD
Short display name for standard time, such as "EST".
Definition: tznames.h:59
icu::TimeZoneNames
TimeZoneNames is an abstract class representing the time zone display name data model defined by UTS#...
Definition: tznames.h:129
icu::TimeZoneNames::operator!=
UBool operator!=(const TimeZoneNames &other) const
Return true if the given TimeZoneNames objects are not semantically equal.
Definition: tznames.h:152
U_CDECL_END
#define U_CDECL_END
This is used to end a declaration of a library private ICU C API.
Definition: umachine.h:85
U_NAMESPACE_END
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition: uversion.h:132
UTZNM_UNKNOWN
Unknown display name type.
Definition: tznames.h:34
UErrorCode
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers...
Definition: utypes.h:396
UTZNM_EXEMPLAR_LOCATION
Exemplar location name, such as "Los Angeles".
Definition: tznames.h:69
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
icu::UnicodeString
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition: unistr.h:286
UTZNM_LONG_DAYLIGHT
Long display name for daylight saving time, such as "Eastern Daylight Time".
Definition: tznames.h:49
UTimeZoneNameType
UTimeZoneNameType
Constants for time zone display name types.
Definition: tznames.h:29
icu::UObject
UObject is the common ICU "boilerplate" class.
Definition: uobject.h:223
icu::UMemory
UMemory is the common ICU base class.
Definition: uobject.h:112
UBool
int8_t UBool
The ICU boolean type.
Definition: umachine.h:236
uloc.h
C API: Locale.
UTZNM_SHORT_DAYLIGHT
Short display name for daylight saving time, such as "EDT".
Definition: tznames.h:64
icu::Locale
A Locale object represents a specific geographical, political, or cultural region.
Definition: locid.h:188