OLD | NEW |
1 /* | 1 /* |
2 ******************************************************************************* | 2 ******************************************************************************* |
3 * Copyright (C) 1996-2013, International Business Machines | 3 * Copyright (C) 1996-2014, International Business Machines |
4 * Corporation and others. All Rights Reserved. | 4 * Corporation and others. All Rights Reserved. |
5 ******************************************************************************* | 5 ******************************************************************************* |
6 */ | 6 */ |
7 | 7 |
8 #ifndef UDAT_H | 8 #ifndef UDAT_H |
9 #define UDAT_H | 9 #define UDAT_H |
10 | 10 |
11 #include "unicode/utypes.h" | 11 #include "unicode/utypes.h" |
12 | 12 |
13 #if !UCONFIG_NO_FORMATTING | 13 #if !UCONFIG_NO_FORMATTING |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 /** No style */ | 179 /** No style */ |
180 UDAT_NONE = -1, | 180 UDAT_NONE = -1, |
181 | 181 |
182 /** | 182 /** |
183 * Use the pattern given in the parameter to udat_open | 183 * Use the pattern given in the parameter to udat_open |
184 * @see udat_open | 184 * @see udat_open |
185 * @stable ICU 50 | 185 * @stable ICU 50 |
186 */ | 186 */ |
187 UDAT_PATTERN = -2, | 187 UDAT_PATTERN = -2, |
188 | 188 |
| 189 #ifndef U_HIDE_INTERNAL_API |
189 /** @internal alias to UDAT_PATTERN */ | 190 /** @internal alias to UDAT_PATTERN */ |
190 UDAT_IGNORE = UDAT_PATTERN | 191 UDAT_IGNORE = UDAT_PATTERN |
| 192 #endif /* U_HIDE_INTERNAL_API */ |
191 } UDateFormatStyle; | 193 } UDateFormatStyle; |
192 | 194 |
193 /* Skeletons for dates. */ | 195 /* Skeletons for dates. */ |
194 | 196 |
195 /** | 197 /** |
196 * Constant for date skeleton with year. | 198 * Constant for date skeleton with year. |
197 * @stable ICU 4.0 | 199 * @stable ICU 4.0 |
198 */ | 200 */ |
199 #define UDAT_YEAR "y" | 201 #define UDAT_YEAR "y" |
200 #ifndef U_HIDE_DRAFT_API | |
201 /** | 202 /** |
202 * Constant for date skeleton with quarter. | 203 * Constant for date skeleton with quarter. |
203 * @draft ICU 51 | 204 * @stable ICU 51 |
204 */ | 205 */ |
205 #define UDAT_QUARTER "QQQQ" | 206 #define UDAT_QUARTER "QQQQ" |
206 /** | 207 /** |
207 * Constant for date skeleton with abbreviated quarter. | 208 * Constant for date skeleton with abbreviated quarter. |
208 * @draft ICU 51 | 209 * @stable ICU 51 |
209 */ | 210 */ |
210 #define UDAT_ABBR_QUARTER "QQQ" | 211 #define UDAT_ABBR_QUARTER "QQQ" |
211 #endif /* U_HIDE_DRAFT_API */ | |
212 /** | 212 /** |
213 * Constant for date skeleton with year and quarter. | 213 * Constant for date skeleton with year and quarter. |
214 * @stable ICU 4.0 | 214 * @stable ICU 4.0 |
215 */ | 215 */ |
216 #define UDAT_YEAR_QUARTER "yQQQQ" | 216 #define UDAT_YEAR_QUARTER "yQQQQ" |
217 /** | 217 /** |
218 * Constant for date skeleton with year and abbreviated quarter. | 218 * Constant for date skeleton with year and abbreviated quarter. |
219 * @stable ICU 4.0 | 219 * @stable ICU 4.0 |
220 */ | 220 */ |
221 #define UDAT_YEAR_ABBR_QUARTER "yQQQ" | 221 #define UDAT_YEAR_ABBR_QUARTER "yQQQ" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 * Used in combinations date + time, date + time + zone, or time + zone. | 265 * Used in combinations date + time, date + time + zone, or time + zone. |
266 * @stable ICU 4.0 | 266 * @stable ICU 4.0 |
267 */ | 267 */ |
268 #define UDAT_YEAR_ABBR_MONTH_DAY "yMMMd" | 268 #define UDAT_YEAR_ABBR_MONTH_DAY "yMMMd" |
269 /** | 269 /** |
270 * Constant for date skeleton with year, numeric month, and day. | 270 * Constant for date skeleton with year, numeric month, and day. |
271 * Used in combinations date + time, date + time + zone, or time + zone. | 271 * Used in combinations date + time, date + time + zone, or time + zone. |
272 * @stable ICU 4.0 | 272 * @stable ICU 4.0 |
273 */ | 273 */ |
274 #define UDAT_YEAR_NUM_MONTH_DAY "yMd" | 274 #define UDAT_YEAR_NUM_MONTH_DAY "yMd" |
275 #ifndef U_HIDE_DRAFT_API | |
276 /** | 275 /** |
277 * Constant for date skeleton with weekday. | 276 * Constant for date skeleton with weekday. |
278 * @draft ICU 51 | 277 * @stable ICU 51 |
279 */ | 278 */ |
280 #define UDAT_WEEKDAY "EEEE" | 279 #define UDAT_WEEKDAY "EEEE" |
281 /** | 280 /** |
282 * Constant for date skeleton with abbreviated weekday. | 281 * Constant for date skeleton with abbreviated weekday. |
283 * @draft ICU 51 | 282 * @stable ICU 51 |
284 */ | 283 */ |
285 #define UDAT_ABBR_WEEKDAY "E" | 284 #define UDAT_ABBR_WEEKDAY "E" |
286 #endif /* U_HIDE_DRAFT_API */ | |
287 /** | 285 /** |
288 * Constant for date skeleton with year, month, weekday, and day. | 286 * Constant for date skeleton with year, month, weekday, and day. |
289 * Used in combinations date + time, date + time + zone, or time + zone. | 287 * Used in combinations date + time, date + time + zone, or time + zone. |
290 * @stable ICU 4.0 | 288 * @stable ICU 4.0 |
291 */ | 289 */ |
292 #define UDAT_YEAR_MONTH_WEEKDAY_DAY "yMMMMEEEEd" | 290 #define UDAT_YEAR_MONTH_WEEKDAY_DAY "yMMMMEEEEd" |
293 /** | 291 /** |
294 * Constant for date skeleton with year, abbreviated month, weekday, and day. | 292 * Constant for date skeleton with year, abbreviated month, weekday, and day. |
295 * Used in combinations date + time, date + time + zone, or time + zone. | 293 * Used in combinations date + time, date + time + zone, or time + zone. |
296 * @stable ICU 4.0 | 294 * @stable ICU 4.0 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 */ | 337 */ |
340 #define UDAT_NUM_MONTH_WEEKDAY_DAY "MEd" | 338 #define UDAT_NUM_MONTH_WEEKDAY_DAY "MEd" |
341 | 339 |
342 /* Skeletons for times. */ | 340 /* Skeletons for times. */ |
343 | 341 |
344 /** | 342 /** |
345 * Constant for date skeleton with hour, with the locale's preferred hour format
(12 or 24). | 343 * Constant for date skeleton with hour, with the locale's preferred hour format
(12 or 24). |
346 * @stable ICU 4.0 | 344 * @stable ICU 4.0 |
347 */ | 345 */ |
348 #define UDAT_HOUR "j" | 346 #define UDAT_HOUR "j" |
349 #ifndef U_HIDE_DRAFT_API | |
350 /** | 347 /** |
351 * Constant for date skeleton with hour in 24-hour presentation. | 348 * Constant for date skeleton with hour in 24-hour presentation. |
352 * @draft ICU 51 | 349 * @stable ICU 51 |
353 */ | 350 */ |
354 #define UDAT_HOUR24 "H" | 351 #define UDAT_HOUR24 "H" |
355 /** | 352 /** |
356 * Constant for date skeleton with minute. | 353 * Constant for date skeleton with minute. |
357 * @draft ICU 51 | 354 * @stable ICU 51 |
358 */ | 355 */ |
359 #define UDAT_MINUTE "m" | 356 #define UDAT_MINUTE "m" |
360 #endif /* U_HIDE_DRAFT_API */ | |
361 /** | 357 /** |
362 * Constant for date skeleton with hour and minute, with the locale's preferred
hour format (12 or 24). | 358 * Constant for date skeleton with hour and minute, with the locale's preferred
hour format (12 or 24). |
363 * Used in combinations date + time, date + time + zone, or time + zone. | 359 * Used in combinations date + time, date + time + zone, or time + zone. |
364 * @stable ICU 4.0 | 360 * @stable ICU 4.0 |
365 */ | 361 */ |
366 #define UDAT_HOUR_MINUTE "jm" | 362 #define UDAT_HOUR_MINUTE "jm" |
367 /** | 363 /** |
368 * Constant for date skeleton with hour and minute in 24-hour presentation. | 364 * Constant for date skeleton with hour and minute in 24-hour presentation. |
369 * Used in combinations date + time, date + time + zone, or time + zone. | 365 * Used in combinations date + time, date + time + zone, or time + zone. |
370 * @stable ICU 4.0 | 366 * @stable ICU 4.0 |
371 */ | 367 */ |
372 #define UDAT_HOUR24_MINUTE "Hm" | 368 #define UDAT_HOUR24_MINUTE "Hm" |
373 #ifndef U_HIDE_DRAFT_API | |
374 /** | 369 /** |
375 * Constant for date skeleton with second. | 370 * Constant for date skeleton with second. |
376 * @draft ICU 51 | 371 * @stable ICU 51 |
377 */ | 372 */ |
378 #define UDAT_SECOND "s" | 373 #define UDAT_SECOND "s" |
379 #endif /* U_HIDE_DRAFT_API */ | |
380 /** | 374 /** |
381 * Constant for date skeleton with hour, minute, and second, | 375 * Constant for date skeleton with hour, minute, and second, |
382 * with the locale's preferred hour format (12 or 24). | 376 * with the locale's preferred hour format (12 or 24). |
383 * Used in combinations date + time, date + time + zone, or time + zone. | 377 * Used in combinations date + time, date + time + zone, or time + zone. |
384 * @stable ICU 4.0 | 378 * @stable ICU 4.0 |
385 */ | 379 */ |
386 #define UDAT_HOUR_MINUTE_SECOND "jms" | 380 #define UDAT_HOUR_MINUTE_SECOND "jms" |
387 /** | 381 /** |
388 * Constant for date skeleton with hour, minute, and second in | 382 * Constant for date skeleton with hour, minute, and second in |
389 * 24-hour presentation. | 383 * 24-hour presentation. |
390 * Used in combinations date + time, date + time + zone, or time + zone. | 384 * Used in combinations date + time, date + time + zone, or time + zone. |
391 * @stable ICU 4.0 | 385 * @stable ICU 4.0 |
392 */ | 386 */ |
393 #define UDAT_HOUR24_MINUTE_SECOND "Hms" | 387 #define UDAT_HOUR24_MINUTE_SECOND "Hms" |
394 /** | 388 /** |
395 * Constant for date skeleton with minute and second. | 389 * Constant for date skeleton with minute and second. |
396 * Used in combinations date + time, date + time + zone, or time + zone. | 390 * Used in combinations date + time, date + time + zone, or time + zone. |
397 * @stable ICU 4.0 | 391 * @stable ICU 4.0 |
398 */ | 392 */ |
399 #define UDAT_MINUTE_SECOND "ms" | 393 #define UDAT_MINUTE_SECOND "ms" |
400 | 394 |
401 /* Skeletons for time zones. */ | 395 /* Skeletons for time zones. */ |
402 | 396 |
403 #ifndef U_HIDE_DRAFT_API | |
404 /** | 397 /** |
405 * Constant for <i>generic location format</i>, such as Los Angeles Time; | 398 * Constant for <i>generic location format</i>, such as Los Angeles Time; |
406 * used in combinations date + time + zone, or time + zone. | 399 * used in combinations date + time + zone, or time + zone. |
407 * @see <a href="http://unicode.org/reports/tr35/#Date_Format_Patterns">LDML Dat
e Format Patterns</a> | 400 * @see <a href="http://unicode.org/reports/tr35/#Date_Format_Patterns">LDML Dat
e Format Patterns</a> |
408 * @see <a href="http://unicode.org/reports/tr35/#Time_Zone_Fallback">LDML Time
Zone Fallback</a> | 401 * @see <a href="http://unicode.org/reports/tr35/#Time_Zone_Fallback">LDML Time
Zone Fallback</a> |
409 * @draft ICU 51 | 402 * @stable ICU 51 |
410 */ | 403 */ |
411 #define UDAT_LOCATION_TZ "VVVV" | 404 #define UDAT_LOCATION_TZ "VVVV" |
412 /** | 405 /** |
413 * Constant for <i>generic non-location format</i>, such as Pacific Time; | 406 * Constant for <i>generic non-location format</i>, such as Pacific Time; |
414 * used in combinations date + time + zone, or time + zone. | 407 * used in combinations date + time + zone, or time + zone. |
415 * @see <a href="http://unicode.org/reports/tr35/#Date_Format_Patterns">LDML Dat
e Format Patterns</a> | 408 * @see <a href="http://unicode.org/reports/tr35/#Date_Format_Patterns">LDML Dat
e Format Patterns</a> |
416 * @see <a href="http://unicode.org/reports/tr35/#Time_Zone_Fallback">LDML Time
Zone Fallback</a> | 409 * @see <a href="http://unicode.org/reports/tr35/#Time_Zone_Fallback">LDML Time
Zone Fallback</a> |
417 * @draft ICU 51 | 410 * @stable ICU 51 |
418 */ | 411 */ |
419 #define UDAT_GENERIC_TZ "vvvv" | 412 #define UDAT_GENERIC_TZ "vvvv" |
420 /** | 413 /** |
421 * Constant for <i>generic non-location format</i>, abbreviated if possible, suc
h as PT; | 414 * Constant for <i>generic non-location format</i>, abbreviated if possible, suc
h as PT; |
422 * used in combinations date + time + zone, or time + zone. | 415 * used in combinations date + time + zone, or time + zone. |
423 * @see <a href="http://unicode.org/reports/tr35/#Date_Format_Patterns">LDML Dat
e Format Patterns</a> | 416 * @see <a href="http://unicode.org/reports/tr35/#Date_Format_Patterns">LDML Dat
e Format Patterns</a> |
424 * @see <a href="http://unicode.org/reports/tr35/#Time_Zone_Fallback">LDML Time
Zone Fallback</a> | 417 * @see <a href="http://unicode.org/reports/tr35/#Time_Zone_Fallback">LDML Time
Zone Fallback</a> |
425 * @draft ICU 51 | 418 * @stable ICU 51 |
426 */ | 419 */ |
427 #define UDAT_ABBR_GENERIC_TZ "v" | 420 #define UDAT_ABBR_GENERIC_TZ "v" |
428 /** | 421 /** |
429 * Constant for <i>specific non-location format</i>, such as Pacific Daylight Ti
me; | 422 * Constant for <i>specific non-location format</i>, such as Pacific Daylight Ti
me; |
430 * used in combinations date + time + zone, or time + zone. | 423 * used in combinations date + time + zone, or time + zone. |
431 * @see <a href="http://unicode.org/reports/tr35/#Date_Format_Patterns">LDML Dat
e Format Patterns</a> | 424 * @see <a href="http://unicode.org/reports/tr35/#Date_Format_Patterns">LDML Dat
e Format Patterns</a> |
432 * @see <a href="http://unicode.org/reports/tr35/#Time_Zone_Fallback">LDML Time
Zone Fallback</a> | 425 * @see <a href="http://unicode.org/reports/tr35/#Time_Zone_Fallback">LDML Time
Zone Fallback</a> |
433 * @draft ICU 51 | 426 * @stable ICU 51 |
434 */ | 427 */ |
435 #define UDAT_SPECIFIC_TZ "zzzz" | 428 #define UDAT_SPECIFIC_TZ "zzzz" |
436 /** | 429 /** |
437 * Constant for <i>specific non-location format</i>, abbreviated if possible, su
ch as PDT; | 430 * Constant for <i>specific non-location format</i>, abbreviated if possible, su
ch as PDT; |
438 * used in combinations date + time + zone, or time + zone. | 431 * used in combinations date + time + zone, or time + zone. |
439 * @see <a href="http://unicode.org/reports/tr35/#Date_Format_Patterns">LDML Dat
e Format Patterns</a> | 432 * @see <a href="http://unicode.org/reports/tr35/#Date_Format_Patterns">LDML Dat
e Format Patterns</a> |
440 * @see <a href="http://unicode.org/reports/tr35/#Time_Zone_Fallback">LDML Time
Zone Fallback</a> | 433 * @see <a href="http://unicode.org/reports/tr35/#Time_Zone_Fallback">LDML Time
Zone Fallback</a> |
441 * @draft ICU 51 | 434 * @stable ICU 51 |
442 */ | 435 */ |
443 #define UDAT_ABBR_SPECIFIC_TZ "z" | 436 #define UDAT_ABBR_SPECIFIC_TZ "z" |
444 /** | 437 /** |
445 * Constant for <i>localized GMT/UTC format</i>, such as GMT+8:00 or HPG-8:00; | 438 * Constant for <i>localized GMT/UTC format</i>, such as GMT+8:00 or HPG-8:00; |
446 * used in combinations date + time + zone, or time + zone. | 439 * used in combinations date + time + zone, or time + zone. |
447 * @see <a href="http://unicode.org/reports/tr35/#Date_Format_Patterns">LDML Dat
e Format Patterns</a> | 440 * @see <a href="http://unicode.org/reports/tr35/#Date_Format_Patterns">LDML Dat
e Format Patterns</a> |
448 * @see <a href="http://unicode.org/reports/tr35/#Time_Zone_Fallback">LDML Time
Zone Fallback</a> | 441 * @see <a href="http://unicode.org/reports/tr35/#Time_Zone_Fallback">LDML Time
Zone Fallback</a> |
449 * @draft ICU 51 | 442 * @stable ICU 51 |
450 */ | 443 */ |
451 #define UDAT_ABBR_UTC_TZ "ZZZZ" | 444 #define UDAT_ABBR_UTC_TZ "ZZZZ" |
452 #endif /* U_HIDE_DRAFT_API */ | |
453 | 445 |
454 /* deprecated skeleton constants */ | 446 /* deprecated skeleton constants */ |
455 | 447 |
456 #ifndef U_HIDE_DEPRECATED_API | 448 #ifndef U_HIDE_DEPRECATED_API |
457 /** | 449 /** |
458 * Constant for date skeleton with standalone month. | 450 * Constant for date skeleton with standalone month. |
459 * @deprecated ICU 50 Use UDAT_MONTH instead. | 451 * @deprecated ICU 50 Use UDAT_MONTH instead. |
460 */ | 452 */ |
461 #define UDAT_STANDALONE_MONTH "LLLL" | 453 #define UDAT_STANDALONE_MONTH "LLLL" |
462 /** | 454 /** |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 | 720 |
729 /** | 721 /** |
730 * FieldPosition selector for "U" field alignment, | 722 * FieldPosition selector for "U" field alignment, |
731 * corresponding to cyclic year names. This is implemented | 723 * corresponding to cyclic year names. This is implemented |
732 * using the {@link #UCAL_YEAR} field. This displays | 724 * using the {@link #UCAL_YEAR} field. This displays |
733 * the cyclic year name, if available. | 725 * the cyclic year name, if available. |
734 * @stable ICU 49 | 726 * @stable ICU 49 |
735 */ | 727 */ |
736 UDAT_YEAR_NAME_FIELD = 30, | 728 UDAT_YEAR_NAME_FIELD = 30, |
737 | 729 |
738 #ifndef U_HIDE_DRAFT_API | |
739 /** | 730 /** |
740 * FieldPosition selector for 'O' field alignment, | 731 * FieldPosition selector for 'O' field alignment, |
741 * corresponding to the UCAL_ZONE_OFFSET and UCAL_DST_OFFSETfields. | 732 * corresponding to the UCAL_ZONE_OFFSET and UCAL_DST_OFFSETfields. |
742 * This displays the localized GMT format. | 733 * This displays the localized GMT format. |
743 * @draft ICU 51 | 734 * @stable ICU 51 |
744 */ | 735 */ |
745 UDAT_TIMEZONE_LOCALIZED_GMT_OFFSET_FIELD = 31, | 736 UDAT_TIMEZONE_LOCALIZED_GMT_OFFSET_FIELD = 31, |
746 | 737 |
747 /** | 738 /** |
748 * FieldPosition selector for 'X' field alignment, | 739 * FieldPosition selector for 'X' field alignment, |
749 * corresponding to the UCAL_ZONE_OFFSET and UCAL_DST_OFFSETfields. | 740 * corresponding to the UCAL_ZONE_OFFSET and UCAL_DST_OFFSETfields. |
750 * This displays the ISO 8601 local time offset format or UTC indicator ("Z"
). | 741 * This displays the ISO 8601 local time offset format or UTC indicator ("Z"
). |
751 * @draft ICU 51 | 742 * @stable ICU 51 |
752 */ | 743 */ |
753 UDAT_TIMEZONE_ISO_FIELD = 32, | 744 UDAT_TIMEZONE_ISO_FIELD = 32, |
754 | 745 |
755 /** | 746 /** |
756 * FieldPosition selector for 'x' field alignment, | 747 * FieldPosition selector for 'x' field alignment, |
757 * corresponding to the UCAL_ZONE_OFFSET and UCAL_DST_OFFSETfields. | 748 * corresponding to the UCAL_ZONE_OFFSET and UCAL_DST_OFFSET fields. |
758 * This displays the ISO 8601 local time offset format. | 749 * This displays the ISO 8601 local time offset format. |
759 * @draft ICU 51 | 750 * @stable ICU 51 |
760 */ | 751 */ |
761 UDAT_TIMEZONE_ISO_LOCAL_FIELD = 33, | 752 UDAT_TIMEZONE_ISO_LOCAL_FIELD = 33, |
762 #endif /* U_HIDE_DRAFT_API */ | |
763 | 753 |
| 754 #ifndef U_HIDE_INTERNAL_API |
764 /** | 755 /** |
| 756 * FieldPosition and UFieldPosition selector for 'r' field alignment, |
| 757 * no directly corresponding UCAL_ field. |
| 758 * @internal ICU 53 |
| 759 */ |
| 760 UDAT_RELATED_YEAR_FIELD = 34, |
| 761 #endif /* U_HIDE_INTERNAL_API */ |
| 762 |
| 763 /** |
765 * Number of FieldPosition and UFieldPosition selectors for | 764 * Number of FieldPosition and UFieldPosition selectors for |
766 * DateFormat and UDateFormat. | 765 * DateFormat and UDateFormat. |
767 * Valid selectors range from 0 to UDAT_FIELD_COUNT-1. | 766 * Valid selectors range from 0 to UDAT_FIELD_COUNT-1. |
768 * This value is subject to change if new fields are defined | 767 * This value is subject to change if new fields are defined |
769 * in the future. | 768 * in the future. |
770 * @stable ICU 3.0 | 769 * @stable ICU 3.0 |
771 */ | 770 */ |
772 UDAT_FIELD_COUNT = 34 | 771 UDAT_FIELD_COUNT = 35 |
773 | 772 |
774 } UDateFormatField; | 773 } UDateFormatField; |
775 | 774 |
776 | 775 |
777 /** | 776 /** |
778 * Maps from a UDateFormatField to the corresponding UCalendarDateFields. | 777 * Maps from a UDateFormatField to the corresponding UCalendarDateFields. |
779 * Note: since the mapping is many-to-one, there is no inverse mapping. | 778 * Note: since the mapping is many-to-one, there is no inverse mapping. |
780 * @param field the UDateFormatField. | 779 * @param field the UDateFormatField. |
781 * @return the UCalendarDateField. This will be UCAL_FIELD_COUNT in case | 780 * @return the UCalendarDateField. This will be UCAL_FIELD_COUNT in case |
782 * of error (e.g., the input field is UDAT_FIELD_COUNT). | 781 * of error (e.g., the input field is UDAT_FIELD_COUNT). |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
828 /** | 827 /** |
829 * Close a UDateFormat. | 828 * Close a UDateFormat. |
830 * Once closed, a UDateFormat may no longer be used. | 829 * Once closed, a UDateFormat may no longer be used. |
831 * @param format The formatter to close. | 830 * @param format The formatter to close. |
832 * @stable ICU 2.0 | 831 * @stable ICU 2.0 |
833 */ | 832 */ |
834 U_STABLE void U_EXPORT2 | 833 U_STABLE void U_EXPORT2 |
835 udat_close(UDateFormat* format); | 834 udat_close(UDateFormat* format); |
836 | 835 |
837 | 836 |
| 837 /* Dont hide UDateFormatBooleanAttribute type with #ifndef U_HIDE_DRAFT_API, nee
ded by virtual methods */ |
| 838 /* Also don't hide UDAT_BOOLEAN_ATTRIBUTE_COUNT, needed by template class EnumSe
t<UDateFormatBooleanAttribute,...> */ |
838 /** | 839 /** |
839 * DateFormat boolean attributes | 840 * DateFormat boolean attributes |
840 * @internal ICU technology preview | 841 * |
| 842 * @draft ICU 53 |
841 */ | 843 */ |
842 typedef enum UDateFormatBooleanAttribute { | 844 typedef enum UDateFormatBooleanAttribute { |
843 /** | 845 #ifndef U_HIDE_DRAFT_API |
| 846 /** |
844 * indicates whether whitespace is allowed. Includes trailing dot tolerance. | 847 * indicates whether whitespace is allowed. Includes trailing dot tolerance. |
845 * @internal ICU technology preview | 848 * @draft ICU 53 |
846 */ | 849 */ |
847 UDAT_PARSE_ALLOW_WHITESPACE, | 850 UDAT_PARSE_ALLOW_WHITESPACE = 0, |
848 /** | 851 /** |
849 * indicates tolerance of numeric data when String data may be assumed. eg:
UDAT_YEAR_NAME_FIELD, | 852 * indicates tolerance of numeric data when String data may be assumed. eg:
UDAT_YEAR_NAME_FIELD, |
850 * »» UDAT_STANDALONE_MONTH_FIELD, UDAT_DAY_OF_WEEK_FIELD | 853 * UDAT_STANDALONE_MONTH_FIELD, UDAT_DAY_OF_WEEK_FIELD |
851 * @internal ICU technology preview | 854 * @draft ICU 53 |
852 */ | 855 */ |
853 UDAT_PARSE_ALLOW_NUMERIC, | 856 UDAT_PARSE_ALLOW_NUMERIC = 1, |
| 857 /** |
| 858 * indicates tolerance of a partial literal match |
| 859 * @draft ICU 53 |
| 860 */ |
| 861 UDAT_PARSE_PARTIAL_MATCH = 2, |
| 862 /** |
| 863 * indicates tolerance of pattern mismatch between input data and specified
format pattern. |
| 864 * e.g. accepting "September" for a month pattern of MMM ("Sep") |
| 865 * @draft ICU 53 |
| 866 */ |
| 867 UDAT_PARSE_MULTIPLE_PATTERNS_FOR_MATCH = 3, |
| 868 #endif /* U_HIDE_DRAFT_API */ |
854 /** | 869 /** |
855 * count boolean date format constants | 870 * count boolean date format constants |
856 * @internal ICU technology preview | 871 * @draft ICU 53 |
857 */ | 872 */ |
858 UDAT_BOOLEAN_ATTRIBUTE_COUNT | 873 UDAT_BOOLEAN_ATTRIBUTE_COUNT = 4 |
859 } UDateFormatBooleanAttribute; | 874 } UDateFormatBooleanAttribute; |
860 | 875 |
861 #ifndef U_HIDE_INTERNAL_API | 876 #ifndef U_HIDE_DRAFT_API |
862 /** | 877 /** |
863 * Get a boolean attribute associated with a UDateFormat. | 878 * Get a boolean attribute associated with a UDateFormat. |
864 * An example would be a true value for a key of UDAT_PARSE_ALLOW_WHITESPACE ind
icating allowing whitespace leniency. | 879 * An example would be a true value for a key of UDAT_PARSE_ALLOW_WHITESPACE ind
icating allowing whitespace leniency. |
865 * If the formatter does not understand the attribute, -1 is returned. | 880 * If the formatter does not understand the attribute, -1 is returned. |
866 * @param fmt The formatter to query. | 881 * @param fmt The formatter to query. |
867 * @param attr The attribute to query; e.g. UDAT_PARSE_ALLOW_WHITESPACE. | 882 * @param attr The attribute to query; e.g. UDAT_PARSE_ALLOW_WHITESPACE. |
868 * @param status A pointer to an UErrorCode to receive any errors | 883 * @param status A pointer to an UErrorCode to receive any errors |
869 * @return The value of attr. | 884 * @return The value of attr. |
870 * @internal technology preview | 885 * @draft ICU 53 |
871 */ | 886 */ |
872 U_INTERNAL UBool U_EXPORT2 | 887 U_DRAFT UBool U_EXPORT2 |
873 udat_getBooleanAttribute(const UDateFormat* fmt, UDateFormatBooleanAttribute att
r, UErrorCode* status); | 888 udat_getBooleanAttribute(const UDateFormat* fmt, UDateFormatBooleanAttribute att
r, UErrorCode* status); |
874 | 889 |
875 /** | 890 /** |
876 * Set a boolean attribute associated with a UDateFormat. | 891 * Set a boolean attribute associated with a UDateFormat. |
877 * An example of a boolean attribute is parse leniency control. If the formatte
r does not understand | 892 * An example of a boolean attribute is parse leniency control. If the formatte
r does not understand |
878 * the attribute, the call is ignored. | 893 * the attribute, the call is ignored. |
879 * @param fmt The formatter to set. | 894 * @param fmt The formatter to set. |
880 * @param attr The attribute to set; one of UDAT_PARSE_ALLOW_WHITESPACE or UDAT_
PARSE_ALLOW_NUMERIC | 895 * @param attr The attribute to set; one of UDAT_PARSE_ALLOW_WHITESPACE or UDAT_
PARSE_ALLOW_NUMERIC |
881 * @param newValue The new value of attr. | 896 * @param newValue The new value of attr. |
882 * @param status A pointer to an UErrorCode to receive any errors | 897 * @param status A pointer to an UErrorCode to receive any errors |
883 * @internal ICU technology preview | 898 * @draft ICU 53 |
884 */ | 899 */ |
885 U_INTERNAL void U_EXPORT2 | 900 U_DRAFT void U_EXPORT2 |
886 udat_setBooleanAttribute(UDateFormat *fmt, UDateFormatBooleanAttribute attr, UBo
ol, UErrorCode* status); | 901 udat_setBooleanAttribute(UDateFormat *fmt, UDateFormatBooleanAttribute attr, UBo
ol newValue, UErrorCode* status); |
887 | 902 |
888 #endif /* U_HIDE_INTERNAL_API */ | 903 #endif /* U_HIDE_DRAFT_API */ |
889 | 904 |
890 | 905 |
891 | 906 |
892 #if U_SHOW_CPLUSPLUS_API | 907 #if U_SHOW_CPLUSPLUS_API |
893 | 908 |
894 U_NAMESPACE_BEGIN | 909 U_NAMESPACE_BEGIN |
895 | 910 |
896 /** | 911 /** |
897 * \class LocalUDateFormatPointer | 912 * \class LocalUDateFormatPointer |
898 * "Smart pointer" class, closes a UDateFormat via udat_close(). | 913 * "Smart pointer" class, closes a UDateFormat via udat_close(). |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1062 * A UDateFormat uses a UNumberFormat to format numbers within a date, | 1077 * A UDateFormat uses a UNumberFormat to format numbers within a date, |
1063 * for example the day number. | 1078 * for example the day number. |
1064 * @param fmt The formatter to query. | 1079 * @param fmt The formatter to query. |
1065 * @return A pointer to the UNumberFormat used by fmt to format numbers. | 1080 * @return A pointer to the UNumberFormat used by fmt to format numbers. |
1066 * @see udat_setNumberFormat | 1081 * @see udat_setNumberFormat |
1067 * @stable ICU 2.0 | 1082 * @stable ICU 2.0 |
1068 */ | 1083 */ |
1069 U_STABLE const UNumberFormat* U_EXPORT2 | 1084 U_STABLE const UNumberFormat* U_EXPORT2 |
1070 udat_getNumberFormat(const UDateFormat* fmt); | 1085 udat_getNumberFormat(const UDateFormat* fmt); |
1071 | 1086 |
| 1087 #ifndef U_HIDE_DRAFT_API |
| 1088 /** |
| 1089 * Get the UNumberFormat for specific field associated with an UDateFormat. |
| 1090 * For example: 'y' for year and 'M' for month |
| 1091 * @param fmt The formatter to query. |
| 1092 * @param field the field to query |
| 1093 * @return A pointer to the UNumberFormat used by fmt to format field numbers. |
| 1094 * @see udat_setNumberFormatForField |
| 1095 * @draft ICU 54 |
| 1096 */ |
| 1097 U_DRAFT const UNumberFormat* U_EXPORT2 |
| 1098 udat_getNumberFormatForField(const UDateFormat* fmt, UChar field); |
| 1099 |
| 1100 /** |
| 1101 * Set the UNumberFormat for specific field associated with an UDateFormat. |
| 1102 * It can be a single field like: "y"(year) or "M"(month) |
| 1103 * It can be several field combined together: "yM"(year and month) |
| 1104 * Note: |
| 1105 * 1 symbol field is enough for multiple symbol field (so "y" will override "yy",
"yyy") |
| 1106 * If the field is not numeric, then override has no effect (like "MMM" will use
abbreviation, not numerical field) |
| 1107 * |
| 1108 * @param fields the fields to set |
| 1109 * @param fmt The formatter to set. |
| 1110 * @param numberFormatToSet A pointer to the UNumberFormat to be used by fmt to f
ormat numbers. |
| 1111 * @param status error code passed around (memory allocation or invalid fields) |
| 1112 * @see udat_getNumberFormatForField |
| 1113 * @draft ICU 54 |
| 1114 */ |
| 1115 U_DRAFT void U_EXPORT2 |
| 1116 udat_adoptNumberFormatForFields( UDateFormat* fmt, |
| 1117 const UChar* fields, |
| 1118 UNumberFormat* numberFormatToSet, |
| 1119 UErrorCode* status); |
| 1120 #endif /* U_HIDE_DRAFT_API */ |
| 1121 |
1072 /** | 1122 /** |
1073 * Set the UNumberFormat associated with an UDateFormat. | 1123 * Set the UNumberFormat associated with an UDateFormat. |
1074 * A UDateFormat uses a UNumberFormat to format numbers within a date, | 1124 * A UDateFormat uses a UNumberFormat to format numbers within a date, |
1075 * for example the day number. | 1125 * for example the day number. |
| 1126 * This method also clears per field NumberFormat instances previously |
| 1127 * set by {@see udat_setNumberFormatForField} |
1076 * @param fmt The formatter to set. | 1128 * @param fmt The formatter to set. |
1077 * @param numberFormatToSet A pointer to the UNumberFormat to be used by fmt to f
ormat numbers. | 1129 * @param numberFormatToSet A pointer to the UNumberFormat to be used by fmt to f
ormat numbers. |
1078 * @see udat_getNumberFormat | 1130 * @see udat_getNumberFormat |
| 1131 * @see udat_setNumberFormatForField |
1079 * @stable ICU 2.0 | 1132 * @stable ICU 2.0 |
1080 */ | 1133 */ |
1081 U_STABLE void U_EXPORT2 | 1134 U_STABLE void U_EXPORT2 |
1082 udat_setNumberFormat( UDateFormat* fmt, | 1135 udat_setNumberFormat( UDateFormat* fmt, |
1083 const UNumberFormat* numberFormatToSet); | 1136 const UNumberFormat* numberFormatToSet); |
1084 | 1137 |
| 1138 #ifndef U_HIDE_DRAFT_API |
| 1139 /** |
| 1140 * Adopt the UNumberFormat associated with an UDateFormat. |
| 1141 * A UDateFormat uses a UNumberFormat to format numbers within a date, |
| 1142 * for example the day number. |
| 1143 * @param fmt The formatter to set. |
| 1144 * @param numberFormatToAdopt A pointer to the UNumberFormat to be used by fmt to
format numbers. |
| 1145 * @see udat_getNumberFormat |
| 1146 * @draft ICU 54 |
| 1147 */ |
| 1148 U_DRAFT void U_EXPORT2 |
| 1149 udat_adoptNumberFormat( UDateFormat* fmt, |
| 1150 UNumberFormat* numberFormatToAdopt); |
| 1151 #endif /* U_HIDE_DRAFT_API */ |
| 1152 |
1085 /** | 1153 /** |
1086 * Get a locale for which date/time formatting patterns are available. | 1154 * Get a locale for which date/time formatting patterns are available. |
1087 * A UDateFormat in a locale returned by this function will perform the correct | 1155 * A UDateFormat in a locale returned by this function will perform the correct |
1088 * formatting and parsing for the locale. | 1156 * formatting and parsing for the locale. |
1089 * @param localeIndex The index of the desired locale. | 1157 * @param localeIndex The index of the desired locale. |
1090 * @return A locale for which date/time formatting patterns are available, or 0 i
f none. | 1158 * @return A locale for which date/time formatting patterns are available, or 0 i
f none. |
1091 * @see udat_countAvailable | 1159 * @see udat_countAvailable |
1092 * @stable ICU 2.0 | 1160 * @stable ICU 2.0 |
1093 */ | 1161 */ |
1094 U_STABLE const char* U_EXPORT2 | 1162 U_STABLE const char* U_EXPORT2 |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1210 UDAT_STANDALONE_SHORT_WEEKDAYS, | 1278 UDAT_STANDALONE_SHORT_WEEKDAYS, |
1211 /** The CLDR-style stand-alone "narrow" weekday names */ | 1279 /** The CLDR-style stand-alone "narrow" weekday names */ |
1212 UDAT_STANDALONE_NARROW_WEEKDAYS, | 1280 UDAT_STANDALONE_NARROW_WEEKDAYS, |
1213 /** The quarters, for example 1st Quarter */ | 1281 /** The quarters, for example 1st Quarter */ |
1214 UDAT_QUARTERS, | 1282 UDAT_QUARTERS, |
1215 /** The short quarter names, for example Q1 */ | 1283 /** The short quarter names, for example Q1 */ |
1216 UDAT_SHORT_QUARTERS, | 1284 UDAT_SHORT_QUARTERS, |
1217 /** Standalone context versions of quarters */ | 1285 /** Standalone context versions of quarters */ |
1218 UDAT_STANDALONE_QUARTERS, | 1286 UDAT_STANDALONE_QUARTERS, |
1219 UDAT_STANDALONE_SHORT_QUARTERS, | 1287 UDAT_STANDALONE_SHORT_QUARTERS, |
1220 #ifndef U_HIDE_DRAFT_API | |
1221 /** | 1288 /** |
1222 * The CLDR-style short weekday names, e.g. "Su", Mo", etc. | 1289 * The CLDR-style short weekday names, e.g. "Su", Mo", etc. |
1223 * These are named "SHORTER" to contrast with the constants using _SHORT_ | 1290 * These are named "SHORTER" to contrast with the constants using _SHORT_ |
1224 * above, which actually get the CLDR-style *abbreviated* versions of the | 1291 * above, which actually get the CLDR-style *abbreviated* versions of the |
1225 * corresponding names. | 1292 * corresponding names. |
1226 * @draft ICU 51 | 1293 * @stable ICU 51 |
1227 */ | 1294 */ |
1228 UDAT_SHORTER_WEEKDAYS, | 1295 UDAT_SHORTER_WEEKDAYS, |
1229 /** | 1296 /** |
1230 * Standalone version of UDAT_SHORTER_WEEKDAYS. | 1297 * Standalone version of UDAT_SHORTER_WEEKDAYS. |
1231 * @draft ICU 51 | 1298 * @stable ICU 51 |
1232 */ | 1299 */ |
1233 UDAT_STANDALONE_SHORTER_WEEKDAYS | 1300 UDAT_STANDALONE_SHORTER_WEEKDAYS |
| 1301 #ifndef U_HIDE_DRAFT_API |
| 1302 , |
| 1303 /** |
| 1304 * Cyclic year names (only supported for some calendars, and only for FO
RMAT usage; |
| 1305 * udat_setSymbols not supported for UDAT_CYCLIC_YEARS_WIDE) |
| 1306 * @draft ICU 54 |
| 1307 */ |
| 1308 UDAT_CYCLIC_YEARS_WIDE, |
| 1309 /** |
| 1310 * Cyclic year names (only supported for some calendars, and only for FO
RMAT usage) |
| 1311 * @draft ICU 54 |
| 1312 */ |
| 1313 UDAT_CYCLIC_YEARS_ABBREVIATED, |
| 1314 /** |
| 1315 * Cyclic year names (only supported for some calendars, and only for FO
RMAT usage; |
| 1316 * udat_setSymbols not supported for UDAT_CYCLIC_YEARS_NARROW) |
| 1317 * @draft ICU 54 |
| 1318 */ |
| 1319 UDAT_CYCLIC_YEARS_NARROW, |
| 1320 /** |
| 1321 * Calendar zodiac names (only supported for some calendars, and only f
or FORMAT usage; |
| 1322 * udat_setSymbols not supported for UDAT_ZODIAC_NAMES_WIDE) |
| 1323 * @draft ICU 54 |
| 1324 */ |
| 1325 UDAT_ZODIAC_NAMES_WIDE, |
| 1326 /** |
| 1327 * Calendar zodiac names (only supported for some calendars, and only f
or FORMAT usage) |
| 1328 * @draft ICU 54 |
| 1329 */ |
| 1330 UDAT_ZODIAC_NAMES_ABBREVIATED, |
| 1331 /** |
| 1332 * Calendar zodiac names (only supported for some calendars, and only f
or FORMAT usage; |
| 1333 * udat_setSymbols not supported for UDAT_ZODIAC_NAMES_NARROW) |
| 1334 * @draft ICU 54 |
| 1335 */ |
| 1336 UDAT_ZODIAC_NAMES_NARROW |
1234 #endif /* U_HIDE_DRAFT_API */ | 1337 #endif /* U_HIDE_DRAFT_API */ |
1235 } UDateFormatSymbolType; | 1338 } UDateFormatSymbolType; |
1236 | 1339 |
1237 struct UDateFormatSymbols; | 1340 struct UDateFormatSymbols; |
1238 /** Date format symbols. | 1341 /** Date format symbols. |
1239 * For usage in C programs. | 1342 * For usage in C programs. |
1240 * @stable ICU 2.6 | 1343 * @stable ICU 2.6 |
1241 */ | 1344 */ |
1242 typedef struct UDateFormatSymbols UDateFormatSymbols; | 1345 typedef struct UDateFormatSymbols UDateFormatSymbols; |
1243 | 1346 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1311 * @param type type of the locale we're looking for (valid or actual) | 1414 * @param type type of the locale we're looking for (valid or actual) |
1312 * @param status error code for the operation | 1415 * @param status error code for the operation |
1313 * @return the locale name | 1416 * @return the locale name |
1314 * @stable ICU 2.8 | 1417 * @stable ICU 2.8 |
1315 */ | 1418 */ |
1316 U_STABLE const char* U_EXPORT2 | 1419 U_STABLE const char* U_EXPORT2 |
1317 udat_getLocaleByType(const UDateFormat *fmt, | 1420 udat_getLocaleByType(const UDateFormat *fmt, |
1318 ULocDataLocaleType type, | 1421 ULocDataLocaleType type, |
1319 UErrorCode* status); | 1422 UErrorCode* status); |
1320 | 1423 |
1321 #ifndef U_HIDE_DRAFT_API | |
1322 /** | 1424 /** |
1323 * Set a particular UDisplayContext value in the formatter, such as | 1425 * Set a particular UDisplayContext value in the formatter, such as |
1324 * UDISPCTX_CAPITALIZATION_FOR_STANDALONE. | 1426 * UDISPCTX_CAPITALIZATION_FOR_STANDALONE. |
1325 * @param fmt The formatter for which to set a UDisplayContext value. | 1427 * @param fmt The formatter for which to set a UDisplayContext value. |
1326 * @param value The UDisplayContext value to set. | 1428 * @param value The UDisplayContext value to set. |
1327 * @param status A pointer to an UErrorCode to receive any errors | 1429 * @param status A pointer to an UErrorCode to receive any errors |
1328 * @draft ICU 51 | 1430 * @stable ICU 51 |
1329 */ | 1431 */ |
1330 U_DRAFT void U_EXPORT2 | 1432 U_DRAFT void U_EXPORT2 |
1331 udat_setContext(UDateFormat* fmt, UDisplayContext value, UErrorCode* status); | 1433 udat_setContext(UDateFormat* fmt, UDisplayContext value, UErrorCode* status); |
1332 | 1434 |
| 1435 #ifndef U_HIDE_DRAFT_API |
1333 /** | 1436 /** |
1334 * Get the formatter's UDisplayContext value for the specified UDisplayContextTy
pe, | 1437 * Get the formatter's UDisplayContext value for the specified UDisplayContextTy
pe, |
1335 * such as UDISPCTX_TYPE_CAPITALIZATION. | 1438 * such as UDISPCTX_TYPE_CAPITALIZATION. |
1336 * @param fmt The formatter to query. | 1439 * @param fmt The formatter to query. |
1337 * @param type The UDisplayContextType whose value to return | 1440 * @param type The UDisplayContextType whose value to return |
1338 * @param status A pointer to an UErrorCode to receive any errors | 1441 * @param status A pointer to an UErrorCode to receive any errors |
1339 * @return The UDisplayContextValue for the specified type. | 1442 * @return The UDisplayContextValue for the specified type. |
1340 * @draft ICU 51 | 1443 * @draft ICU 53 |
1341 */ | 1444 */ |
1342 U_DRAFT UDisplayContext U_EXPORT2 | 1445 U_DRAFT UDisplayContext U_EXPORT2 |
1343 udat_getContext(UDateFormat* fmt, UDisplayContextType type, UErrorCode* status); | 1446 udat_getContext(const UDateFormat* fmt, UDisplayContextType type, UErrorCode* st
atus); |
1344 | 1447 |
1345 #endif /* U_HIDE_DRAFT_API */ | 1448 #endif /* U_HIDE_DRAFT_API */ |
1346 | 1449 |
1347 #ifndef U_HIDE_INTERNAL_API | 1450 #ifndef U_HIDE_INTERNAL_API |
1348 /** | 1451 /** |
1349 * Extract the date pattern from a UDateFormat set for relative date formatting. | 1452 * Extract the date pattern from a UDateFormat set for relative date formatting. |
1350 * The pattern will follow the pattern syntax rules. | 1453 * The pattern will follow the pattern syntax rules. |
1351 * @param fmt The formatter to query. | 1454 * @param fmt The formatter to query. |
1352 * @param result A pointer to a buffer to receive the pattern. | 1455 * @param result A pointer to a buffer to receive the pattern. |
1353 * @param resultLength The maximum size of result. | 1456 * @param resultLength The maximum size of result. |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1424 * @internal ICU 49 | 1527 * @internal ICU 49 |
1425 */ | 1528 */ |
1426 U_INTERNAL UDateFormatOpener U_EXPORT2 | 1529 U_INTERNAL UDateFormatOpener U_EXPORT2 |
1427 udat_unregisterOpener(UDateFormatOpener opener, UErrorCode *status); | 1530 udat_unregisterOpener(UDateFormatOpener opener, UErrorCode *status); |
1428 #endif /* U_HIDE_INTERNAL_API */ | 1531 #endif /* U_HIDE_INTERNAL_API */ |
1429 | 1532 |
1430 | 1533 |
1431 #endif /* #if !UCONFIG_NO_FORMATTING */ | 1534 #endif /* #if !UCONFIG_NO_FORMATTING */ |
1432 | 1535 |
1433 #endif | 1536 #endif |
OLD | NEW |