ICU 55.1  55.1
tzfmt.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 __TZFMT_H
8 #define __TZFMT_H
9 
15 #include "unicode/utypes.h"
16 
17 #if !UCONFIG_NO_FORMATTING
18 
19 #include "unicode/format.h"
20 #include "unicode/timezone.h"
21 #include "unicode/tznames.h"
22 
29 typedef enum UTimeZoneFormatStyle {
152 
188 
189  /* The following cannot be #ifndef U_HIDE_INTERNAL_API, needed for other .h declarations */
194  UTZFMT_PAT_COUNT = 6
196 
219 
237 #ifndef U_HIDE_DRAFT_API
238  ,
247 #endif /* U_HIDE_DRAFT_API */
249 
251 
253 
254 class TimeZoneGenericNames;
255 class TZDBTimeZoneNames;
256 class UVector;
257 
274 public:
280 
285  virtual ~TimeZoneFormat();
286 
292 
301  virtual UBool operator==(const Format& other) const;
302 
309  virtual Format* clone() const;
310 
319  static TimeZoneFormat* U_EXPORT2 createInstance(const Locale& locale, UErrorCode& status);
320 
327 
336 
342  void setTimeZoneNames(const TimeZoneNames &tznames);
343 
352 
361  void setGMTPattern(const UnicodeString& pattern, UErrorCode& status);
362 
372 
382 
393 
406  void setGMTOffsetDigits(const UnicodeString& digits, UErrorCode& status);
407 
416 
424  void setGMTZeroFormat(const UnicodeString& gmtZeroFormat, UErrorCode& status);
425 
433  uint32_t getDefaultParseOptions(void) const;
434 
443  void setDefaultParseOptions(uint32_t flags);
444 
460  UnicodeString& formatOffsetISO8601Basic(int32_t offset, UBool useUtcIndicator, UBool isShort, UBool ignoreSeconds,
461  UnicodeString& result, UErrorCode& status) const;
462 
478  UnicodeString& formatOffsetISO8601Extended(int32_t offset, UBool useUtcIndicator, UBool isShort, UBool ignoreSeconds,
479  UnicodeString& result, UErrorCode& status) const;
480 
500  UnicodeString& formatOffsetLocalizedGMT(int32_t offset, UnicodeString& result, UErrorCode& status) const;
501 
521  UnicodeString& formatOffsetShortLocalizedGMT(int32_t offset, UnicodeString& result, UErrorCode& status) const;
522 
523  using Format::format;
524 
538  virtual UnicodeString& format(UTimeZoneFormatStyle style, const TimeZone& tz, UDate date,
539  UnicodeString& name, UTimeZoneFormatTimeType* timeType = NULL) const;
540 
555  int32_t parseOffsetISO8601(const UnicodeString& text, ParsePosition& pos) const;
556 
569  int32_t parseOffsetLocalizedGMT(const UnicodeString& text, ParsePosition& pos) const;
570 
583  int32_t parseOffsetShortLocalizedGMT(const UnicodeString& text, ParsePosition& pos) const;
584 
601  virtual TimeZone* parse(UTimeZoneFormatStyle style, const UnicodeString& text, ParsePosition& pos,
602  int32_t parseOptions, UTimeZoneFormatTimeType* timeType = NULL) const;
603 
620  UTimeZoneFormatTimeType* timeType = NULL) const;
621 
622  /* ----------------------------------------------
623  * Format APIs
624  * ---------------------------------------------- */
625 
637  virtual UnicodeString& format(const Formattable& obj, UnicodeString& appendTo,
638  FieldPosition& pos, UErrorCode& status) const;
639 
652  virtual void parseObject(const UnicodeString& source, Formattable& result, ParsePosition& parse_pos) const;
653 
658  static UClassID U_EXPORT2 getStaticClassID(void);
659 
664  virtual UClassID getDynamicClassID() const;
665 
666 protected:
673  TimeZoneFormat(const Locale& locale, UErrorCode& status);
674 
675 private:
676  /* Locale of this object */
677  Locale fLocale;
678 
679  /* Stores the region (could be implicit default) */
680  char fTargetRegion[ULOC_COUNTRY_CAPACITY];
681 
682  /* TimeZoneNames object used by this formatter */
683  TimeZoneNames* fTimeZoneNames;
684 
685  /* TimeZoneGenericNames object used by this formatter - lazily instantiated */
686  TimeZoneGenericNames* fTimeZoneGenericNames;
687 
688  /* Localized GMT format pattern - e.g. "GMT{0}" */
689  UnicodeString fGMTPattern;
690 
691  /* Array of offset patterns used by Localized GMT format - e.g. "+HH:mm" */
692  UnicodeString fGMTOffsetPatterns[UTZFMT_PAT_COUNT];
693 
694  /* Localized decimal digits used by Localized GMT format */
695  UChar32 fGMTOffsetDigits[10];
696 
697  /* Localized GMT zero format - e.g. "GMT" */
698  UnicodeString fGMTZeroFormat;
699 
700  /* Bit flags representing parse options */
701  uint32_t fDefParseOptionFlags;
702 
703  /* Constant parts of GMT format pattern, populated from localized GMT format pattern*/
704  UnicodeString fGMTPatternPrefix; /* Substring before {0} */
705  UnicodeString fGMTPatternSuffix; /* Substring after {0} */
706 
707  /* Compiled offset patterns generated from fGMTOffsetPatterns[] */
708  UVector* fGMTOffsetPatternItems[UTZFMT_PAT_COUNT];
709 
710  UBool fAbuttingOffsetHoursAndMinutes;
711 
712  /* TZDBTimeZoneNames object used for parsing */
713  TZDBTimeZoneNames* fTZDBTimeZoneNames;
714 
725  UnicodeString& formatSpecific(const TimeZone& tz, UTimeZoneNameType stdType, UTimeZoneNameType dstType,
726  UDate date, UnicodeString& name, UTimeZoneFormatTimeType *timeType) const;
727 
736  UnicodeString& formatGeneric(const TimeZone& tz, int32_t genType, UDate date, UnicodeString& name) const;
737 
743  const TimeZoneGenericNames* getTimeZoneGenericNames(UErrorCode& status) const;
744 
750  const TZDBTimeZoneNames* getTZDBTimeZoneNames(UErrorCode& status) const;
751 
759  UnicodeString& formatExemplarLocation(const TimeZone& tz, UnicodeString& name) const;
760 
764  enum OffsetFields {
765  FIELDS_H,
766  FIELDS_HM,
767  FIELDS_HMS
768  };
769 
777  void initGMTPattern(const UnicodeString& gmtPattern, UErrorCode& status);
778 
787  static UVector* parseOffsetPattern(const UnicodeString& pattern, OffsetFields required, UErrorCode& status);
788 
797  static UnicodeString& expandOffsetPattern(const UnicodeString& offsetHM, UnicodeString& result, UErrorCode& status);
798 
807  static UnicodeString& truncateOffsetPattern(const UnicodeString& offsetHM, UnicodeString& result, UErrorCode& status);
808 
819  static UBool toCodePoints(const UnicodeString& str, UChar32* codeArray, int32_t capacity);
820 
831  UnicodeString& formatOffsetISO8601(int32_t offset, UBool isBasic, UBool useUtcIndicator,
832  UBool isShort, UBool ignoreSeconds, UnicodeString& result, UErrorCode& status) const;
833 
841  UnicodeString& formatOffsetLocalizedGMT(int32_t offset, UBool isShort, UnicodeString& result, UErrorCode& status) const;
842 
857  int32_t parseOffsetISO8601(const UnicodeString& text, ParsePosition& pos, UBool extendedOnly,
858  UBool* hasDigitOffset = NULL) const;
859 
867  void appendOffsetDigits(UnicodeString& buf, int32_t n, uint8_t minDigits) const;
868 
881  int32_t parseOffsetLocalizedGMT(const UnicodeString& text, ParsePosition& pos,
882  UBool isShort, UBool* hasDigitOffset) const;
883 
893  int32_t parseOffsetLocalizedGMTPattern(const UnicodeString& text, int32_t start,
894  UBool isShort, int32_t& parsedLen) const;
895 
904  int32_t parseOffsetFields(const UnicodeString& text, int32_t start, UBool isShort, int32_t& parsedLen) const;
905 
917  int32_t parseOffsetFieldsWithPattern(const UnicodeString& text, int32_t start,
918  UVector* patternItems, UBool forceSingleHourDigit, int32_t& hour, int32_t& min, int32_t& sec) const;
919 
927  int32_t parseAbuttingOffsetFields(const UnicodeString& text, int32_t start, int32_t& parsedLen) const;
928 
936  int32_t parseOffsetDefaultLocalizedGMT(const UnicodeString& text, int start, int32_t& parsedLen) const;
937 
946  int32_t parseDefaultOffsetFields(const UnicodeString& text, int32_t start, UChar separator,
947  int32_t& parsedLen) const;
948 
963  int32_t parseOffsetFieldWithLocalizedDigits(const UnicodeString& text, int32_t start,
964  uint8_t minDigits, uint8_t maxDigits, uint16_t minVal, uint16_t maxVal, int32_t& parsedLen) const;
965 
975  int32_t parseSingleLocalizedDigit(const UnicodeString& text, int32_t start, int32_t& len) const;
976 
986  static UnicodeString& formatOffsetWithAsciiDigits(int32_t offset, UChar sep,
987  OffsetFields minFields, OffsetFields maxFields, UnicodeString& result);
988 
1001  static int32_t parseAbuttingAsciiOffsetFields(const UnicodeString& text, ParsePosition& pos,
1002  OffsetFields minFields, OffsetFields maxFields, UBool fixedHourWidth);
1003 
1016  static int32_t parseAsciiOffsetFields(const UnicodeString& text, ParsePosition& pos, UChar sep,
1017  OffsetFields minFields, OffsetFields maxFields);
1018 
1025  static UnicodeString& unquote(const UnicodeString& pattern, UnicodeString& result);
1026 
1032  void initGMTOffsetPatterns(UErrorCode& status);
1033 
1040  void checkAbuttingHoursAndMinutes();
1041 
1047  TimeZone* createTimeZoneForOffset(int32_t offset) const;
1048 
1054  static UTimeZoneFormatTimeType getTimeType(UTimeZoneNameType nameType);
1055 
1064  UnicodeString& getTimeZoneID(const TimeZoneNames::MatchInfoCollection* matches, int32_t idx, UnicodeString& tzID) const;
1065 
1066 
1074  UnicodeString& parseZoneID(const UnicodeString& text, ParsePosition& pos, UnicodeString& tzID) const;
1075 
1083  UnicodeString& parseShortZoneID(const UnicodeString& text, ParsePosition& pos, UnicodeString& tzID) const;
1084 
1092  UnicodeString& parseExemplarLocation(const UnicodeString& text, ParsePosition& pos, UnicodeString& tzID) const;
1093 };
1094 
1096 
1097 #endif /* !UCONFIG_NO_FORMATTING */
1098 #endif
icu::FieldPosition
FieldPosition is a simple class used by Format and its subclasses to identify fields in formatted out...
Definition: fieldpos.h:106
UTZFMT_STYLE_ZONE_ID_SHORT
@ UTZFMT_STYLE_ZONE_ID_SHORT
Short Time Zone ID (BCP 47 Unicode location extension, time zone type value), such as "uslax".
Definition: tzfmt.h:145
icu::TimeZoneFormat::TimeZoneFormat
TimeZoneFormat(const Locale &locale, UErrorCode &status)
Constructs a TimeZoneFormat object for the specified locale.
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
tznames.h
C++ API: TimeZoneNames.
UTZFMT_STYLE_ISO_BASIC_FULL
@ UTZFMT_STYLE_ISO_BASIC_FULL
ISO 8601 local time difference (basic format) with optional seconds field, or the UTC indicator.
Definition: tzfmt.h:100
icu::TimeZoneFormat::parseObject
virtual void parseObject(const UnicodeString &source, Formattable &result, ParsePosition &parse_pos) const
Parse a string to produce an object.
icu::TimeZoneFormat::getGMTPattern
UnicodeString & getGMTPattern(UnicodeString &pattern) const
Returns the localized GMT format pattern.
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
UTZFMT_STYLE_ISO_BASIC_SHORT
@ UTZFMT_STYLE_ISO_BASIC_SHORT
Short ISO 8601 local time difference (basic format) or the UTC indicator.
Definition: tzfmt.h:72
UBool
int8_t UBool
The ICU boolean type.
Definition: umachine.h:234
icu::Formattable
Formattable objects can be passed to the Format class or its subclasses for formatting.
Definition: fmtable.h:66
icu::TimeZoneFormat::TimeZoneFormat
TimeZoneFormat(const TimeZoneFormat &other)
Copy constructor.
icu::TimeZoneFormat::operator=
TimeZoneFormat & operator=(const TimeZoneFormat &other)
Assignment operator.
format.h
C++ API: Base class for all formats.
UTZFMT_STYLE_GENERIC_LONG
@ UTZFMT_STYLE_GENERIC_LONG
Generic long non-location format, such as "Eastern Time".
Definition: tzfmt.h:39
icu::TimeZoneFormat::operator==
virtual UBool operator==(const Format &other) const
Return true if the given Format objects are semantically equal.
icu::TimeZoneFormat::setTimeZoneNames
void setTimeZoneNames(const TimeZoneNames &tznames)
Sets the time zone display name data to this format instnace.
UTZFMT_STYLE_EXEMPLAR_LOCATION
@ UTZFMT_STYLE_EXEMPLAR_LOCATION
Exemplar location, such as "Los Angeles" and "Paris".
Definition: tzfmt.h:150
icu::TimeZoneFormat::adoptTimeZoneNames
void adoptTimeZoneNames(TimeZoneNames *tznames)
Sets the time zone display name data to this format instnace.
UTZFMT_PAT_COUNT
@ UTZFMT_PAT_COUNT
Number of UTimeZoneFormatGMTOffsetPatternType types.
Definition: tzfmt.h:194
icu::TimeZoneFormat::getTimeZoneNames
const TimeZoneNames * getTimeZoneNames() const
Returns the time zone display name data used by this instance.
icu::Format::format
UnicodeString & format(const Formattable &obj, UnicodeString &appendTo, UErrorCode &status) const
Formats an object to produce a string.
UTZFMT_STYLE_SPECIFIC_LONG
@ UTZFMT_STYLE_SPECIFIC_LONG
Specific long format, such as "Eastern Standard Time".
Definition: tzfmt.h:49
icu::TimeZone
TimeZone represents a time zone offset, and also figures out daylight savings.
Definition: timezone.h:129
icu::TimeZoneFormat::format
virtual UnicodeString & format(const Formattable &obj, UnicodeString &appendTo, FieldPosition &pos, UErrorCode &status) const
Format an object to produce a time zone display string using localized GMT offset format.
NULL
#define NULL
Define NULL if necessary, to 0 for C++ and to ((void *)0) for C.
Definition: utypes.h:186
UTZFMT_PAT_POSITIVE_HM
@ UTZFMT_PAT_POSITIVE_HM
Positive offset with hours and minutes fields.
Definition: tzfmt.h:162
icu::TimeZoneFormat::getDynamicClassID
virtual UClassID getDynamicClassID() const
ICU "poor man's RTTI", returns a UClassID for the actual class.
UTZFMT_PAT_POSITIVE_HMS
@ UTZFMT_PAT_POSITIVE_HMS
Positive offset with hours, minutes and seconds fields.
Definition: tzfmt.h:167
UTZFMT_TIME_TYPE_DAYLIGHT
@ UTZFMT_TIME_TYPE_DAYLIGHT
Daylight saving time.
Definition: tzfmt.h:217
UTimeZoneFormatGMTOffsetPatternType
UTimeZoneFormatGMTOffsetPatternType
Constants for GMT offset pattern types.
Definition: tzfmt.h:157
UTZFMT_STYLE_ISO_BASIC_LOCAL_FULL
@ UTZFMT_STYLE_ISO_BASIC_LOCAL_FULL
ISO 8601 local time difference (basic format) with optional seconds field.
Definition: tzfmt.h:107
icu::Format
Base class for all formats.
Definition: format.h:94
icu::UnicodeString
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition: unistr.h:246
UTZFMT_STYLE_ZONE_ID
@ UTZFMT_STYLE_ZONE_ID
Time Zone ID, such as "America/Los_Angeles".
Definition: tzfmt.h:140
timezone.h
C++ API: TimeZone object.
icu::TimeZoneFormat::parseOffsetShortLocalizedGMT
int32_t parseOffsetShortLocalizedGMT(const UnicodeString &text, ParsePosition &pos) const
Returns offset from GMT(UTC) in milliseconds for the given short localized GMT offset format string.
icu::TimeZoneFormat::formatOffsetLocalizedGMT
UnicodeString & formatOffsetLocalizedGMT(int32_t offset, UnicodeString &result, UErrorCode &status) const
Returns the localized GMT(UTC) offset format for the given offset.
icu::TimeZoneFormat::format
virtual UnicodeString & format(UTimeZoneFormatStyle style, const TimeZone &tz, UDate date, UnicodeString &name, UTimeZoneFormatTimeType *timeType=NULL) const
Returns the display name of the time zone at the given date for the style.
UChar32
int32_t UChar32
Define UChar32 as a type for single Unicode code points.
Definition: umachine.h:332
icu::TimeZoneFormat::parse
virtual TimeZone * parse(UTimeZoneFormatStyle style, const UnicodeString &text, ParsePosition &pos, int32_t parseOptions, UTimeZoneFormatTimeType *timeType=NULL) const
Returns a TimeZone by parsing the time zone string according to the given parse position,...
icu::TimeZoneFormat::getStaticClassID
static UClassID getStaticClassID(void)
ICU "poor man's RTTI", returns a UClassID for this class.
UTZFMT_STYLE_ISO_EXTENDED_FIXED
@ UTZFMT_STYLE_ISO_EXTENDED_FIXED
Fixed width ISO 8601 local time difference (extended format) or the UTC indicator.
Definition: tzfmt.h:114
UClassID
void * UClassID
UClassID is used to identify classes without using the compiler's RTTI.
Definition: uobject.h:91
UErrorCode
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers,...
Definition: utypes.h:476
icu::TimeZoneFormat::getDefaultParseOptions
uint32_t getDefaultParseOptions(void) const
Returns the bitwise flags of UTimeZoneFormatParseOption representing the default parse options used b...
UTZFMT_PAT_NEGATIVE_HM
@ UTZFMT_PAT_NEGATIVE_HM
Negative offset with hours and minutes fields.
Definition: tzfmt.h:172
icu::TimeZoneFormat::setGMTOffsetDigits
void setGMTOffsetDigits(const UnicodeString &digits, UErrorCode &status)
Sets the decimal digit characters used for localized GMT format.
icu::TimeZoneFormat::setGMTOffsetPattern
void setGMTOffsetPattern(UTimeZoneFormatGMTOffsetPatternType type, const UnicodeString &pattern, UErrorCode &status)
Sets the offset pattern for the given offset type.
UTZFMT_TIME_TYPE_UNKNOWN
@ UTZFMT_TIME_TYPE_UNKNOWN
Unknown.
Definition: tzfmt.h:207
UTimeZoneFormatTimeType
UTimeZoneFormatTimeType
Constants for time types used by TimeZoneFormat APIs for receiving time type (standard time,...
Definition: tzfmt.h:202
icu::TimeZoneFormat::setDefaultParseOptions
void setDefaultParseOptions(uint32_t flags)
Sets the default parse options.
icu::TimeZoneFormat::getGMTZeroFormat
UnicodeString & getGMTZeroFormat(UnicodeString &gmtZeroFormat) const
Returns the localized GMT format string for GMT(UTC) itself (GMT offset is 0).
UTZFMT_PAT_NEGATIVE_HMS
@ UTZFMT_PAT_NEGATIVE_HMS
Negative offset with hours, minutes and seconds fields.
Definition: tzfmt.h:177
UTimeZoneFormatStyle
UTimeZoneFormatStyle
Constants for time zone display format style used by format/parse APIs in TimeZoneFormat.
Definition: tzfmt.h:29
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_CDECL_BEGIN
#define U_CDECL_BEGIN
This is used to begin a declaration of a library private ICU C API.
Definition: umachine.h:82
UTZFMT_STYLE_GENERIC_LOCATION
@ UTZFMT_STYLE_GENERIC_LOCATION
Generic location format, such as "United States Time (New York)", "Italy Time".
Definition: tzfmt.h:34
icu::TimeZoneFormat::formatOffsetShortLocalizedGMT
UnicodeString & formatOffsetShortLocalizedGMT(int32_t offset, UnicodeString &result, UErrorCode &status) const
Returns the short localized GMT(UTC) offset format for the given offset.
icu::TimeZoneFormat::getGMTOffsetPattern
UnicodeString & getGMTOffsetPattern(UTimeZoneFormatGMTOffsetPatternType type, UnicodeString &pattern) const
Returns the offset pattern used for localized GMT format.
UTZFMT_STYLE_SPECIFIC_SHORT
@ UTZFMT_STYLE_SPECIFIC_SHORT
Specific short format, such as "EST", "PDT".
Definition: tzfmt.h:54
UTZFMT_STYLE_ISO_EXTENDED_LOCAL_FULL
@ UTZFMT_STYLE_ISO_EXTENDED_LOCAL_FULL
ISO 8601 local time difference (extended format) with optional seconds field.
Definition: tzfmt.h:135
icu::TimeZoneFormat::getGMTOffsetDigits
UnicodeString & getGMTOffsetDigits(UnicodeString &digits) const
Returns the decimal digit characters used for localized GMT format.
icu::TimeZoneFormat::parseOffsetLocalizedGMT
int32_t parseOffsetLocalizedGMT(const UnicodeString &text, ParsePosition &pos) const
Returns offset from GMT(UTC) in milliseconds for the given localized GMT offset format string.
UTZFMT_STYLE_LOCALIZED_GMT
@ UTZFMT_STYLE_LOCALIZED_GMT
Localized GMT offset format, such as "GMT-05:00", "UTC+0100".
Definition: tzfmt.h:59
icu::TimeZoneFormat::setGMTZeroFormat
void setGMTZeroFormat(const UnicodeString &gmtZeroFormat, UErrorCode &status)
Sets the localized GMT format string for GMT(UTC) itself (GMT offset is 0).
icu::TimeZoneNames
TimeZoneNames is an abstract class representing the time zone display name data model defined by UTS#...
Definition: tznames.h:127
UTZFMT_STYLE_ISO_EXTENDED_LOCAL_FIXED
@ UTZFMT_STYLE_ISO_EXTENDED_LOCAL_FIXED
Fixed width ISO 8601 local time difference (extended format).
Definition: tzfmt.h:121
UTZFMT_STYLE_ISO_EXTENDED_FULL
@ UTZFMT_STYLE_ISO_EXTENDED_FULL
ISO 8601 local time difference (extended format) with optional seconds field, or the UTC indicator.
Definition: tzfmt.h:128
UDate
double UDate
Date and Time data type.
Definition: utypes.h:201
UTZFMT_STYLE_GENERIC_SHORT
@ UTZFMT_STYLE_GENERIC_SHORT
Generic short non-location format, such as "ET".
Definition: tzfmt.h:44
UTimeZoneNameType
UTimeZoneNameType
Constants for time zone display name types.
Definition: tznames.h:27
UTZFMT_STYLE_ISO_BASIC_LOCAL_SHORT
@ UTZFMT_STYLE_ISO_BASIC_LOCAL_SHORT
Short ISO 8601 locale time difference (basic format).
Definition: tzfmt.h:79
icu::TimeZoneFormat::setGMTPattern
void setGMTPattern(const UnicodeString &pattern, UErrorCode &status)
Sets the localized GMT format pattern.
UTZFMT_TIME_TYPE_STANDARD
@ UTZFMT_TIME_TYPE_STANDARD
Standard time.
Definition: tzfmt.h:212
UTZFMT_STYLE_ISO_BASIC_FIXED
@ UTZFMT_STYLE_ISO_BASIC_FIXED
Fixed width ISO 8601 local time difference (basic format) or the UTC indicator.
Definition: tzfmt.h:86
icu::TimeZoneFormat::~TimeZoneFormat
virtual ~TimeZoneFormat()
Destructor.
icu::TimeZoneFormat::parse
TimeZone * parse(UTimeZoneFormatStyle style, const UnicodeString &text, ParsePosition &pos, UTimeZoneFormatTimeType *timeType=NULL) const
Returns a TimeZone by parsing the time zone string according to the given parse position,...
UTZFMT_PARSE_OPTION_TZ_DATABASE_ABBREVIATIONS
@ UTZFMT_PARSE_OPTION_TZ_DATABASE_ABBREVIATIONS
When parsing a time zone display name in UTZFMT_STYLE_SPECIFIC_SHORT, look for the IANA tz database c...
Definition: tzfmt.h:246
icu::TimeZoneFormat::clone
virtual Format * clone() const
Clone this object polymorphically.
UChar
uint16_t UChar
Define UChar to be UCHAR_TYPE, if that is #defined (for example, to char16_t), or wchar_t if that is ...
Definition: umachine.h:312
icu::TimeZoneFormat::formatOffsetISO8601Basic
UnicodeString & formatOffsetISO8601Basic(int32_t offset, UBool useUtcIndicator, UBool isShort, UBool ignoreSeconds, UnicodeString &result, UErrorCode &status) const
Returns the ISO 8601 basic time zone string for the given offset.
UTZFMT_PARSE_OPTION_NONE
@ UTZFMT_PARSE_OPTION_NONE
No option.
Definition: tzfmt.h:229
UTZFMT_PAT_NEGATIVE_H
@ UTZFMT_PAT_NEGATIVE_H
Negative offset with hours field.
Definition: tzfmt.h:187
icu::TimeZoneNames::MatchInfoCollection
MatchInfoCollection represents a collection of time zone name matches used by TimeZoneNames#find.
Definition: tznames.h:298
UTZFMT_PAT_POSITIVE_H
@ UTZFMT_PAT_POSITIVE_H
Positive offset with hours field.
Definition: tzfmt.h:182
UTZFMT_STYLE_ISO_BASIC_LOCAL_FIXED
@ UTZFMT_STYLE_ISO_BASIC_LOCAL_FIXED
Fixed width ISO 8601 local time difference (basic format).
Definition: tzfmt.h:93
icu::TimeZoneFormat::parseOffsetISO8601
int32_t parseOffsetISO8601(const UnicodeString &text, ParsePosition &pos) const
Returns offset from GMT(UTC) in milliseconds for the given ISO 8601 style time zone string.
U_NAMESPACE_END
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition: uversion.h:130
icu::ParsePosition
ParsePosition is a simple class used by Format and its subclasses to keep track of the current positi...
Definition: parsepos.h:47
U_NAMESPACE_BEGIN
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:129
UTZFMT_STYLE_LOCALIZED_GMT_SHORT
@ UTZFMT_STYLE_LOCALIZED_GMT_SHORT
Short localized GMT offset format, such as "GMT-5", "UTC+1:30" This style is equivalent to the LDML d...
Definition: tzfmt.h:65
icu::TimeZoneFormat::formatOffsetISO8601Extended
UnicodeString & formatOffsetISO8601Extended(int32_t offset, UBool useUtcIndicator, UBool isShort, UBool ignoreSeconds, UnicodeString &result, UErrorCode &status) const
Returns the ISO 8601 extended time zone string for the given offset.
icu::Locale
A Locale object represents a specific geographical, political, or cultural region.
Definition: locid.h:185
UTimeZoneFormatParseOption
UTimeZoneFormatParseOption
Constants for parse option flags, used for specifying optional parse behavior.
Definition: tzfmt.h:224
icu::TimeZoneFormat::createInstance
static TimeZoneFormat * createInstance(const Locale &locale, UErrorCode &status)
Creates an instance of TimeZoneFormat for the given locale.
ULOC_COUNTRY_CAPACITY
#define ULOC_COUNTRY_CAPACITY
Useful constant for the maximum size of the country part of a locale ID (including the terminating NU...
Definition: uloc.h:256
UTZFMT_PARSE_OPTION_ALL_STYLES
@ UTZFMT_PARSE_OPTION_ALL_STYLES
When a time zone display name is not found within a set of display names used for the specified style...
Definition: tzfmt.h:236
icu::TimeZoneFormat
TimeZoneFormat supports time zone display name formatting and parsing.
Definition: tzfmt.h:273