ICU 54.1 54.1

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

- File List
- Globals

All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
tznames.h
Go to the documentation of this file.
1 /*
2 *******************************************************************************
3 * Copyright (C) 2011-2014, 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
170 #ifndef U_HIDE_DRAFT_API
171
181 static TimeZoneNames* U_EXPORT2 createTZDBInstance(const Locale& locale, UErrorCode& status);
182 #endif /* U_HIDE_DRAFT_API */
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
298 class U_I18N_API MatchInfoCollection : public UMemory {
299 public:
304 MatchInfoCollection();
309 virtual ~MatchInfoCollection();
310
311 #ifndef U_HIDE_INTERNAL_API
312
320 void addZone(UTimeZoneNameType nameType, int32_t matchLength,
321 const UnicodeString& tzID, UErrorCode& status);
322
331 void addMetaZone(UTimeZoneNameType nameType, int32_t matchLength,
332 const UnicodeString& mzID, UErrorCode& status);
333
339 int32_t size() const;
340
349 UTimeZoneNameType getNameTypeAt(int32_t idx) const;
350
358 int32_t getMatchLengthAt(int32_t idx) const;
359
367 UBool getTimeZoneIDAt(int32_t idx, UnicodeString& tzID) const;
368
376 UBool getMetaZoneIDAt(int32_t idx, UnicodeString& mzID) const;
377 #endif /* U_HIDE_INTERNAL_API */
378
379 private:
380 UVector* fMatches; // vector of MatchEntry
381
382 UVector* matches(UErrorCode& status);
383 };
384
398 virtual MatchInfoCollection* find(const UnicodeString& text, int32_t start, uint32_t types, UErrorCode& status) const = 0;
399 };
400
401 U_NAMESPACE_END
402
403 #endif
404 #endif