ICU 56.1: tznames.h Source File

ICU 56.1 56.1

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

- File List
- Globals

tznames.h
Go to the documentation of this file.
1 /*
2 *******************************************************************************
3 * Copyright (C) 2011-2015, International Business Machines Corporation and
4 * others. All Rights Reserved.
5 *******************************************************************************
6 */
7 #ifndef __TZNAMES_H
8 #define __TZNAMES_H
9
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
27 typedef enum UTimeZoneNameType {
32 UTZNM_UNKNOWN = 0x00,
37 UTZNM_LONG_GENERIC = 0x01,
42 UTZNM_LONG_STANDARD = 0x02,
47 UTZNM_LONG_DAYLIGHT = 0x04,
52 UTZNM_SHORT_GENERIC = 0x08,
57 UTZNM_SHORT_STANDARD = 0x10,
62 UTZNM_SHORT_DAYLIGHT = 0x20,
67 UTZNM_EXEMPLAR_LOCATION = 0x40
68 } UTimeZoneNameType;
69
70 U_CDECL_END
71
72 U_NAMESPACE_BEGIN
73
74 class UVector;
75 struct MatchInfo;
76
127 class U_I18N_API TimeZoneNames : public UObject {
128 public:
133 virtual ~TimeZoneNames();
134
141 virtual UBool operator==(const TimeZoneNames& other) const = 0;
142
150 UBool operator!=(const TimeZoneNames& other) const { return !operator==(other); }
151
158 virtual TimeZoneNames* clone() const = 0;
159
168 static TimeZoneNames* U_EXPORT2 createInstance(const Locale& locale, UErrorCode& status);
169
180 static TimeZoneNames* U_EXPORT2 createTZDBInstance(const Locale& locale, UErrorCode& status);
181
188 virtual StringEnumeration* getAvailableMetaZoneIDs(UErrorCode& status) const = 0;
189
197 virtual StringEnumeration* getAvailableMetaZoneIDs(const UnicodeString& tzID, UErrorCode& status) const = 0;
198
209 virtual UnicodeString& getMetaZoneID(const UnicodeString& tzID, UDate date, UnicodeString& mzID) const = 0;
210
227 virtual UnicodeString& getReferenceZoneID(const UnicodeString& mzID, const char* region, UnicodeString& tzID) const = 0;
228
239 virtual UnicodeString& getMetaZoneDisplayName(const UnicodeString& mzID, UTimeZoneNameType type, UnicodeString& name) const = 0;
240
251 virtual UnicodeString& getTimeZoneDisplayName(const UnicodeString& tzID, UTimeZoneNameType type, UnicodeString& name) const = 0;
252
272 virtual UnicodeString& getExemplarLocationName(const UnicodeString& tzID, UnicodeString& name) const;
273
289 virtual UnicodeString& getDisplayName(const UnicodeString& tzID, UTimeZoneNameType type, UDate date, UnicodeString& name) const;
290
296 class U_I18N_API MatchInfoCollection : public UMemory {
297 public:
302 MatchInfoCollection();
307 virtual ~MatchInfoCollection();
308
309 #ifndef U_HIDE_INTERNAL_API
310
318 void addZone(UTimeZoneNameType nameType, int32_t matchLength,
319 const UnicodeString& tzID, UErrorCode& status);
320
329 void addMetaZone(UTimeZoneNameType nameType, int32_t matchLength,
330 const UnicodeString& mzID, UErrorCode& status);
331
337 int32_t size() const;
338
347 UTimeZoneNameType getNameTypeAt(int32_t idx) const;
348
356 int32_t getMatchLengthAt(int32_t idx) const;
357
365 UBool getTimeZoneIDAt(int32_t idx, UnicodeString& tzID) const;
366
374 UBool getMetaZoneIDAt(int32_t idx, UnicodeString& mzID) const;
375 #endif /* U_HIDE_INTERNAL_API */
376
377 private:
378 UVector* fMatches; // vector of MatchEntry
379
380 UVector* matches(UErrorCode& status);
381 };
382
396 virtual MatchInfoCollection* find(const UnicodeString& text, int32_t start, uint32_t types, UErrorCode& status) const = 0;
397 };
398
399 U_NAMESPACE_END
400
401 #endif
402 #endif
UDate
double UDate
Date and Time data type.
Definition: utypes.h:201
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 'pure' C++ implementations of uenum api.
Definition: strenum.h:55
UTZNM_LONG_GENERIC
Long display name, such as "Eastern Time".
Definition: tznames.h:37
U_CDECL_BEGIN
#define U_CDECL_BEGIN
This is used to begin a declaration of a library private ICU C API.
Definition: umachine.h:82
UTZNM_SHORT_GENERIC
Short display name, such as "ET".
Definition: tznames.h:52
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:358
U_NAMESPACE_BEGIN
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:129
icu::TimeZoneNames::MatchInfoCollection
MatchInfoCollection represents a collection of time zone name matches used by TimeZoneNames#find.
Definition: tznames.h:296
UTZNM_LONG_STANDARD
Long display name for standard time, such as "Eastern Standard Time".
Definition: tznames.h:42
UTZNM_SHORT_STANDARD
Short display name for standard time, such as "EST".
Definition: tznames.h:57
icu::TimeZoneNames
TimeZoneNames is an abstract class representing the time zone display name data model defined by UTS#...
Definition: tznames.h:127
icu::TimeZoneNames::operator!=
UBool operator!=(const TimeZoneNames &other) const
Return true if the given TimeZoneNames objects are not semantically equal.
Definition: tznames.h:150
U_CDECL_END
#define U_CDECL_END
This is used to end a declaration of a library private ICU C API.
Definition: umachine.h:83
U_NAMESPACE_END
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition: uversion.h:130
UTZNM_UNKNOWN
Unknown display name type.
Definition: tznames.h:32
UErrorCode
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers...
Definition: utypes.h:476
UTZNM_EXEMPLAR_LOCATION
Exemplar location name, such as "Los Angeles".
Definition: tznames.h:67
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:293
UTZNM_LONG_DAYLIGHT
Long display name for daylight saving time, such as "Eastern Daylight Time".
Definition: tznames.h:47
UTimeZoneNameType
UTimeZoneNameType
Constants for time zone display name types.
Definition: tznames.h:27
icu::UObject
UObject is the common ICU "boilerplate" class.
Definition: uobject.h:221
icu::UMemory
UMemory is the common ICU base class.
Definition: uobject.h:110
UBool
int8_t UBool
The ICU boolean type.
Definition: umachine.h:234
uloc.h
C API: Locale.
UTZNM_SHORT_DAYLIGHT
Short display name for daylight saving time, such as "EDT".
Definition: tznames.h:62
icu::Locale
A Locale object represents a specific geographical, political, or cultural region.
Definition: locid.h:185