ICU 50.2 50.2
tznames.h
Go to the documentation of this file.
1/*
2*******************************************************************************
3* Copyright (C) 2011-2012, 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#ifndef U_HIDE_INTERNAL_API
18
19#include "unicode/uloc.h"
20#include "unicode/unistr.h"
21
23
65
67
69
70class UVector;
71struct MatchInfo;
72
117public:
122 virtual ~TimeZoneNames();
123
130 virtual UBool operator==(const TimeZoneNames& other) const = 0;
131
139 UBool operator!=(const TimeZoneNames& other) const { return !operator==(other); }
140
147 virtual TimeZoneNames* clone() const = 0;
148
157 static TimeZoneNames* U_EXPORT2 createInstance(const Locale& locale, UErrorCode& status);
158
166
174 virtual StringEnumeration* getAvailableMetaZoneIDs(const UnicodeString& tzID, UErrorCode& status) const = 0;
175
186 virtual UnicodeString& getMetaZoneID(const UnicodeString& tzID, UDate date, UnicodeString& mzID) const = 0;
187
198 virtual UnicodeString& getReferenceZoneID(const UnicodeString& mzID, const char* region, UnicodeString& tzID) const = 0;
199
211
223
244
260 virtual UnicodeString& getDisplayName(const UnicodeString& tzID, UTimeZoneNameType type, UDate date, UnicodeString& name) const;
261
268 public:
279
288 void addZone(UTimeZoneNameType nameType, int32_t matchLength,
289 const UnicodeString& tzID, UErrorCode& status);
290
299 void addMetaZone(UTimeZoneNameType nameType, int32_t matchLength,
300 const UnicodeString& mzID, UErrorCode& status);
301
307 int32_t size() const;
308
318
326 int32_t getMatchLengthAt(int32_t idx) const;
327
335 UBool getTimeZoneIDAt(int32_t idx, UnicodeString& tzID) const;
336
344 UBool getMetaZoneIDAt(int32_t idx, UnicodeString& mzID) const;
345
346 private:
347 UVector* fMatches; // vector of MatchEntry
348
349 UVector* matches(UErrorCode& status);
350 };
351
365 virtual MatchInfoCollection* find(const UnicodeString& text, int32_t start, uint32_t types, UErrorCode& status) const = 0;
366
367private:
368 // No ICU "poor man's RTTI" for this class nor its subclasses.
369 virtual UClassID getDynamicClassID() const;
370};
371
373
374#endif /* U_HIDE_INTERNAL_API */
375#endif
376#endif
A Locale object represents a specific geographical, political, or cultural region.
Definition locid.h:182
Base class for 'pure' C++ implementations of uenum api.
Definition strenum.h:55
MatchInfoCollection represents a collection of time zone name matches used by TimeZoneNames#find.
Definition tznames.h:267
UBool getTimeZoneIDAt(int32_t idx, UnicodeString &tzID) const
Gets the zone ID of a match at the specified index.
int32_t getMatchLengthAt(int32_t idx) const
Returns the match length of a match at the specified index.
void addZone(UTimeZoneNameType nameType, int32_t matchLength, const UnicodeString &tzID, UErrorCode &status)
Adds a zone match.
int32_t size() const
Returns the number of entries available in this object.
virtual ~MatchInfoCollection()
Destructor.
UBool getMetaZoneIDAt(int32_t idx, UnicodeString &mzID) const
Gets the metazone ID of a match at the specified index.
void addMetaZone(UTimeZoneNameType nameType, int32_t matchLength, const UnicodeString &mzID, UErrorCode &status)
Adds a meata zone match.
UTimeZoneNameType getNameTypeAt(int32_t idx) const
Returns the time zone name type of a match at the specified index.
TimeZoneNames is an abstract class representing the time zone display name data model defined by UTS#...
Definition tznames.h:116
static TimeZoneNames * createInstance(const Locale &locale, UErrorCode &status)
Returns an instance of TimeZoneDisplayNames for the specified locale.
virtual UnicodeString & getExemplarLocationName(const UnicodeString &tzID, UnicodeString &name) const
Returns the exemplar location name for the given time zone.
virtual UBool operator==(const TimeZoneNames &other) const =0
Return true if the given TimeZoneNames objects are emantically equal.
virtual ~TimeZoneNames()
Destructor.
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 & 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 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 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 StringEnumeration * getAvailableMetaZoneIDs(UErrorCode &status) const =0
Returns an enumeration of all available meta zone IDs.
virtual UnicodeString & getTimeZoneDisplayName(const UnicodeString &tzID, UTimeZoneNameType type, UnicodeString &name) const =0
Returns the display name of the time zone.
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:139
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...
virtual UnicodeString & getMetaZoneDisplayName(const UnicodeString &mzID, UTimeZoneNameType type, UnicodeString &name) const =0
Returns the display name of the meta zone.
UMemory is the common ICU base class.
Definition uobject.h:115
UObject is the common ICU "boilerplate" class.
Definition uobject.h:229
virtual UClassID getDynamicClassID() const =0
ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class.
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition unistr.h:247
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:28
@ UTZNM_SHORT_STANDARD
Short display name for standard time, such as "EST".
Definition tznames.h:58
@ UTZNM_LONG_GENERIC
Long display name, such as "Eastern Time".
Definition tznames.h:38
@ UTZNM_SHORT_DAYLIGHT
Short display name for daylight saving time, such as "EDT".
Definition tznames.h:63
@ UTZNM_LONG_DAYLIGHT
Long display name for daylight saving time, such as "Eastern Daylight Time".
Definition tznames.h:48
@ UTZNM_SHORT_GENERIC
Short display name, such as "ET".
Definition tznames.h:53
@ UTZNM_LONG_STANDARD
Long display name for standard time, such as "Eastern Standard Time".
Definition tznames.h:43
@ UTZNM_UNKNOWN
Unknown display name type.
Definition tznames.h:33
C API: Locale.
#define U_CDECL_END
This is used to end a declaration of a library private ICU C API.
Definition umachine.h:83
int8_t UBool
The ICU boolean type.
Definition umachine.h:200
#define U_CDECL_BEGIN
This is used to begin a declaration of a library private ICU C API.
Definition umachine.h:82
C++ API: Unicode String.
void * UClassID
UClassID is used to identify classes without using the compiler's RTTI.
Definition uobject.h:96
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:476
#define U_I18N_API
Set to export library symbols from inside the i18n library, and to import them from outside.
Definition utypes.h:358
double UDate
Date and Time data type.
Definition utypes.h:201
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition uversion.h:130
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition uversion.h:129