| OLD | NEW |
| 1 /* | 1 /* |
| 2 ******************************************************************************* | 2 ******************************************************************************* |
| 3 * Copyright (C) 2011-2013, International Business Machines Corporation and * | 3 * Copyright (C) 2011-2014, International Business Machines Corporation and |
| 4 * others. All Rights Reserved. * | 4 * others. All Rights Reserved. |
| 5 ******************************************************************************* | 5 ******************************************************************************* |
| 6 */ | 6 */ |
| 7 #ifndef __TZFMT_H | 7 #ifndef __TZFMT_H |
| 8 #define __TZFMT_H | 8 #define __TZFMT_H |
| 9 | 9 |
| 10 /** | 10 /** |
| 11 * \file | 11 * \file |
| 12 * \brief C++ API: TimeZoneFormat | 12 * \brief C++ API: TimeZoneFormat |
| 13 */ | 13 */ |
| 14 | 14 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 /** | 50 /** |
| 51 * Specific short format, such as "EST", "PDT". | 51 * Specific short format, such as "EST", "PDT". |
| 52 * @stable ICU 50 | 52 * @stable ICU 50 |
| 53 */ | 53 */ |
| 54 UTZFMT_STYLE_SPECIFIC_SHORT, | 54 UTZFMT_STYLE_SPECIFIC_SHORT, |
| 55 /** | 55 /** |
| 56 * Localized GMT offset format, such as "GMT-05:00", "UTC+0100" | 56 * Localized GMT offset format, such as "GMT-05:00", "UTC+0100" |
| 57 * @stable ICU 50 | 57 * @stable ICU 50 |
| 58 */ | 58 */ |
| 59 UTZFMT_STYLE_LOCALIZED_GMT, | 59 UTZFMT_STYLE_LOCALIZED_GMT, |
| 60 #ifndef U_HIDE_DRAFT_API | |
| 61 /** | 60 /** |
| 62 * Short localized GMT offset format, such as "GMT-5", "UTC+1:30" | 61 * Short localized GMT offset format, such as "GMT-5", "UTC+1:30" |
| 63 * This style is equivalent to the LDML date format pattern "O". | 62 * This style is equivalent to the LDML date format pattern "O". |
| 64 * @draft ICU 51 | 63 * @stable ICU 51 |
| 65 */ | 64 */ |
| 66 UTZFMT_STYLE_LOCALIZED_GMT_SHORT, | 65 UTZFMT_STYLE_LOCALIZED_GMT_SHORT, |
| 67 /** | 66 /** |
| 68 * Short ISO 8601 local time difference (basic format) or the UTC indicator. | 67 * Short ISO 8601 local time difference (basic format) or the UTC indicator. |
| 69 * For example, "-05", "+0530", and "Z"(UTC). | 68 * For example, "-05", "+0530", and "Z"(UTC). |
| 70 * This style is equivalent to the LDML date format pattern "X". | 69 * This style is equivalent to the LDML date format pattern "X". |
| 71 * @draft ICU 51 | 70 * @stable ICU 51 |
| 72 */ | 71 */ |
| 73 UTZFMT_STYLE_ISO_BASIC_SHORT, | 72 UTZFMT_STYLE_ISO_BASIC_SHORT, |
| 74 /** | 73 /** |
| 75 * Short ISO 8601 locale time difference (basic format). | 74 * Short ISO 8601 locale time difference (basic format). |
| 76 * For example, "-05" and "+0530". | 75 * For example, "-05" and "+0530". |
| 77 * This style is equivalent to the LDML date format pattern "x". | 76 * This style is equivalent to the LDML date format pattern "x". |
| 78 * @draft ICU 51 | 77 * @stable ICU 51 |
| 79 */ | 78 */ |
| 80 UTZFMT_STYLE_ISO_BASIC_LOCAL_SHORT, | 79 UTZFMT_STYLE_ISO_BASIC_LOCAL_SHORT, |
| 81 /** | 80 /** |
| 82 * Fixed width ISO 8601 local time difference (basic format) or the UTC indi
cator. | 81 * Fixed width ISO 8601 local time difference (basic format) or the UTC indi
cator. |
| 83 * For example, "-0500", "+0530", and "Z"(UTC). | 82 * For example, "-0500", "+0530", and "Z"(UTC). |
| 84 * This style is equivalent to the LDML date format pattern "XX". | 83 * This style is equivalent to the LDML date format pattern "XX". |
| 85 * @draft ICU 51 | 84 * @stable ICU 51 |
| 86 */ | 85 */ |
| 87 UTZFMT_STYLE_ISO_BASIC_FIXED, | 86 UTZFMT_STYLE_ISO_BASIC_FIXED, |
| 88 /** | 87 /** |
| 89 * Fixed width ISO 8601 local time difference (basic format). | 88 * Fixed width ISO 8601 local time difference (basic format). |
| 90 * For example, "-0500" and "+0530". | 89 * For example, "-0500" and "+0530". |
| 91 * This style is equivalent to the LDML date format pattern "xx". | 90 * This style is equivalent to the LDML date format pattern "xx". |
| 92 * @draft ICU 51 | 91 * @stable ICU 51 |
| 93 */ | 92 */ |
| 94 UTZFMT_STYLE_ISO_BASIC_LOCAL_FIXED, | 93 UTZFMT_STYLE_ISO_BASIC_LOCAL_FIXED, |
| 95 /** | 94 /** |
| 96 * ISO 8601 local time difference (basic format) with optional seconds field
, or the UTC indicator. | 95 * ISO 8601 local time difference (basic format) with optional seconds field
, or the UTC indicator. |
| 97 * For example, "-0500", "+052538", and "Z"(UTC). | 96 * For example, "-0500", "+052538", and "Z"(UTC). |
| 98 * This style is equivalent to the LDML date format pattern "XXXX". | 97 * This style is equivalent to the LDML date format pattern "XXXX". |
| 99 * @draft ICU 51 | 98 * @stable ICU 51 |
| 100 */ | 99 */ |
| 101 UTZFMT_STYLE_ISO_BASIC_FULL, | 100 UTZFMT_STYLE_ISO_BASIC_FULL, |
| 102 /** | 101 /** |
| 103 * ISO 8601 local time difference (basic format) with optional seconds field
. | 102 * ISO 8601 local time difference (basic format) with optional seconds field
. |
| 104 * For example, "-0500" and "+052538". | 103 * For example, "-0500" and "+052538". |
| 105 * This style is equivalent to the LDML date format pattern "xxxx". | 104 * This style is equivalent to the LDML date format pattern "xxxx". |
| 106 * @draft ICU 51 | 105 * @stable ICU 51 |
| 107 */ | 106 */ |
| 108 UTZFMT_STYLE_ISO_BASIC_LOCAL_FULL, | 107 UTZFMT_STYLE_ISO_BASIC_LOCAL_FULL, |
| 109 /** | 108 /** |
| 110 * Fixed width ISO 8601 local time difference (extended format) or the UTC i
ndicator. | 109 * Fixed width ISO 8601 local time difference (extended format) or the UTC i
ndicator. |
| 111 * For example, "-05:00", "+05:30", and "Z"(UTC). | 110 * For example, "-05:00", "+05:30", and "Z"(UTC). |
| 112 * This style is equivalent to the LDML date format pattern "XXX". | 111 * This style is equivalent to the LDML date format pattern "XXX". |
| 113 * @draft ICU 51 | 112 * @stable ICU 51 |
| 114 */ | 113 */ |
| 115 UTZFMT_STYLE_ISO_EXTENDED_FIXED, | 114 UTZFMT_STYLE_ISO_EXTENDED_FIXED, |
| 116 /** | 115 /** |
| 117 * Fixed width ISO 8601 local time difference (extended format). | 116 * Fixed width ISO 8601 local time difference (extended format). |
| 118 * For example, "-05:00" and "+05:30". | 117 * For example, "-05:00" and "+05:30". |
| 119 * This style is equivalent to the LDML date format pattern "xxx" and "ZZZZZ
". | 118 * This style is equivalent to the LDML date format pattern "xxx" and "ZZZZZ
". |
| 120 * @draft ICU 51 | 119 * @stable ICU 51 |
| 121 */ | 120 */ |
| 122 UTZFMT_STYLE_ISO_EXTENDED_LOCAL_FIXED, | 121 UTZFMT_STYLE_ISO_EXTENDED_LOCAL_FIXED, |
| 123 /** | 122 /** |
| 124 * ISO 8601 local time difference (extended format) with optional seconds fi
eld, or the UTC indicator. | 123 * ISO 8601 local time difference (extended format) with optional seconds fi
eld, or the UTC indicator. |
| 125 * For example, "-05:00", "+05:25:38", and "Z"(UTC). | 124 * For example, "-05:00", "+05:25:38", and "Z"(UTC). |
| 126 * This style is equivalent to the LDML date format pattern "XXXXX". | 125 * This style is equivalent to the LDML date format pattern "XXXXX". |
| 127 * @draft ICU 51 | 126 * @stable ICU 51 |
| 128 */ | 127 */ |
| 129 UTZFMT_STYLE_ISO_EXTENDED_FULL, | 128 UTZFMT_STYLE_ISO_EXTENDED_FULL, |
| 130 /** | 129 /** |
| 131 * ISO 8601 local time difference (extended format) with optional seconds fi
eld. | 130 * ISO 8601 local time difference (extended format) with optional seconds fi
eld. |
| 132 * For example, "-05:00" and "+05:25:38". | 131 * For example, "-05:00" and "+05:25:38". |
| 133 * This style is equivalent to the LDML date format pattern "xxxxx". | 132 * This style is equivalent to the LDML date format pattern "xxxxx". |
| 134 * @draft ICU 51 | 133 * @stable ICU 51 |
| 135 */ | 134 */ |
| 136 UTZFMT_STYLE_ISO_EXTENDED_LOCAL_FULL, | 135 UTZFMT_STYLE_ISO_EXTENDED_LOCAL_FULL, |
| 137 /** | 136 /** |
| 138 * Time Zone ID, such as "America/Los_Angeles". | 137 * Time Zone ID, such as "America/Los_Angeles". |
| 139 * @draft ICU 51 | 138 * @stable ICU 51 |
| 140 */ | 139 */ |
| 141 UTZFMT_STYLE_ZONE_ID, | 140 UTZFMT_STYLE_ZONE_ID, |
| 142 /** | 141 /** |
| 143 * Short Time Zone ID (BCP 47 Unicode location extension, time zone type val
ue), such as "uslax". | 142 * Short Time Zone ID (BCP 47 Unicode location extension, time zone type val
ue), such as "uslax". |
| 144 * @draft ICU 51 | 143 * @stable ICU 51 |
| 145 */ | 144 */ |
| 146 UTZFMT_STYLE_ZONE_ID_SHORT, | 145 UTZFMT_STYLE_ZONE_ID_SHORT, |
| 147 /** | 146 /** |
| 148 * Exemplar location, such as "Los Angeles" and "Paris". | 147 * Exemplar location, such as "Los Angeles" and "Paris". |
| 149 * @draft ICU 51 | 148 * @stable ICU 51 |
| 150 */ | 149 */ |
| 151 UTZFMT_STYLE_EXEMPLAR_LOCATION | 150 UTZFMT_STYLE_EXEMPLAR_LOCATION |
| 152 #endif /* U_HIDE_DRAFT_API */ | |
| 153 } UTimeZoneFormatStyle; | 151 } UTimeZoneFormatStyle; |
| 154 | 152 |
| 155 /** | 153 /** |
| 156 * Constants for GMT offset pattern types. | 154 * Constants for GMT offset pattern types. |
| 157 * @stable ICU 50 | 155 * @stable ICU 50 |
| 158 */ | 156 */ |
| 159 typedef enum UTimeZoneFormatGMTOffsetPatternType { | 157 typedef enum UTimeZoneFormatGMTOffsetPatternType { |
| 160 /** | 158 /** |
| 161 * Positive offset with hours and minutes fields | 159 * Positive offset with hours and minutes fields |
| 162 * @stable ICU 50 | 160 * @stable ICU 50 |
| 163 */ | 161 */ |
| 164 UTZFMT_PAT_POSITIVE_HM, | 162 UTZFMT_PAT_POSITIVE_HM, |
| 165 /** | 163 /** |
| 166 * Positive offset with hours, minutes and seconds fields | 164 * Positive offset with hours, minutes and seconds fields |
| 167 * @stable ICU 50 | 165 * @stable ICU 50 |
| 168 */ | 166 */ |
| 169 UTZFMT_PAT_POSITIVE_HMS, | 167 UTZFMT_PAT_POSITIVE_HMS, |
| 170 /** | 168 /** |
| 171 * Negative offset with hours and minutes fields | 169 * Negative offset with hours and minutes fields |
| 172 * @stable ICU 50 | 170 * @stable ICU 50 |
| 173 */ | 171 */ |
| 174 UTZFMT_PAT_NEGATIVE_HM, | 172 UTZFMT_PAT_NEGATIVE_HM, |
| 175 /** | 173 /** |
| 176 * Negative offset with hours, minutes and seconds fields | 174 * Negative offset with hours, minutes and seconds fields |
| 177 * @stable ICU 50 | 175 * @stable ICU 50 |
| 178 */ | 176 */ |
| 179 UTZFMT_PAT_NEGATIVE_HMS, | 177 UTZFMT_PAT_NEGATIVE_HMS, |
| 180 #ifndef U_HIDE_DRAFT_API | |
| 181 /** | 178 /** |
| 182 * Positive offset with hours field | 179 * Positive offset with hours field |
| 183 * @draft ICU 51 | 180 * @stable ICU 51 |
| 184 */ | 181 */ |
| 185 UTZFMT_PAT_POSITIVE_H, | 182 UTZFMT_PAT_POSITIVE_H, |
| 186 /** | 183 /** |
| 187 * Negative offset with hours field | 184 * Negative offset with hours field |
| 188 * @draft ICU 51 | 185 * @stable ICU 51 |
| 189 */ | 186 */ |
| 190 UTZFMT_PAT_NEGATIVE_H, | 187 UTZFMT_PAT_NEGATIVE_H, |
| 191 #endif /* U_HIDE_DRAFT_API */ | |
| 192 | 188 |
| 189 /* The following cannot be #ifndef U_HIDE_INTERNAL_API, needed for other .h
declarations */ |
| 193 /** | 190 /** |
| 194 * Number of UTimeZoneFormatGMTOffsetPatternType types. | 191 * Number of UTimeZoneFormatGMTOffsetPatternType types. |
| 195 * @internal | 192 * @internal |
| 196 */ | 193 */ |
| 197 UTZFMT_PAT_COUNT = 6 | 194 UTZFMT_PAT_COUNT = 6 |
| 198 } UTimeZoneFormatGMTOffsetPatternType; | 195 } UTimeZoneFormatGMTOffsetPatternType; |
| 199 | 196 |
| 200 /** | 197 /** |
| 201 * Constants for time types used by TimeZoneFormat APIs for | 198 * Constants for time types used by TimeZoneFormat APIs for |
| 202 * receiving time type (standard time, daylight time or unknown). | 199 * receiving time type (standard time, daylight time or unknown). |
| (...skipping 27 matching lines...) Expand all Loading... |
| 230 * @stable ICU 50 | 227 * @stable ICU 50 |
| 231 */ | 228 */ |
| 232 UTZFMT_PARSE_OPTION_NONE = 0x00, | 229 UTZFMT_PARSE_OPTION_NONE = 0x00, |
| 233 /** | 230 /** |
| 234 * When a time zone display name is not found within a set of display names | 231 * When a time zone display name is not found within a set of display names |
| 235 * used for the specified style, look for the name from display names used | 232 * used for the specified style, look for the name from display names used |
| 236 * by other styles. | 233 * by other styles. |
| 237 * @stable ICU 50 | 234 * @stable ICU 50 |
| 238 */ | 235 */ |
| 239 UTZFMT_PARSE_OPTION_ALL_STYLES = 0x01 | 236 UTZFMT_PARSE_OPTION_ALL_STYLES = 0x01 |
| 237 #ifndef U_HIDE_DRAFT_API |
| 238 , |
| 239 /** |
| 240 * When parsing a time zone display name in UTZFMT_STYLE_SPECIFIC_SHORT, |
| 241 * look for the IANA tz database compatible zone abbreviations in addition |
| 242 * to the localized names coming from the {@link TimeZoneNames} currently |
| 243 * used by the {@link TimeZoneFormat}. |
| 244 * @draft ICU 54 |
| 245 */ |
| 246 UTZFMT_PARSE_OPTION_TZ_DATABASE_ABBREVIATIONS = 0x02 |
| 247 #endif /* U_HIDE_DRAFT_API */ |
| 240 } UTimeZoneFormatParseOption; | 248 } UTimeZoneFormatParseOption; |
| 241 | 249 |
| 242 U_CDECL_END | 250 U_CDECL_END |
| 243 | 251 |
| 244 U_NAMESPACE_BEGIN | 252 U_NAMESPACE_BEGIN |
| 245 | 253 |
| 246 class TimeZoneGenericNames; | 254 class TimeZoneGenericNames; |
| 255 class TZDBTimeZoneNames; |
| 247 class UVector; | 256 class UVector; |
| 248 | 257 |
| 249 /** | 258 /** |
| 250 * <code>TimeZoneFormat</code> supports time zone display name formatting and pa
rsing. | 259 * <code>TimeZoneFormat</code> supports time zone display name formatting and pa
rsing. |
| 251 * An instance of TimeZoneFormat works as a subformatter of {@link SimpleDateFor
mat}, | 260 * An instance of TimeZoneFormat works as a subformatter of {@link SimpleDateFor
mat}, |
| 252 * but you can also directly get a new instance of <code>TimeZoneFormat</code> a
nd | 261 * but you can also directly get a new instance of <code>TimeZoneFormat</code> a
nd |
| 253 * formatting/parsing time zone display names. | 262 * formatting/parsing time zone display names. |
| 254 * <p> | 263 * <p> |
| 255 * ICU implements the time zone display names defined by <a href="http://www.uni
code.org/reports/tr35/">UTS#35 | 264 * ICU implements the time zone display names defined by <a href="http://www.uni
code.org/reports/tr35/">UTS#35 |
| 256 * Unicode Locale Data Markup Language (LDML)</a>. {@link TimeZoneNames} represe
nts the | 265 * Unicode Locale Data Markup Language (LDML)</a>. {@link TimeZoneNames} represe
nts the |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 * Clone this object polymorphically. The caller is responsible | 304 * Clone this object polymorphically. The caller is responsible |
| 296 * for deleting the result when done. | 305 * for deleting the result when done. |
| 297 * @return A copy of the object | 306 * @return A copy of the object |
| 298 * @stable ICU 50 | 307 * @stable ICU 50 |
| 299 */ | 308 */ |
| 300 virtual Format* clone() const; | 309 virtual Format* clone() const; |
| 301 | 310 |
| 302 /** | 311 /** |
| 303 * Creates an instance of <code>TimeZoneFormat</code> for the given locale. | 312 * Creates an instance of <code>TimeZoneFormat</code> for the given locale. |
| 304 * @param locale The locale. | 313 * @param locale The locale. |
| 305 * @param status Recevies the status. | 314 * @param status Receives the status. |
| 306 * @return An instance of <code>TimeZoneFormat</code> for the given locale, | 315 * @return An instance of <code>TimeZoneFormat</code> for the given locale, |
| 307 * owned by the caller. | 316 * owned by the caller. |
| 308 * @stable ICU 50 | 317 * @stable ICU 50 |
| 309 */ | 318 */ |
| 310 static TimeZoneFormat* U_EXPORT2 createInstance(const Locale& locale, UError
Code& status); | 319 static TimeZoneFormat* U_EXPORT2 createInstance(const Locale& locale, UError
Code& status); |
| 311 | 320 |
| 312 /** | 321 /** |
| 313 * Returns the time zone display name data used by this instance. | 322 * Returns the time zone display name data used by this instance. |
| 314 * @return The time zone display name data. | 323 * @return The time zone display name data. |
| 315 * @stable ICU 50 | 324 * @stable ICU 50 |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 /** | 435 /** |
| 427 * Sets the default parse options. | 436 * Sets the default parse options. |
| 428 * <p><b>Note</b>: By default, an instance of <code>TimeZoneFormat</code> | 437 * <p><b>Note</b>: By default, an instance of <code>TimeZoneFormat</code> |
| 429 * created by {@link #createInstance} has no parse options set (UTZFMT_PARSE
_OPTION_NONE). | 438 * created by {@link #createInstance} has no parse options set (UTZFMT_PARSE
_OPTION_NONE). |
| 430 * To specify multipe options, use bitwise flags of UTimeZoneFormatParseOpti
on. | 439 * To specify multipe options, use bitwise flags of UTimeZoneFormatParseOpti
on. |
| 431 * @see #UTimeZoneFormatParseOption | 440 * @see #UTimeZoneFormatParseOption |
| 432 * @stable ICU 50 | 441 * @stable ICU 50 |
| 433 */ | 442 */ |
| 434 void setDefaultParseOptions(uint32_t flags); | 443 void setDefaultParseOptions(uint32_t flags); |
| 435 | 444 |
| 436 #ifndef U_HIDE_DRAFT_API | |
| 437 /** | 445 /** |
| 438 * Returns the ISO 8601 basic time zone string for the given offset. | 446 * Returns the ISO 8601 basic time zone string for the given offset. |
| 439 * For example, "-08", "-0830" and "Z" | 447 * For example, "-08", "-0830" and "Z" |
| 440 * | 448 * |
| 441 * @param offset the offset from GMT(UTC) in milliseconds. | 449 * @param offset the offset from GMT(UTC) in milliseconds. |
| 442 * @param useUtcIndicator true if ISO 8601 UTC indicator "Z" is used when th
e offset is 0. | 450 * @param useUtcIndicator true if ISO 8601 UTC indicator "Z" is used when th
e offset is 0. |
| 443 * @param isShort true if shortest form is used. | 451 * @param isShort true if shortest form is used. |
| 444 * @param ignoreSeconds true if non-zero offset seconds is appended. | 452 * @param ignoreSeconds true if non-zero offset seconds is appended. |
| 445 * @param result Receives the ISO format string. | 453 * @param result Receives the ISO format string. |
| 446 * @param status Receives the status | 454 * @param status Receives the status |
| 447 * @return the ISO 8601 basic format. | 455 * @return the ISO 8601 basic format. |
| 448 * @see #formatOffsetISO8601Extended | 456 * @see #formatOffsetISO8601Extended |
| 449 * @see #parseOffsetISO8601 | 457 * @see #parseOffsetISO8601 |
| 450 * @draft ICU 51 | 458 * @stable ICU 51 |
| 451 */ | 459 */ |
| 452 UnicodeString& formatOffsetISO8601Basic(int32_t offset, UBool useUtcIndicato
r, UBool isShort, UBool ignoreSeconds, | 460 UnicodeString& formatOffsetISO8601Basic(int32_t offset, UBool useUtcIndicato
r, UBool isShort, UBool ignoreSeconds, |
| 453 UnicodeString& result, UErrorCode& status) const; | 461 UnicodeString& result, UErrorCode& status) const; |
| 454 | 462 |
| 455 /** | 463 /** |
| 456 * Returns the ISO 8601 extended time zone string for the given offset. | 464 * Returns the ISO 8601 extended time zone string for the given offset. |
| 457 * For example, "-08:00", "-08:30" and "Z" | 465 * For example, "-08:00", "-08:30" and "Z" |
| 458 * | 466 * |
| 459 * @param offset the offset from GMT(UTC) in milliseconds. | 467 * @param offset the offset from GMT(UTC) in milliseconds. |
| 460 * @param useUtcIndicator true if ISO 8601 UTC indicator "Z" is used when th
e offset is 0. | 468 * @param useUtcIndicator true if ISO 8601 UTC indicator "Z" is used when th
e offset is 0. |
| 461 * @param isShort true if shortest form is used. | 469 * @param isShort true if shortest form is used. |
| 462 * @param ignoreSeconds true if non-zero offset seconds is appended. | 470 * @param ignoreSeconds true if non-zero offset seconds is appended. |
| 463 * @param result Receives the ISO format string. | 471 * @param result Receives the ISO format string. |
| 464 * @param status Receives the status | 472 * @param status Receives the status |
| 465 * @return the ISO 8601 basic format. | 473 * @return the ISO 8601 basic format. |
| 466 * @see #formatOffsetISO8601Extended | 474 * @see #formatOffsetISO8601Extended |
| 467 * @see #parseOffsetISO8601 | 475 * @see #parseOffsetISO8601 |
| 468 * @draft ICU 51 | 476 * @stable ICU 51 |
| 469 */ | 477 */ |
| 470 UnicodeString& formatOffsetISO8601Extended(int32_t offset, UBool useUtcIndic
ator, UBool isShort, UBool ignoreSeconds, | 478 UnicodeString& formatOffsetISO8601Extended(int32_t offset, UBool useUtcIndic
ator, UBool isShort, UBool ignoreSeconds, |
| 471 UnicodeString& result, UErrorCode& status) const; | 479 UnicodeString& result, UErrorCode& status) const; |
| 472 #endif /* U_HIDE_DRAFT_API */ | |
| 473 | 480 |
| 474 /** | 481 /** |
| 475 * Returns the localized GMT(UTC) offset format for the given offset. | 482 * Returns the localized GMT(UTC) offset format for the given offset. |
| 476 * The localized GMT offset is defined by; | 483 * The localized GMT offset is defined by; |
| 477 * <ul> | 484 * <ul> |
| 478 * <li>GMT format pattern (e.g. "GMT {0}" - see {@link #getGMTPattern}) | 485 * <li>GMT format pattern (e.g. "GMT {0}" - see {@link #getGMTPattern}) |
| 479 * <li>Offset time pattern (e.g. "+HH:mm" - see {@link #getGMTOffsetPattern}
) | 486 * <li>Offset time pattern (e.g. "+HH:mm" - see {@link #getGMTOffsetPattern}
) |
| 480 * <li>Offset digits (e.g. "0123456789" - see {@link #getGMTOffsetDigits}) | 487 * <li>Offset digits (e.g. "0123456789" - see {@link #getGMTOffsetDigits}) |
| 481 * <li>GMT zero format (e.g. "GMT" - see {@link #getGMTZeroFormat}) | 488 * <li>GMT zero format (e.g. "GMT" - see {@link #getGMTZeroFormat}) |
| 482 * </ul> | 489 * </ul> |
| 483 * This format always uses 2 digit hours and minutes. When the given offset
has non-zero | 490 * This format always uses 2 digit hours and minutes. When the given offset
has non-zero |
| 484 * seconds, 2 digit seconds field will be appended. For example, | 491 * seconds, 2 digit seconds field will be appended. For example, |
| 485 * GMT+05:00 and GMT+05:28:06. | 492 * GMT+05:00 and GMT+05:28:06. |
| 486 * @param offset the offset from GMT(UTC) in milliseconds. | 493 * @param offset the offset from GMT(UTC) in milliseconds. |
| 487 * @param status Receives the status | 494 * @param status Receives the status |
| 488 * @param result Receives the localized GMT format string. | 495 * @param result Receives the localized GMT format string. |
| 489 * @return A reference to the result. | 496 * @return A reference to the result. |
| 490 * @see #parseOffsetLocalizedGMT | 497 * @see #parseOffsetLocalizedGMT |
| 491 * @stable ICU 50 | 498 * @stable ICU 50 |
| 492 */ | 499 */ |
| 493 UnicodeString& formatOffsetLocalizedGMT(int32_t offset, UnicodeString& resul
t, UErrorCode& status) const; | 500 UnicodeString& formatOffsetLocalizedGMT(int32_t offset, UnicodeString& resul
t, UErrorCode& status) const; |
| 494 | 501 |
| 495 #ifndef U_HIDE_DRAFT_API | |
| 496 /** | 502 /** |
| 497 * Returns the short localized GMT(UTC) offset format for the given offset. | 503 * Returns the short localized GMT(UTC) offset format for the given offset. |
| 498 * The short localized GMT offset is defined by; | 504 * The short localized GMT offset is defined by; |
| 499 * <ul> | 505 * <ul> |
| 500 * <li>GMT format pattern (e.g. "GMT {0}" - see {@link #getGMTPattern}) | 506 * <li>GMT format pattern (e.g. "GMT {0}" - see {@link #getGMTPattern}) |
| 501 * <li>Offset time pattern (e.g. "+HH:mm" - see {@link #getGMTOffsetPattern}
) | 507 * <li>Offset time pattern (e.g. "+HH:mm" - see {@link #getGMTOffsetPattern}
) |
| 502 * <li>Offset digits (e.g. "0123456789" - see {@link #getGMTOffsetDigits}) | 508 * <li>Offset digits (e.g. "0123456789" - see {@link #getGMTOffsetDigits}) |
| 503 * <li>GMT zero format (e.g. "GMT" - see {@link #getGMTZeroFormat}) | 509 * <li>GMT zero format (e.g. "GMT" - see {@link #getGMTZeroFormat}) |
| 504 * </ul> | 510 * </ul> |
| 505 * This format uses the shortest representation of offset. The hours field d
oes not | 511 * This format uses the shortest representation of offset. The hours field d
oes not |
| 506 * have leading zero and lower fields with zero will be truncated. For examp
le, | 512 * have leading zero and lower fields with zero will be truncated. For examp
le, |
| 507 * GMT+5 and GMT+530. | 513 * GMT+5 and GMT+530. |
| 508 * @param offset the offset from GMT(UTC) in milliseconds. | 514 * @param offset the offset from GMT(UTC) in milliseconds. |
| 509 * @param status Receives the status | 515 * @param status Receives the status |
| 510 * @param result Receives the short localized GMT format string. | 516 * @param result Receives the short localized GMT format string. |
| 511 * @return A reference to the result. | 517 * @return A reference to the result. |
| 512 * @see #parseOffsetShortLocalizedGMT | 518 * @see #parseOffsetShortLocalizedGMT |
| 513 * @draft ICU 51 | 519 * @stable ICU 51 |
| 514 */ | 520 */ |
| 515 UnicodeString& formatOffsetShortLocalizedGMT(int32_t offset, UnicodeString&
result, UErrorCode& status) const; | 521 UnicodeString& formatOffsetShortLocalizedGMT(int32_t offset, UnicodeString&
result, UErrorCode& status) const; |
| 516 #endif /* U_HIDE_DRAFT_API */ | |
| 517 | 522 |
| 518 using Format::format; | 523 using Format::format; |
| 519 | 524 |
| 520 /** | 525 /** |
| 521 * Returns the display name of the time zone at the given date for the style
. | 526 * Returns the display name of the time zone at the given date for the style
. |
| 522 * @param style The style (e.g. <code>UTZFMT_STYLE_GENERIC_LONG</code>, <cod
e>UTZFMT_STYLE_LOCALIZED_GMT</code>...) | 527 * @param style The style (e.g. <code>UTZFMT_STYLE_GENERIC_LONG</code>, <cod
e>UTZFMT_STYLE_LOCALIZED_GMT</code>...) |
| 523 * @param tz The time zone. | 528 * @param tz The time zone. |
| 524 * @param date The date. | 529 * @param date The date. |
| 525 * @param name Receives the display name. | 530 * @param name Receives the display name. |
| 526 * @param timeType the output argument for receiving the time type (standard
/daylight/unknown) | 531 * @param timeType the output argument for receiving the time type (standard
/daylight/unknown) |
| (...skipping 29 matching lines...) Expand all Loading... |
| 556 * and returns 0. | 561 * and returns 0. |
| 557 * @param text The text contains a localized GMT offset string at the positi
on. | 562 * @param text The text contains a localized GMT offset string at the positi
on. |
| 558 * @param pos The ParsePosition object. | 563 * @param pos The ParsePosition object. |
| 559 * @return The offset from GMT(UTC) in milliseconds for the given localized
GMT | 564 * @return The offset from GMT(UTC) in milliseconds for the given localized
GMT |
| 560 * offset format string. | 565 * offset format string. |
| 561 * @see #formatOffsetLocalizedGMT | 566 * @see #formatOffsetLocalizedGMT |
| 562 * @stable ICU 50 | 567 * @stable ICU 50 |
| 563 */ | 568 */ |
| 564 int32_t parseOffsetLocalizedGMT(const UnicodeString& text, ParsePosition& po
s) const; | 569 int32_t parseOffsetLocalizedGMT(const UnicodeString& text, ParsePosition& po
s) const; |
| 565 | 570 |
| 566 #ifndef U_HIDE_DRAFT_API | |
| 567 /** | 571 /** |
| 568 * Returns offset from GMT(UTC) in milliseconds for the given short localize
d GMT | 572 * Returns offset from GMT(UTC) in milliseconds for the given short localize
d GMT |
| 569 * offset format string. When the given string cannot be parsed, this method | 573 * offset format string. When the given string cannot be parsed, this method |
| 570 * sets the current position as the error index to <code>ParsePosition pos</
code> | 574 * sets the current position as the error index to <code>ParsePosition pos</
code> |
| 571 * and returns 0. | 575 * and returns 0. |
| 572 * @param text The text contains a short localized GMT offset string at the
position. | 576 * @param text The text contains a short localized GMT offset string at the
position. |
| 573 * @param pos The ParsePosition object. | 577 * @param pos The ParsePosition object. |
| 574 * @return The offset from GMT(UTC) in milliseconds for the given short loca
lized GMT | 578 * @return The offset from GMT(UTC) in milliseconds for the given short loca
lized GMT |
| 575 * offset format string. | 579 * offset format string. |
| 576 * @see #formatOffsetShortLocalizedGMT | 580 * @see #formatOffsetShortLocalizedGMT |
| 577 * @draft ICU 51 | 581 * @stable ICU 51 |
| 578 */ | 582 */ |
| 579 int32_t parseOffsetShortLocalizedGMT(const UnicodeString& text, ParsePositio
n& pos) const; | 583 int32_t parseOffsetShortLocalizedGMT(const UnicodeString& text, ParsePositio
n& pos) const; |
| 580 #endif /* U_HIDE_DRAFT_API */ | |
| 581 | 584 |
| 582 /** | 585 /** |
| 583 * Returns a <code>TimeZone</code> by parsing the time zone string according
to | 586 * Returns a <code>TimeZone</code> by parsing the time zone string according
to |
| 584 * the given parse position, the specified format style and parse options. | 587 * the given parse position, the specified format style and parse options. |
| 585 * | 588 * |
| 586 * @param text The text contains a time zone string at the position. | 589 * @param text The text contains a time zone string at the position. |
| 587 * @param style The format style | 590 * @param style The format style |
| 588 * @param pos The position. | 591 * @param pos The position. |
| 589 * @param parseOptions The parse options repesented by bitwise flags of UTim
eZoneFormatParseOption. | 592 * @param parseOptions The parse options repesented by bitwise flags of UTim
eZoneFormatParseOption. |
| 590 * @param timeType The output argument for receiving the time type (standard
/daylight/unknown), | 593 * @param timeType The output argument for receiving the time type (standard
/daylight/unknown), |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 699 | 702 |
| 700 /* Constant parts of GMT format pattern, populated from localized GMT format
pattern*/ | 703 /* Constant parts of GMT format pattern, populated from localized GMT format
pattern*/ |
| 701 UnicodeString fGMTPatternPrefix; /* Substring before {0} */ | 704 UnicodeString fGMTPatternPrefix; /* Substring before {0} */ |
| 702 UnicodeString fGMTPatternSuffix; /* Substring after {0} */ | 705 UnicodeString fGMTPatternSuffix; /* Substring after {0} */ |
| 703 | 706 |
| 704 /* Compiled offset patterns generated from fGMTOffsetPatterns[] */ | 707 /* Compiled offset patterns generated from fGMTOffsetPatterns[] */ |
| 705 UVector* fGMTOffsetPatternItems[UTZFMT_PAT_COUNT]; | 708 UVector* fGMTOffsetPatternItems[UTZFMT_PAT_COUNT]; |
| 706 | 709 |
| 707 UBool fAbuttingOffsetHoursAndMinutes; | 710 UBool fAbuttingOffsetHoursAndMinutes; |
| 708 | 711 |
| 712 /* TZDBTimeZoneNames object used for parsing */ |
| 713 TZDBTimeZoneNames* fTZDBTimeZoneNames; |
| 714 |
| 709 /** | 715 /** |
| 710 * Returns the time zone's specific format string. | 716 * Returns the time zone's specific format string. |
| 711 * @param tz the time zone | 717 * @param tz the time zone |
| 712 * @param stdType the name type used for standard time | 718 * @param stdType the name type used for standard time |
| 713 * @param dstType the name type used for daylight time | 719 * @param dstType the name type used for daylight time |
| 714 * @param date the date | 720 * @param date the date |
| 715 * @param name receives the time zone's specific format name string | 721 * @param name receives the time zone's specific format name string |
| 716 * @param timeType when null, actual time type is set | 722 * @param timeType when null, actual time type is set |
| 717 * @return a reference to name. | 723 * @return a reference to name. |
| 718 */ | 724 */ |
| (...skipping 11 matching lines...) Expand all Loading... |
| 730 UnicodeString& formatGeneric(const TimeZone& tz, int32_t genType, UDate date
, UnicodeString& name) const; | 736 UnicodeString& formatGeneric(const TimeZone& tz, int32_t genType, UDate date
, UnicodeString& name) const; |
| 731 | 737 |
| 732 /** | 738 /** |
| 733 * Lazily create a TimeZoneGenericNames instance | 739 * Lazily create a TimeZoneGenericNames instance |
| 734 * @param status receives the status | 740 * @param status receives the status |
| 735 * @return the cached TimeZoneGenericNames. | 741 * @return the cached TimeZoneGenericNames. |
| 736 */ | 742 */ |
| 737 const TimeZoneGenericNames* getTimeZoneGenericNames(UErrorCode& status) cons
t; | 743 const TimeZoneGenericNames* getTimeZoneGenericNames(UErrorCode& status) cons
t; |
| 738 | 744 |
| 739 /** | 745 /** |
| 746 * Lazily create a TZDBTimeZoneNames instance |
| 747 * @param status receives the status |
| 748 * @return the cached TZDBTimeZoneNames. |
| 749 */ |
| 750 const TZDBTimeZoneNames* getTZDBTimeZoneNames(UErrorCode& status) const; |
| 751 |
| 752 /** |
| 740 * Private method returning the time zone's exemplar location string. | 753 * Private method returning the time zone's exemplar location string. |
| 741 * This method will never return empty. | 754 * This method will never return empty. |
| 742 * @param tz the time zone | 755 * @param tz the time zone |
| 743 * @param name receives the time zone's exemplar location name | 756 * @param name receives the time zone's exemplar location name |
| 744 * @return a reference to name. | 757 * @return a reference to name. |
| 745 */ | 758 */ |
| 746 UnicodeString& formatExemplarLocation(const TimeZone& tz, UnicodeString& nam
e) const; | 759 UnicodeString& formatExemplarLocation(const TimeZone& tz, UnicodeString& nam
e) const; |
| 747 | 760 |
| 748 /** | 761 /** |
| 749 * Private enum specifying a combination of offset fields | 762 * Private enum specifying a combination of offset fields |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1076 * @param tzID receives the time zone ID | 1089 * @param tzID receives the time zone ID |
| 1077 * @return a reference to tzID | 1090 * @return a reference to tzID |
| 1078 */ | 1091 */ |
| 1079 UnicodeString& parseExemplarLocation(const UnicodeString& text, ParsePositio
n& pos, UnicodeString& tzID) const; | 1092 UnicodeString& parseExemplarLocation(const UnicodeString& text, ParsePositio
n& pos, UnicodeString& tzID) const; |
| 1080 }; | 1093 }; |
| 1081 | 1094 |
| 1082 U_NAMESPACE_END | 1095 U_NAMESPACE_END |
| 1083 | 1096 |
| 1084 #endif /* !UCONFIG_NO_FORMATTING */ | 1097 #endif /* !UCONFIG_NO_FORMATTING */ |
| 1085 #endif | 1098 #endif |
| OLD | NEW |