tznames.h
Go to the documentation of this file.
// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
* Copyright (C) 2011-2016, International Business Machines Corporation and
* others. All Rights Reserved.
*******************************************************************************
*/
#ifndef __TZNAMES_H
#define __TZNAMES_H
#include "unicode/utypes.h"
#if U_SHOW_CPLUSPLUS_API
#if !UCONFIG_NO_FORMATTING
#include "unicode/uloc.h"
#include "unicode/unistr.h"
U_CDECL_BEGIN
typedef enum UTimeZoneNameType {
UTZNM_UNKNOWN = 0x00,
UTZNM_LONG_GENERIC = 0x01,
UTZNM_LONG_STANDARD = 0x02,
UTZNM_LONG_DAYLIGHT = 0x04,
UTZNM_SHORT_GENERIC = 0x08,
UTZNM_SHORT_STANDARD = 0x10,
UTZNM_SHORT_DAYLIGHT = 0x20,
UTZNM_EXEMPLAR_LOCATION = 0x40
} UTimeZoneNameType;
U_CDECL_END
U_NAMESPACE_BEGIN
class UVector;
struct MatchInfo;
class U_I18N_API TimeZoneNames : public UObject {
public:
virtual ~TimeZoneNames();
virtual bool operator==(const TimeZoneNames& other) const = 0;
bool operator!=(const TimeZoneNames& other) const { return !operator==(other); }
virtual TimeZoneNames* clone() const = 0;
static TimeZoneNames* U_EXPORT2 createInstance(const Locale& locale, UErrorCode& status);
static TimeZoneNames* U_EXPORT2 createTZDBInstance(const Locale& locale, UErrorCode& status);
virtual StringEnumeration* getAvailableMetaZoneIDs(UErrorCode& status) const = 0;
virtual StringEnumeration* getAvailableMetaZoneIDs(const UnicodeString& tzID, UErrorCode& status) const = 0;
virtual UnicodeString& getMetaZoneID(const UnicodeString& tzID, UDate date, UnicodeString& mzID) const = 0;
virtual UnicodeString& getReferenceZoneID(const UnicodeString& mzID, const char* region, UnicodeString& tzID) const = 0;
virtual UnicodeString& getMetaZoneDisplayName(const UnicodeString& mzID, UTimeZoneNameType type, UnicodeString& name) const = 0;
virtual UnicodeString& getTimeZoneDisplayName(const UnicodeString& tzID, UTimeZoneNameType type, UnicodeString& name) const = 0;
virtual UnicodeString& getExemplarLocationName(const UnicodeString& tzID, UnicodeString& name) const;
virtual UnicodeString& getDisplayName(const UnicodeString& tzID, UTimeZoneNameType type, UDate date, UnicodeString& name) const;
virtual void loadAllDisplayNames(UErrorCode& status);
virtual void getDisplayNames(const UnicodeString& tzID, const UTimeZoneNameType types[], int32_t numTypes, UDate date, UnicodeString dest[], UErrorCode& status) const;
class U_I18N_API MatchInfoCollection : public UMemory {
public:
MatchInfoCollection();
virtual ~MatchInfoCollection();
#ifndef U_HIDE_INTERNAL_API
void addZone(UTimeZoneNameType nameType, int32_t matchLength,
const UnicodeString& tzID, UErrorCode& status);
void addMetaZone(UTimeZoneNameType nameType, int32_t matchLength,
const UnicodeString& mzID, UErrorCode& status);
int32_t size() const;
UTimeZoneNameType getNameTypeAt(int32_t idx) const;
int32_t getMatchLengthAt(int32_t idx) const;
UBool getTimeZoneIDAt(int32_t idx, UnicodeString& tzID) const;
UBool getMetaZoneIDAt(int32_t idx, UnicodeString& mzID) const;
#endif /* U_HIDE_INTERNAL_API */
private:
UVector* fMatches; // vector of MatchEntry
UVector* matches(UErrorCode& status);
};
virtual MatchInfoCollection* find(const UnicodeString& text, int32_t start, uint32_t types, UErrorCode& status) const = 0;
};
U_NAMESPACE_END
#endif
#endif /* U_SHOW_CPLUSPLUS_API */
#endif
icu::Locale
A Locale object represents a specific geographical, political, or cultural region.
Definition: locid.h:195
icu::StringEnumeration
Base class for 'pure' C++ implementations of uenum api.
Definition: strenum.h:61
icu::TimeZoneNames::MatchInfoCollection
MatchInfoCollection represents a collection of time zone name matches used by TimeZoneNames#find.
Definition: tznames.h:310
icu::TimeZoneNames::MatchInfoCollection::addMetaZone
void addMetaZone(UTimeZoneNameType nameType, int32_t matchLength, const UnicodeString &mzID, UErrorCode &status)
Adds a meata zone match.
icu::TimeZoneNames::MatchInfoCollection::addZone
void addZone(UTimeZoneNameType nameType, int32_t matchLength, const UnicodeString &tzID, UErrorCode &status)
Adds a zone match.
icu::TimeZoneNames::MatchInfoCollection::getNameTypeAt
UTimeZoneNameType getNameTypeAt(int32_t idx) const
Returns the time zone name type of a match at the specified index.
icu::TimeZoneNames::MatchInfoCollection::~MatchInfoCollection
virtual ~MatchInfoCollection()
Destructor.
icu::TimeZoneNames::MatchInfoCollection::MatchInfoCollection
MatchInfoCollection()
Constructor.
icu::TimeZoneNames::MatchInfoCollection::getMatchLengthAt
int32_t getMatchLengthAt(int32_t idx) const
Returns the match length of a match at the specified index.
icu::TimeZoneNames::MatchInfoCollection::getTimeZoneIDAt
UBool getTimeZoneIDAt(int32_t idx, UnicodeString &tzID) const
Gets the zone ID of a match at the specified index.
icu::TimeZoneNames::MatchInfoCollection::getMetaZoneIDAt
UBool getMetaZoneIDAt(int32_t idx, UnicodeString &mzID) const
Gets the metazone ID of a match at the specified index.
icu::TimeZoneNames::MatchInfoCollection::size
int32_t size() const
Returns the number of entries available in this object.
icu::TimeZoneNames
TimeZoneNames is an abstract class representing the time zone display name data model defined by UTS#...
Definition: tznames.h:131
icu::TimeZoneNames::clone
virtual TimeZoneNames * clone() const =0
Clone this object polymorphically.
icu::TimeZoneNames::getExemplarLocationName
virtual UnicodeString & getExemplarLocationName(const UnicodeString &tzID, UnicodeString &name) const
Returns the exemplar location name for the given time zone.
icu::TimeZoneNames::getMetaZoneID
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.
icu::TimeZoneNames::createTZDBInstance
static TimeZoneNames * createTZDBInstance(const Locale &locale, UErrorCode &status)
Returns an instance of TimeZoneNames containing only short specific zone names (SHORT_STANDARD and SH...
icu::TimeZoneNames::find
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...
icu::TimeZoneNames::loadAllDisplayNames
virtual void loadAllDisplayNames(UErrorCode &status)
icu::TimeZoneNames::getDisplayName
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.
icu::TimeZoneNames::getTimeZoneDisplayName
virtual UnicodeString & getTimeZoneDisplayName(const UnicodeString &tzID, UTimeZoneNameType type, UnicodeString &name) const =0
Returns the display name of the time zone.
icu::TimeZoneNames::getDisplayNames
virtual void getDisplayNames(const UnicodeString &tzID, const UTimeZoneNameType types[], int32_t numTypes, UDate date, UnicodeString dest[], UErrorCode &status) const
icu::TimeZoneNames::~TimeZoneNames
virtual ~TimeZoneNames()
Destructor.
icu::TimeZoneNames::getAvailableMetaZoneIDs
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.
icu::TimeZoneNames::operator!=
bool operator!=(const TimeZoneNames &other) const
Return true if the given TimeZoneNames objects are not semantically equal.
Definition: tznames.h:154
icu::TimeZoneNames::getReferenceZoneID
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.
icu::TimeZoneNames::getMetaZoneDisplayName
virtual UnicodeString & getMetaZoneDisplayName(const UnicodeString &mzID, UTimeZoneNameType type, UnicodeString &name) const =0
Returns the display name of the meta zone.
icu::TimeZoneNames::operator==
virtual bool operator==(const TimeZoneNames &other) const =0
Return true if the given TimeZoneNames objects are semantically equal.
icu::TimeZoneNames::getAvailableMetaZoneIDs
virtual StringEnumeration * getAvailableMetaZoneIDs(UErrorCode &status) const =0
Returns an enumeration of all available meta zone IDs.
icu::TimeZoneNames::createInstance
static TimeZoneNames * createInstance(const Locale &locale, UErrorCode &status)
Returns an instance of TimeZoneNames for the specified locale.
icu::UMemory
UMemory is the common ICU base class.
Definition: uobject.h:115
icu::UObject
UObject is the common ICU "boilerplate" class.
Definition: uobject.h:223
icu::UnicodeString
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition: unistr.h:296
icu::operator==
U_EXPORT UBool operator==(const StringPiece &x, const StringPiece &y)
Global operator == for StringPiece.
UTimeZoneNameType
UTimeZoneNameType
Constants for time zone display name types.
Definition: tznames.h:31
UTZNM_SHORT_STANDARD
@ UTZNM_SHORT_STANDARD
Short display name for standard time, such as "EST".
Definition: tznames.h:61
UTZNM_LONG_GENERIC
@ UTZNM_LONG_GENERIC
Long display name, such as "Eastern Time".
Definition: tznames.h:41
UTZNM_SHORT_DAYLIGHT
@ UTZNM_SHORT_DAYLIGHT
Short display name for daylight saving time, such as "EDT".
Definition: tznames.h:66
UTZNM_LONG_DAYLIGHT
@ UTZNM_LONG_DAYLIGHT
Long display name for daylight saving time, such as "Eastern Daylight Time".
Definition: tznames.h:51
UTZNM_SHORT_GENERIC
@ UTZNM_SHORT_GENERIC
Short display name, such as "ET".
Definition: tznames.h:56
UTZNM_EXEMPLAR_LOCATION
@ UTZNM_EXEMPLAR_LOCATION
Exemplar location name, such as "Los Angeles".
Definition: tznames.h:71
UTZNM_LONG_STANDARD
@ UTZNM_LONG_STANDARD
Long display name for standard time, such as "Eastern Standard Time".
Definition: tznames.h:46
UTZNM_UNKNOWN
@ UTZNM_UNKNOWN
Unknown display name type.
Definition: tznames.h:36
uloc.h
C API: Locale ID functionality similar to C++ class Locale.
U_CDECL_END
#define U_CDECL_END
This is used to end a declaration of a library private ICU C API.
Definition: umachine.h:86
UBool
int8_t UBool
The ICU boolean type, a signed-byte integer.
Definition: umachine.h:247
U_CDECL_BEGIN
#define U_CDECL_BEGIN
This is used to begin a declaration of a library private ICU C API.
Definition: umachine.h:85
unistr.h
C++ API: Unicode String.
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition: utypes.h:415
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:301
UDate
double UDate
Date and Time data type.
Definition: utypes.h:203