OLD | NEW |
1 /* | 1 /* |
2 ******************************************************************************** | 2 ******************************************************************************** |
3 * Copyright (C) 1997-2013, International Business Machines | 3 * Copyright (C) 1997-2014, International Business Machines |
4 * Corporation and others. All Rights Reserved. | 4 * Corporation and others. All Rights Reserved. |
5 ******************************************************************************** | 5 ******************************************************************************** |
6 * | 6 * |
7 * File DTFMTSYM.H | 7 * File DTFMTSYM.H |
8 * | 8 * |
9 * Modification History: | 9 * Modification History: |
10 * | 10 * |
11 * Date Name Description | 11 * Date Name Description |
12 * 02/19/97 aliu Converted from java. | 12 * 02/19/97 aliu Converted from java. |
13 * 07/21/98 stephen Added getZoneIndex() | 13 * 07/21/98 stephen Added getZoneIndex() |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 * DateFormatSymbols are not expected to be subclassed. Data for a calendar is | 69 * DateFormatSymbols are not expected to be subclassed. Data for a calendar is |
70 * loaded out of resource bundles. The 'type' parameter indicates the type of | 70 * loaded out of resource bundles. The 'type' parameter indicates the type of |
71 * calendar, for example, "gregorian" or "japanese". If the type is not gregori
an | 71 * calendar, for example, "gregorian" or "japanese". If the type is not gregori
an |
72 * (or NULL, or an empty string) then the type is appended to the resource name, | 72 * (or NULL, or an empty string) then the type is appended to the resource name, |
73 * for example, 'Eras_japanese' instead of 'Eras'. If the resource 'Eras_japa
nese' did | 73 * for example, 'Eras_japanese' instead of 'Eras'. If the resource 'Eras_japa
nese' did |
74 * not exist (even in root), then this class will fall back to just 'Eras', that
is, | 74 * not exist (even in root), then this class will fall back to just 'Eras', that
is, |
75 * Gregorian data. Therefore, the calendar implementor MUST ensure that the roo
t | 75 * Gregorian data. Therefore, the calendar implementor MUST ensure that the roo
t |
76 * locale at least contains any resources that are to be particularized for the | 76 * locale at least contains any resources that are to be particularized for the |
77 * calendar type. | 77 * calendar type. |
78 */ | 78 */ |
79 class U_I18N_API DateFormatSymbols : public UObject { | 79 class U_I18N_API DateFormatSymbols U_FINAL : public UObject { |
80 public: | 80 public: |
81 /** | 81 /** |
82 * Construct a DateFormatSymbols object by loading format data from | 82 * Construct a DateFormatSymbols object by loading format data from |
83 * resources for the default locale, in the default calendar (Gregorian). | 83 * resources for the default locale, in the default calendar (Gregorian). |
84 * <P> | 84 * <P> |
85 * NOTE: This constructor will never fail; if it cannot get resource | 85 * NOTE: This constructor will never fail; if it cannot get resource |
86 * data for the default locale, it will return a last-resort object | 86 * data for the default locale, it will return a last-resort object |
87 * based on hard-coded strings. | 87 * based on hard-coded strings. |
88 * | 88 * |
89 * @param status Status code. Failure | 89 * @param status Status code. Failure |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 }; | 276 }; |
277 | 277 |
278 /** | 278 /** |
279 * Selector for date formatting width | 279 * Selector for date formatting width |
280 * @stable ICU 3.6 | 280 * @stable ICU 3.6 |
281 */ | 281 */ |
282 enum DtWidthType { | 282 enum DtWidthType { |
283 ABBREVIATED, | 283 ABBREVIATED, |
284 WIDE, | 284 WIDE, |
285 NARROW, | 285 NARROW, |
286 #ifndef U_HIDE_DRAFT_API | |
287 /** | 286 /** |
288 * Short width is currently only supported for weekday names. | 287 * Short width is currently only supported for weekday names. |
289 * @draft ICU 51 | 288 * @stable ICU 51 |
290 */ | 289 */ |
291 SHORT, | 290 SHORT, |
292 #endif /* U_HIDE_DRAFT_API */ | |
293 /** | 291 /** |
294 */ | 292 */ |
295 DT_WIDTH_COUNT = 4 | 293 DT_WIDTH_COUNT = 4 |
296 }; | 294 }; |
297 | 295 |
298 /** | 296 /** |
299 * Gets month strings by width and context. For example: "January", "Februar
y", etc. | 297 * Gets month strings by width and context. For example: "January", "Februar
y", etc. |
300 * @param count Filled in with length of the array. | 298 * @param count Filled in with length of the array. |
301 * @param context The formatting context, either FORMAT or STANDALONE | 299 * @param context The formatting context, either FORMAT or STANDALONE |
302 * @param width The width of returned strings, either WIDE, ABBREVIATED, o
r NARROW. | 300 * @param width The width of returned strings, either WIDE, ABBREVIATED, o
r NARROW. |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 const UnicodeString* getAmPmStrings(int32_t& count) const; | 401 const UnicodeString* getAmPmStrings(int32_t& count) const; |
404 | 402 |
405 /** | 403 /** |
406 * Sets ampm strings. For example: "AM" and "PM". | 404 * Sets ampm strings. For example: "AM" and "PM". |
407 * @param ampms the new ampm strings. (not adopted; caller retains ow
nership) | 405 * @param ampms the new ampm strings. (not adopted; caller retains ow
nership) |
408 * @param count Filled in with length of the array. | 406 * @param count Filled in with length of the array. |
409 * @stable ICU 2.0 | 407 * @stable ICU 2.0 |
410 */ | 408 */ |
411 void setAmPmStrings(const UnicodeString* ampms, int32_t count); | 409 void setAmPmStrings(const UnicodeString* ampms, int32_t count); |
412 | 410 |
| 411 #ifndef U_HIDE_DRAFT_API |
| 412 /** |
| 413 * Gets cyclic year name strings if the calendar has them, by width and cont
ext. |
| 414 * For example: "jia-zi", "yi-chou", etc. |
| 415 * @param count Filled in with length of the array. |
| 416 * @param context The usage context: FORMAT, STANDALONE. |
| 417 * @param width The requested name width: WIDE, ABBREVIATED, NARROW. |
| 418 * @return The year name strings (DateFormatSymbols retains ownersh
ip), |
| 419 * or null if they are not available for this calendar. |
| 420 * @draft ICU 54 |
| 421 */ |
| 422 const UnicodeString* getYearNames(int32_t& count, |
| 423 DtContextType context, DtWidthType width) const; |
| 424 |
| 425 /** |
| 426 * Sets cyclic year name strings by width and context. For example: "jia-zi"
, "yi-chou", etc. |
| 427 * |
| 428 * @param yearNames The new cyclic year name strings (not adopted; caller re
tains ownership). |
| 429 * @param count The length of the array. |
| 430 * @param context The usage context: FORMAT, STANDALONE (currently only FO
RMAT is supported). |
| 431 * @param width The name width: WIDE, ABBREVIATED, NARROW (currently onl
y ABBREVIATED is supported). |
| 432 * @draft ICU 54 |
| 433 */ |
| 434 void setYearNames(const UnicodeString* yearNames, int32_t count, |
| 435 DtContextType context, DtWidthType width); |
| 436 |
| 437 /** |
| 438 * Gets calendar zodiac name strings if the calendar has them, by width and
context. |
| 439 * For example: "Rat", "Ox", "Tiger", etc. |
| 440 * @param count Filled in with length of the array. |
| 441 * @param context The usage context: FORMAT, STANDALONE. |
| 442 * @param width The requested name width: WIDE, ABBREVIATED, NARROW. |
| 443 * @return The zodiac name strings (DateFormatSymbols retains owner
ship), |
| 444 * or null if they are not available for this calendar. |
| 445 * @draft ICU 54 |
| 446 */ |
| 447 const UnicodeString* getZodiacNames(int32_t& count, |
| 448 DtContextType context, DtWidthType width) const; |
| 449 |
| 450 /** |
| 451 * Sets calendar zodiac name strings by width and context. For example: "Rat
", "Ox", "Tiger", etc. |
| 452 * |
| 453 * @param zodiacNames The new zodiac name strings (not adopted; caller retai
ns ownership). |
| 454 * @param count The length of the array. |
| 455 * @param context The usage context: FORMAT, STANDALONE (currently only FO
RMAT is supported). |
| 456 * @param width The name width: WIDE, ABBREVIATED, NARROW (currently onl
y ABBREVIATED is supported). |
| 457 * @draft ICU 54 |
| 458 */ |
| 459 void setZodiacNames(const UnicodeString* zodiacNames, int32_t count, |
| 460 DtContextType context, DtWidthType width); |
| 461 |
| 462 #endif /* U_HIDE_DRAFT_API */ |
| 463 |
413 #ifndef U_HIDE_INTERNAL_API | 464 #ifndef U_HIDE_INTERNAL_API |
414 /** | 465 /** |
415 * Somewhat temporary constants for leap month pattern types, adequate for s
upporting | 466 * Somewhat temporary constants for leap month pattern types, adequate for s
upporting |
416 * just leap month patterns as needed for Chinese lunar calendar. | 467 * just leap month patterns as needed for Chinese lunar calendar. |
417 * Eventually we will add full support for different month pattern types (ne
eded for | 468 * Eventually we will add full support for different month pattern types (ne
eded for |
418 * other calendars such as Hindu) at which point this approach will be repla
ced by a | 469 * other calendars such as Hindu) at which point this approach will be repla
ced by a |
419 * more complete approach. | 470 * more complete approach. |
420 * @internal | 471 * @internal |
421 */ | 472 */ |
422 enum EMonthPatternType | 473 enum EMonthPatternType |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 */ | 549 */ |
499 void setLocalPatternChars(const UnicodeString& newLocalPatternChars); | 550 void setLocalPatternChars(const UnicodeString& newLocalPatternChars); |
500 | 551 |
501 /** | 552 /** |
502 * Returns the locale for this object. Two flavors are available: | 553 * Returns the locale for this object. Two flavors are available: |
503 * valid and actual locale. | 554 * valid and actual locale. |
504 * @stable ICU 2.8 | 555 * @stable ICU 2.8 |
505 */ | 556 */ |
506 Locale getLocale(ULocDataLocaleType type, UErrorCode& status) const; | 557 Locale getLocale(ULocDataLocaleType type, UErrorCode& status) const; |
507 | 558 |
| 559 /* The following type and kCapContextUsageTypeCount cannot be #ifndef U_HIDE
_INTERNAL_API, |
| 560 they are needed for .h file declarations. */ |
508 /** | 561 /** |
509 * Constants for capitalization context usage types. | 562 * Constants for capitalization context usage types. |
510 * @internal | 563 * @internal |
511 */ | 564 */ |
512 enum ECapitalizationContextUsageType | 565 enum ECapitalizationContextUsageType |
513 { | 566 { |
514 kCapContextUsageOther, | 567 #ifndef U_HIDE_INTERNAL_API |
| 568 kCapContextUsageOther = 0, |
515 kCapContextUsageMonthFormat, /* except narrow */ | 569 kCapContextUsageMonthFormat, /* except narrow */ |
516 kCapContextUsageMonthStandalone, /* except narrow */ | 570 kCapContextUsageMonthStandalone, /* except narrow */ |
517 kCapContextUsageMonthNarrow, | 571 kCapContextUsageMonthNarrow, |
518 kCapContextUsageDayFormat, /* except narrow */ | 572 kCapContextUsageDayFormat, /* except narrow */ |
519 kCapContextUsageDayStandalone, /* except narrow */ | 573 kCapContextUsageDayStandalone, /* except narrow */ |
520 kCapContextUsageDayNarrow, | 574 kCapContextUsageDayNarrow, |
521 kCapContextUsageEraWide, | 575 kCapContextUsageEraWide, |
522 kCapContextUsageEraAbbrev, | 576 kCapContextUsageEraAbbrev, |
523 kCapContextUsageEraNarrow, | 577 kCapContextUsageEraNarrow, |
524 kCapContextUsageZoneLong, | 578 kCapContextUsageZoneLong, |
525 kCapContextUsageZoneShort, | 579 kCapContextUsageZoneShort, |
526 kCapContextUsageMetazoneLong, | 580 kCapContextUsageMetazoneLong, |
527 kCapContextUsageMetazoneShort, | 581 kCapContextUsageMetazoneShort, |
528 kCapContextUsageTypeCount | 582 #endif /* U_HIDE_INTERNAL_API */ |
| 583 kCapContextUsageTypeCount = 14 |
529 }; | 584 }; |
530 | 585 |
531 /** | 586 /** |
532 * ICU "poor man's RTTI", returns a UClassID for the actual class. | 587 * ICU "poor man's RTTI", returns a UClassID for the actual class. |
533 * | 588 * |
534 * @stable ICU 2.2 | 589 * @stable ICU 2.2 |
535 */ | 590 */ |
536 virtual UClassID getDynamicClassID() const; | 591 virtual UClassID getDynamicClassID() const; |
537 | 592 |
538 /** | 593 /** |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 UnicodeString *fStandaloneShortQuarters; | 734 UnicodeString *fStandaloneShortQuarters; |
680 int32_t fStandaloneShortQuartersCount; | 735 int32_t fStandaloneShortQuartersCount; |
681 | 736 |
682 /** | 737 /** |
683 * All leap month patterns, for example "{0}bis". | 738 * All leap month patterns, for example "{0}bis". |
684 */ | 739 */ |
685 UnicodeString *fLeapMonthPatterns; | 740 UnicodeString *fLeapMonthPatterns; |
686 int32_t fLeapMonthPatternsCount; | 741 int32_t fLeapMonthPatternsCount; |
687 | 742 |
688 /** | 743 /** |
689 * (Format) Short cyclic year names, for example: "jia-zi", "yi-chou", ... "
gui-hai" | 744 * Cyclic year names, for example: "jia-zi", "yi-chou", ... "gui-hai"; |
| 745 * currently we only have data for format/abbreviated. |
| 746 * For the others, just get from format/abbreviated, ignore set. |
690 */ | 747 */ |
691 UnicodeString* fShortYearNames; | 748 UnicodeString *fShortYearNames; |
692 int32_t fShortYearNamesCount; | 749 int32_t fShortYearNamesCount; |
693 | 750 |
694 /** | 751 /** |
| 752 * Cyclic zodiac names, for example "Rat", "Ox", "Tiger", etc.; |
| 753 * currently we only have data for format/abbreviated. |
| 754 * For the others, just get from format/abbreviated, ignore set. |
| 755 */ |
| 756 UnicodeString *fShortZodiacNames; |
| 757 int32_t fShortZodiacNamesCount; |
| 758 |
| 759 /** |
695 * Localized names of time zones in this locale. This is a | 760 * Localized names of time zones in this locale. This is a |
696 * two-dimensional array of strings of size n by m, | 761 * two-dimensional array of strings of size n by m, |
697 * where m is at least 5 and up to 7. Each of the n rows is an | 762 * where m is at least 5 and up to 7. Each of the n rows is an |
698 * entry containing the localized names for a single TimeZone. | 763 * entry containing the localized names for a single TimeZone. |
699 * | 764 * |
700 * Each such row contains (with i ranging from 0..n-1): | 765 * Each such row contains (with i ranging from 0..n-1): |
701 * | 766 * |
702 * zoneStrings[i][0] - time zone ID | 767 * zoneStrings[i][0] - time zone ID |
703 * example: America/Los_Angeles | 768 * example: America/Los_Angeles |
704 * zoneStrings[i][1] - long name of zone in standard time | 769 * zoneStrings[i][1] - long name of zone in standard time |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
838 */ | 903 */ |
839 static UBool U_EXPORT2 isNumericPatternChar(UChar c, int32_t count); | 904 static UBool U_EXPORT2 isNumericPatternChar(UChar c, int32_t count); |
840 }; | 905 }; |
841 | 906 |
842 U_NAMESPACE_END | 907 U_NAMESPACE_END |
843 | 908 |
844 #endif /* #if !UCONFIG_NO_FORMATTING */ | 909 #endif /* #if !UCONFIG_NO_FORMATTING */ |
845 | 910 |
846 #endif // _DTFMTSYM | 911 #endif // _DTFMTSYM |
847 //eof | 912 //eof |
OLD | NEW |