1 // © 2016 and later: Unicode, Inc. and others. 2 // License & terms of use: http://www.unicode.org/copyright.html 4 ******************************************************************************* 5 * Copyright (C) 2011-2015, International Business Machines Corporation and 6 * others. All Rights Reserved. 7 ******************************************************************************* 19 #if U_SHOW_CPLUSPLUS_API 21 #if !UCONFIG_NO_FORMATTING 193 /* The following cannot be #ifndef U_HIDE_INTERNAL_API, needed for other .h declarations */ 255 classTimeZoneGenericNames;
256 classTZDBTimeZoneNames;
464 UBool useUtcIndicator,
486 UBool useUtcIndicator,
622 int32_t parseOptions,
645 /* ---------------------------------------------- 647 * ---------------------------------------------- */ 703 /* Locale of this object */ 706 /* Stores the region (could be implicit default) */ 709 /* TimeZoneNames object used by this formatter */ 712 /* TimeZoneGenericNames object used by this formatter - lazily instantiated */ 713 TimeZoneGenericNames* fTimeZoneGenericNames;
715 /* Localized GMT format pattern - e.g. "GMT{0}" */ 718 /* Array of offset patterns used by Localized GMT format - e.g. "+HH:mm" */ 721 /* Localized decimal digits used by Localized GMT format */ 724 /* Localized GMT zero format - e.g. "GMT" */ 727 /* Bit flags representing parse options */ 728 uint32_t fDefParseOptionFlags;
730 /* Constant parts of GMT format pattern, populated from localized GMT format pattern*/ 734 /* Compiled offset patterns generated from fGMTOffsetPatterns[] */ 737 UBool fAbuttingOffsetHoursAndMinutes;
739 /* TZDBTimeZoneNames object used for parsing */ 740 TZDBTimeZoneNames* fTZDBTimeZoneNames;
770 const TimeZoneGenericNames* getTimeZoneGenericNames(
UErrorCode& status)
const;
777 const TZDBTimeZoneNames* getTZDBTimeZoneNames(
UErrorCode& status)
const;
885 UBool* hasDigitOffset =
nullptr)
const;
894 void appendOffsetDigits(
UnicodeString& buf, int32_t n, uint8_t minDigits)
const;
920 int32_t parseOffsetLocalizedGMTPattern(
constUnicodeString& text, int32_t start,
921 UBool isShort, int32_t& parsedLen)
const;
931 int32_t parseOffsetFields(
constUnicodeString& text, int32_t start,
UBool isShort, int32_t& parsedLen)
const;
944 int32_t parseOffsetFieldsWithPattern(
constUnicodeString& text, int32_t start,
945 UVector* patternItems,
UBool forceSingleHourDigit, int32_t& hour, int32_t& min, int32_t& sec)
const;
954 int32_t parseAbuttingOffsetFields(
constUnicodeString& text, int32_t start, int32_t& parsedLen)
const;
963 int32_t parseOffsetDefaultLocalizedGMT(
constUnicodeString& text,
int start, int32_t& parsedLen)
const;
973 int32_t parseDefaultOffsetFields(
constUnicodeString& text, int32_t start, char16_t separator,
974 int32_t& parsedLen)
const;
990 int32_t parseOffsetFieldWithLocalizedDigits(
constUnicodeString& text, int32_t start,
991 uint8_t minDigits, uint8_t maxDigits, uint16_t minVal, uint16_t maxVal, int32_t& parsedLen)
const;
1002 int32_t parseSingleLocalizedDigit(
constUnicodeString& text, int32_t start, int32_t& len)
const;
1013 staticUnicodeString& formatOffsetWithAsciiDigits(int32_t offset, char16_t sep,
1014 OffsetFields minFields, OffsetFields maxFields,
UnicodeString& result);
1029 OffsetFields minFields, OffsetFields maxFields,
UBool fixedHourWidth);
1044 OffsetFields minFields, OffsetFields maxFields);
1059 void initGMTOffsetPatterns(
UErrorCode& status);
1067 void checkAbuttingHoursAndMinutes();
1074 TimeZone* createTimeZoneForOffset(int32_t offset)
const;
1124 #endif/* !UCONFIG_NO_FORMATTING */ 1126 #endif/* U_SHOW_CPLUSPLUS_API */ FieldPosition is a simple class used by Format and its subclasses to identify fields in formatted out...
Base class for all formats.
U_I18N_API UnicodeString & format(const Formattable &obj, UnicodeString &appendTo, UErrorCode &status) const
Formats an object to produce a string.
Formattable objects can be passed to the Format class or its subclasses for formatting.
A Locale object represents a specific geographical, political, or cultural region.
ParsePosition is a simple class used by Format and its subclasses to keep track of the current positi...
TimeZoneFormat supports time zone display name formatting and parsing.
virtual U_I18N_API UClassID getDynamicClassID() const override
ICU "poor man's RTTI", returns a UClassID for the actual class.
virtual U_I18N_API ~TimeZoneFormat()
Destructor.
U_I18N_API TimeZoneFormat & operator=(const TimeZoneFormat &other)
Assignment operator.
U_I18N_API TimeZone * parse(UTimeZoneFormatStyle style, const UnicodeString &text, ParsePosition &pos, UTimeZoneFormatTimeType *timeType=nullptr) const
Returns a TimeZone by parsing the time zone string according to the given parse position,...
U_I18N_API UnicodeString & getGMTOffsetDigits(UnicodeString &digits) const
Returns the decimal digit characters used for localized GMT format.
U_I18N_API uint32_t getDefaultParseOptions() const
Returns the bitwise flags of UTimeZoneFormatParseOption representing the default parse options used b...
U_I18N_API UnicodeString & getGMTZeroFormat(UnicodeString &gmtZeroFormat) const
Returns the localized GMT format string for GMT(UTC) itself (GMT offset is 0).
static U_I18N_API TimeZoneFormat * createInstance(const Locale &locale, UErrorCode &status)
Creates an instance of TimeZoneFormat for the given locale.
U_I18N_API UnicodeString & getGMTOffsetPattern(UTimeZoneFormatGMTOffsetPatternType type, UnicodeString &pattern) const
Returns the offset pattern used for localized GMT format.
U_I18N_API int32_t parseOffsetLocalizedGMT(const UnicodeString &text, ParsePosition &pos) const
Returns offset from GMT(UTC) in milliseconds for the given localized GMT offset format string.
U_I18N_API const TimeZoneNames * getTimeZoneNames() const
Returns the time zone display name data used by this instance.
U_I18N_API void setGMTOffsetPattern(UTimeZoneFormatGMTOffsetPatternType type, const UnicodeString &pattern, UErrorCode &status)
Sets the offset pattern for the given offset type.
U_I18N_API UnicodeString & formatOffsetLocalizedGMT(int32_t offset, UnicodeString &result, UErrorCode &status) const
Returns the localized GMT(UTC) offset format for the given offset.
U_I18N_API 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.
static U_I18N_API UClassID getStaticClassID()
ICU "poor man's RTTI", returns a UClassID for this class.
virtual U_I18N_API bool operator==(const Format &other) const override
Return true if the given Format objects are semantically equal.
U_I18N_API void adoptTimeZoneNames(TimeZoneNames *tznames)
Sets the time zone display name data to this format instance.
U_I18N_API void setGMTPattern(const UnicodeString &pattern, UErrorCode &status)
Sets the localized GMT format pattern.
U_I18N_API UnicodeString & formatOffsetShortLocalizedGMT(int32_t offset, UnicodeString &result, UErrorCode &status) const
Returns the short localized GMT(UTC) offset format for the given offset.
U_I18N_API void setDefaultParseOptions(uint32_t flags)
Sets the default parse options.
virtual U_I18N_API void parseObject(const UnicodeString &source, Formattable &result, ParsePosition &parse_pos) const override
Parse a string to produce an object.
U_I18N_API void setGMTZeroFormat(const UnicodeString &gmtZeroFormat, UErrorCode &status)
Sets the localized GMT format string for GMT(UTC) itself (GMT offset is 0).
U_I18N_API TimeZoneFormat(const Locale &locale, UErrorCode &status)
Constructs a TimeZoneFormat object for the specified locale.
virtual U_I18N_API TimeZoneFormat * clone() const override
Clone this object polymorphically.
U_I18N_API void setTimeZoneNames(const TimeZoneNames &tznames)
Sets the time zone display name data to this format instance.
U_I18N_API 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.
virtual U_I18N_API UnicodeString & format(UTimeZoneFormatStyle style, const TimeZone &tz, UDate date, UnicodeString &name, UTimeZoneFormatTimeType *timeType=nullptr) const
Returns the display name of the time zone at the given date for the style.
virtual U_I18N_API TimeZone * parse(UTimeZoneFormatStyle style, const UnicodeString &text, ParsePosition &pos, int32_t parseOptions, UTimeZoneFormatTimeType *timeType=nullptr) const
Returns a TimeZone by parsing the time zone string according to the given parse position,...
U_I18N_API TimeZoneFormat(const TimeZoneFormat &other)
Copy constructor.
U_I18N_API 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_I18N_API 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.
virtual U_I18N_API UnicodeString & format(const Formattable &obj, UnicodeString &appendTo, FieldPosition &pos, UErrorCode &status) const override
Format an object to produce a time zone display string using localized GMT offset format.
U_I18N_API void setGMTOffsetDigits(const UnicodeString &digits, UErrorCode &status)
Sets the decimal digit characters used for localized GMT format.
U_I18N_API UnicodeString & getGMTPattern(UnicodeString &pattern) const
Returns the localized GMT format pattern.
MatchInfoCollection represents a collection of time zone name matches used by TimeZoneNames#find.
TimeZoneNames is an abstract class representing the time zone display name data model defined by UTS#...
TimeZone represents a time zone offset, and also figures out daylight savings.
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
C++ API: Base class for all formats.
C++ API: TimeZone object.
UTimeZoneFormatGMTOffsetPatternType
Constants for GMT offset pattern types.
@ UTZFMT_PAT_NEGATIVE_HM
Negative offset with hours and minutes fields.
@ UTZFMT_PAT_POSITIVE_HMS
Positive offset with hours, minutes and seconds fields.
@ UTZFMT_PAT_NEGATIVE_HMS
Negative offset with hours, minutes and seconds fields.
@ UTZFMT_PAT_POSITIVE_HM
Positive offset with hours and minutes fields.
@ UTZFMT_PAT_NEGATIVE_H
Negative offset with hours field.
@ UTZFMT_PAT_COUNT
Number of UTimeZoneFormatGMTOffsetPatternType types.
@ UTZFMT_PAT_POSITIVE_H
Positive offset with hours field.
UTimeZoneFormatStyle
Constants for time zone display format style used by format/parse APIs in TimeZoneFormat.
@ UTZFMT_STYLE_ZONE_ID
Time Zone ID, such as "America/Los_Angeles".
@ UTZFMT_STYLE_ISO_BASIC_LOCAL_SHORT
Short ISO 8601 locale time difference (basic format).
@ UTZFMT_STYLE_ISO_BASIC_FIXED
Fixed width ISO 8601 local time difference (basic format) or the UTC indicator.
@ UTZFMT_STYLE_ISO_EXTENDED_LOCAL_FIXED
Fixed width ISO 8601 local time difference (extended format).
@ 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...
@ UTZFMT_STYLE_ISO_BASIC_LOCAL_FIXED
Fixed width ISO 8601 local time difference (basic format).
@ UTZFMT_STYLE_ISO_EXTENDED_FIXED
Fixed width ISO 8601 local time difference (extended format) or the UTC indicator.
@ UTZFMT_STYLE_ISO_EXTENDED_LOCAL_FULL
ISO 8601 local time difference (extended format) with optional seconds field.
@ UTZFMT_STYLE_GENERIC_LONG
Generic long non-location format, such as "Eastern Time".
@ UTZFMT_STYLE_LOCALIZED_GMT
Localized GMT offset format, such as "GMT-05:00", "UTC+0100".
@ UTZFMT_STYLE_EXEMPLAR_LOCATION
Exemplar location, such as "Los Angeles" and "Paris".
@ UTZFMT_STYLE_ISO_BASIC_SHORT
Short ISO 8601 local time difference (basic format) or the UTC indicator.
@ UTZFMT_STYLE_ISO_BASIC_FULL
ISO 8601 local time difference (basic format) with optional seconds field, or the UTC indicator.
@ UTZFMT_STYLE_ISO_BASIC_LOCAL_FULL
ISO 8601 local time difference (basic format) with optional seconds field.
@ UTZFMT_STYLE_ZONE_ID_SHORT
Short Time Zone ID (BCP 47 Unicode location extension, time zone type value), such as "uslax".
@ UTZFMT_STYLE_ISO_EXTENDED_FULL
ISO 8601 local time difference (extended format) with optional seconds field, or the UTC indicator.
@ UTZFMT_STYLE_GENERIC_LOCATION
Generic location format, such as "United States Time (New York)", "Italy Time".
@ UTZFMT_STYLE_SPECIFIC_SHORT
Specific short format, such as "EST", "PDT".
@ UTZFMT_STYLE_GENERIC_SHORT
Generic short non-location format, such as "ET".
@ UTZFMT_STYLE_SPECIFIC_LONG
Specific long format, such as "Eastern Standard Time".
UTimeZoneFormatParseOption
Constants for parse option flags, used for specifying optional parse behavior.
@ 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...
@ 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...
@ UTZFMT_PARSE_OPTION_NONE
No option.
UTimeZoneFormatTimeType
Constants for time types used by TimeZoneFormat APIs for receiving time type (standard time,...
@ UTZFMT_TIME_TYPE_DAYLIGHT
Daylight saving time.
@ UTZFMT_TIME_TYPE_UNKNOWN
Unknown.
@ UTZFMT_TIME_TYPE_STANDARD
Standard time.
UTimeZoneNameType
Constants for time zone display name types.
#define ULOC_COUNTRY_CAPACITY
Useful constant for the maximum size of the country part of a locale ID (including the terminating NU...
int32_t UChar32
Define UChar32 as a type for single Unicode code points.
#define U_CDECL_END
This is used to end a declaration of a library private ICU C API.
int8_t UBool
The ICU boolean type, a signed-byte integer.
#define U_CDECL_BEGIN
This is used to begin a declaration of a library private ICU C API.
void * UClassID
UClassID is used to identify classes without using the compiler's RTTI.
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
#define U_I18N_API_CLASS
Set to export library symbols from inside the i18n library, and to import them from outside,...
#define U_I18N_API
Set to export library symbols from inside the i18n library, and to import them from outside.
double UDate
Date and Time data type.