Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(680)

Side by Side Diff: source/i18n/unicode/datefmt.h

Issue 1621843002: ICU 56 update step 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/icu.git@561
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « source/i18n/unicode/currpinf.h ('k') | source/i18n/unicode/dcfmtsym.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 ******************************************************************************* * 2 ******************************************************************************* *
3 * Copyright (C) 1997-2014, International Business Machines 3 * Copyright (C) 1997-2015, International Business Machines
4 * Corporation and others. All Rights Reserved. 4 * Corporation and others. All Rights Reserved.
5 ******************************************************************************* * 5 ******************************************************************************* *
6 * 6 *
7 * File DATEFMT.H 7 * File DATEFMT.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 * 04/01/97 aliu Added support for centuries. 13 * 04/01/97 aliu Added support for centuries.
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 * For example, SHORT for "h:mm a" in the US locale. Relati ve 564 * For example, SHORT for "h:mm a" in the US locale. Relati ve
565 * time styles are not currently supported. 565 * time styles are not currently supported.
566 * @param aLocale The given locale. 566 * @param aLocale The given locale.
567 * @return A date/time formatter which the caller owns. 567 * @return A date/time formatter which the caller owns.
568 * @stable ICU 2.0 568 * @stable ICU 2.0
569 */ 569 */
570 static DateFormat* U_EXPORT2 createDateTimeInstance(EStyle dateStyle = kDefa ult, 570 static DateFormat* U_EXPORT2 createDateTimeInstance(EStyle dateStyle = kDefa ult,
571 EStyle timeStyle = kDefault, 571 EStyle timeStyle = kDefault,
572 const Locale& aLocale = Locale::ge tDefault()); 572 const Locale& aLocale = Locale::ge tDefault());
573 573
574 #ifndef U_HIDE_INTERNAL_API
575 /**
576 * Returns the best pattern given a skeleton and locale.
577 * @param locale the locale
578 * @param skeleton the skeleton
579 * @param status ICU error returned here
580 * @return the best pattern.
581 * @internal For ICU use only.
582 */
583 static UnicodeString getBestPattern(
584 const Locale &locale,
585 const UnicodeString &skeleton,
586 UErrorCode &status);
587 #endif /* U_HIDE_INTERNAL_API */
588
589 #ifndef U_HIDE_DRAFT_API
590 /**
591 * Creates a date/time formatter for the given skeleton and
592 * default locale.
593 *
594 * @param skeleton The skeleton e.g "yMMMMd." Fields in the skeleton can
595 * be in any order, and this method uses the locale to
596 * map the skeleton to a pattern that includes locale
597 * specific separators with the fields in the appropriate
598 * order for that locale.
599 * @param status Any error returned here.
600 * @return A date/time formatter which the caller owns.
601 * @draft ICU 55
602 */
603 static DateFormat* U_EXPORT2 createInstanceForSkeleton(
604 const UnicodeString& skeleton,
605 UErrorCode &status);
606
607 /**
608 * Creates a date/time formatter for the given skeleton and locale.
609 *
610 * @param skeleton The skeleton e.g "yMMMMd." Fields in the skeleton can
611 * be in any order, and this method uses the locale to
612 * map the skeleton to a pattern that includes locale
613 * specific separators with the fields in the appropriate
614 * order for that locale.
615 * @param locale The given locale.
616 * @param status Any error returned here.
617 * @return A date/time formatter which the caller owns.
618 * @draft ICU 55
619 */
620 static DateFormat* U_EXPORT2 createInstanceForSkeleton(
621 const UnicodeString& skeleton,
622 const Locale &locale,
623 UErrorCode &status);
624
625 /**
626 * Creates a date/time formatter for the given skeleton and locale.
627 *
628 * @param calendarToAdopt the calendar returned DateFormat is to use.
629 * @param skeleton The skeleton e.g "yMMMMd." Fields in the skeleton can
630 * be in any order, and this method uses the locale to
631 * map the skeleton to a pattern that includes locale
632 * specific separators with the fields in the appropriate
633 * order for that locale.
634 * @param locale The given locale.
635 * @param status Any error returned here.
636 * @return A date/time formatter which the caller owns.
637 * @draft ICU 55
638 */
639 static DateFormat* U_EXPORT2 createInstanceForSkeleton(
640 Calendar *calendarToAdopt,
641 const UnicodeString& skeleton,
642 const Locale &locale,
643 UErrorCode &status);
644
645 #endif /* U_HIDE_DRAFT_API */
646
574 /** 647 /**
575 * Gets the set of locales for which DateFormats are installed. 648 * Gets the set of locales for which DateFormats are installed.
576 * @param count Filled in with the number of locales in the list that is ret urned. 649 * @param count Filled in with the number of locales in the list that is ret urned.
577 * @return the set of locales for which DateFormats are installed. The call er 650 * @return the set of locales for which DateFormats are installed. The call er
578 * does NOT own this list and must not delete it. 651 * does NOT own this list and must not delete it.
579 * @stable ICU 2.0 652 * @stable ICU 2.0
580 */ 653 */
581 static const Locale* U_EXPORT2 getAvailableLocales(int32_t& count); 654 static const Locale* U_EXPORT2 getAvailableLocales(int32_t& count);
582 655
583 /** 656 /**
(...skipping 19 matching lines...) Expand all
603 * newer attributes via setBooleanAttribute() may produce undesirable 676 * newer attributes via setBooleanAttribute() may produce undesirable
604 * results. 677 * results.
605 * 678 *
606 * @param lenient True specifies date/time interpretation to be lenient. 679 * @param lenient True specifies date/time interpretation to be lenient.
607 * @see Calendar::setLenient 680 * @see Calendar::setLenient
608 * @stable ICU 2.0 681 * @stable ICU 2.0
609 */ 682 */
610 virtual void setLenient(UBool lenient); 683 virtual void setLenient(UBool lenient);
611 684
612 685
613 /* Cannot use #ifndef U_HIDE_DRAFT_API for the following draft method since it is virtual */
614 /** 686 /**
615 * Returns whether date/time parsing in the encapsulated Calendar object pro cessing is lenient. 687 * Returns whether date/time parsing in the encapsulated Calendar object pro cessing is lenient.
616 * @draft ICU 53 688 * @stable ICU 53
617 */ 689 */
618 virtual UBool isCalendarLenient(void) const; 690 virtual UBool isCalendarLenient(void) const;
619 691
620 692
621 /* Cannot use #ifndef U_HIDE_DRAFT_API for the following draft method since it is virtual */
622 /** 693 /**
623 * Specifies whether encapsulated Calendar date/time parsing is to be lenien t. With 694 * Specifies whether encapsulated Calendar date/time parsing is to be lenien t. With
624 * lenient parsing, the parser may use heuristics to interpret inputs that 695 * lenient parsing, the parser may use heuristics to interpret inputs that
625 * do not precisely match this object's format. Without lenient parsing, 696 * do not precisely match this object's format. Without lenient parsing,
626 * inputs must match this object's format more closely. 697 * inputs must match this object's format more closely.
627 * @param lenient when true, parsing is lenient 698 * @param lenient when true, parsing is lenient
628 * @see com.ibm.icu.util.Calendar#setLenient 699 * @see com.ibm.icu.util.Calendar#setLenient
629 * @draft ICU 53 700 * @stable ICU 53
630 */ 701 */
631 virtual void setCalendarLenient(UBool lenient); 702 virtual void setCalendarLenient(UBool lenient);
632 703
633 704
634 /** 705 /**
635 * Gets the calendar associated with this date/time formatter. 706 * Gets the calendar associated with this date/time formatter.
636 * The calendar is owned by the formatter and must not be modified. 707 * The calendar is owned by the formatter and must not be modified.
637 * Also, the calendar does not reflect the results of a parse operation. 708 * Also, the calendar does not reflect the results of a parse operation.
638 * To parse to a calendar, use {@link #parse(const UnicodeString&, Calendar& cal, ParsePosition&) const parse(const UnicodeString&, Calendar& cal, ParsePosi tion&)} 709 * To parse to a calendar, use {@link #parse(const UnicodeString&, Calendar& cal, ParsePosition&) const parse(const UnicodeString&, Calendar& cal, ParsePosi tion&)}
639 * @return the calendar associated with this date/time formatter. 710 * @return the calendar associated with this date/time formatter.
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 */ 771 */
701 virtual void adoptTimeZone(TimeZone* zoneToAdopt); 772 virtual void adoptTimeZone(TimeZone* zoneToAdopt);
702 773
703 /** 774 /**
704 * Sets the time zone for the calendar of this DateFormat object. 775 * Sets the time zone for the calendar of this DateFormat object.
705 * @param zone the new time zone. 776 * @param zone the new time zone.
706 * @stable ICU 2.0 777 * @stable ICU 2.0
707 */ 778 */
708 virtual void setTimeZone(const TimeZone& zone); 779 virtual void setTimeZone(const TimeZone& zone);
709 780
710 /* Cannot use #ifndef U_HIDE_DRAFT_API for the following draft method since it is virtual */
711 /** 781 /**
712 * Set a particular UDisplayContext value in the formatter, such as 782 * Set a particular UDisplayContext value in the formatter, such as
713 * UDISPCTX_CAPITALIZATION_FOR_STANDALONE. 783 * UDISPCTX_CAPITALIZATION_FOR_STANDALONE.
714 * @param value The UDisplayContext value to set. 784 * @param value The UDisplayContext value to set.
715 * @param status Input/output status. If at entry this indicates a failure 785 * @param status Input/output status. If at entry this indicates a failure
716 * status, the function will do nothing; otherwise this will b e 786 * status, the function will do nothing; otherwise this will b e
717 * updated with any new status from the function. 787 * updated with any new status from the function.
718 * @draft ICU 53 788 * @stable ICU 53
719 */ 789 */
720 virtual void setContext(UDisplayContext value, UErrorCode& status); 790 virtual void setContext(UDisplayContext value, UErrorCode& status);
721 791
722 /* Cannot use #ifndef U_HIDE_DRAFT_API for the following draft method since it is virtual */
723 /** 792 /**
724 * Get the formatter's UDisplayContext value for the specified UDisplayConte xtType, 793 * Get the formatter's UDisplayContext value for the specified UDisplayConte xtType,
725 * such as UDISPCTX_TYPE_CAPITALIZATION. 794 * such as UDISPCTX_TYPE_CAPITALIZATION.
726 * @param type The UDisplayContextType whose value to return 795 * @param type The UDisplayContextType whose value to return
727 * @param status Input/output status. If at entry this indicates a failure 796 * @param status Input/output status. If at entry this indicates a failure
728 * status, the function will do nothing; otherwise this will b e 797 * status, the function will do nothing; otherwise this will b e
729 * updated with any new status from the function. 798 * updated with any new status from the function.
730 * @return The UDisplayContextValue for the specified type. 799 * @return The UDisplayContextValue for the specified type.
731 * @draft ICU 53 800 * @stable ICU 53
732 */ 801 */
733 virtual UDisplayContext getContext(UDisplayContextType type, UErrorCode& sta tus) const; 802 virtual UDisplayContext getContext(UDisplayContextType type, UErrorCode& sta tus) const;
734 803
735 /* Cannot use #ifndef U_HIDE_DRAFT_API for the following draft method since i t is virtual */
736 /** 804 /**
737 * Sets an boolean attribute on this DateFormat. 805 * Sets an boolean attribute on this DateFormat.
738 * May return U_UNSUPPORTED_ERROR if this instance does not support 806 * May return U_UNSUPPORTED_ERROR if this instance does not support
739 * the specified attribute. 807 * the specified attribute.
740 * @param attr the attribute to set 808 * @param attr the attribute to set
741 * @param newvalue new value 809 * @param newvalue new value
742 * @param status the error type 810 * @param status the error type
743 * @return *this - for chaining (example: format.setAttribute(...).setAttrib ute(...) ) 811 * @return *this - for chaining (example: format.setAttribute(...).setAttrib ute(...) )
744 * @draft ICU 53 812 * @stable ICU 53
745 */ 813 */
746 814
747 virtual DateFormat& U_EXPORT2 setBooleanAttribute(UDateFormatBooleanAttribu te attr, 815 virtual DateFormat& U_EXPORT2 setBooleanAttribute(UDateFormatBooleanAttribu te attr,
748 UBool ne wvalue, 816 UBool ne wvalue,
749 UErrorCo de &status); 817 UErrorCo de &status);
750 818
751 /* Cannot use #ifndef U_HIDE_DRAFT_API for the following draft method since it is virtual */
752 /** 819 /**
753 * Returns a boolean from this DateFormat 820 * Returns a boolean from this DateFormat
754 * May return U_UNSUPPORTED_ERROR if this instance does not support 821 * May return U_UNSUPPORTED_ERROR if this instance does not support
755 * the specified attribute. 822 * the specified attribute.
756 * @param attr the attribute to set 823 * @param attr the attribute to set
757 * @param status the error type 824 * @param status the error type
758 * @return the attribute value. Undefined if there is an error. 825 * @return the attribute value. Undefined if there is an error.
759 * @draft ICU 53 826 * @stable ICU 53
760 */ 827 */
761 virtual UBool U_EXPORT2 getBooleanAttribute(UDateFormatBooleanAttribute attr , UErrorCode &status) const; 828 virtual UBool U_EXPORT2 getBooleanAttribute(UDateFormatBooleanAttribute attr , UErrorCode &status) const;
762 829
763 protected: 830 protected:
764 /** 831 /**
765 * Default constructor. Creates a DateFormat with no Calendar or NumberForm at 832 * Default constructor. Creates a DateFormat with no Calendar or NumberForm at
766 * associated with it. This constructor depends on the subclasses to fill i n 833 * associated with it. This constructor depends on the subclasses to fill i n
767 * the calendar and numberFormat fields. 834 * the calendar and numberFormat fields.
768 * @stable ICU 2.0 835 * @stable ICU 2.0
769 */ 836 */
(...skipping 22 matching lines...) Expand all
792 /** 859 /**
793 * The number formatter that DateFormat uses to format numbers in dates and 860 * The number formatter that DateFormat uses to format numbers in dates and
794 * times. Subclasses should generally initialize this to the default number 861 * times. Subclasses should generally initialize this to the default number
795 * format for the locale associated with this DateFormat. 862 * format for the locale associated with this DateFormat.
796 * @stable ICU 2.4 863 * @stable ICU 2.4
797 */ 864 */
798 NumberFormat* fNumberFormat; 865 NumberFormat* fNumberFormat;
799 866
800 867
801 private: 868 private:
869
802 /** 870 /**
803 * Gets the date/time formatter with the given formatting styles for the 871 * Gets the date/time formatter with the given formatting styles for the
804 * given locale. 872 * given locale.
805 * @param dateStyle the given date formatting style. 873 * @param dateStyle the given date formatting style.
806 * @param timeStyle the given time formatting style. 874 * @param timeStyle the given time formatting style.
807 * @param inLocale the given locale. 875 * @param inLocale the given locale.
808 * @return a date/time formatter, or 0 on failure. 876 * @return a date/time formatter, or 0 on failure.
809 */ 877 */
810 static DateFormat* U_EXPORT2 create(EStyle timeStyle, EStyle dateStyle, cons t Locale& inLocale); 878 static DateFormat* U_EXPORT2 create(EStyle timeStyle, EStyle dateStyle, cons t Locale& inLocale);
811 879
812 880
813 /** 881 /**
814 * enum set of active boolean attributes for this instance 882 * enum set of active boolean attributes for this instance
815 */ 883 */
816 EnumSet<UDateFormatBooleanAttribute, 0, UDAT_BOOLEAN_ATTRIBUTE_COUNT> fBoolF lags; 884 EnumSet<UDateFormatBooleanAttribute, 0, UDAT_BOOLEAN_ATTRIBUTE_COUNT> fBoolF lags;
817 885
818 886
819 UDisplayContext fCapitalizationContext; 887 UDisplayContext fCapitalizationContext;
888 friend class DateFmtKeyByStyle;
820 889
821 public: 890 public:
822 #ifndef U_HIDE_OBSOLETE_API 891 #ifndef U_HIDE_OBSOLETE_API
823 /** 892 /**
824 * Field selector for FieldPosition for DateFormat fields. 893 * Field selector for FieldPosition for DateFormat fields.
825 * @obsolete ICU 3.4 use UDateFormatField instead, since this API will be 894 * @obsolete ICU 3.4 use UDateFormatField instead, since this API will be
826 * removed in that release 895 * removed in that release
827 */ 896 */
828 enum EField 897 enum EField
829 { 898 {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 }; 943 };
875 #endif /* U_HIDE_OBSOLETE_API */ 944 #endif /* U_HIDE_OBSOLETE_API */
876 }; 945 };
877 946
878 U_NAMESPACE_END 947 U_NAMESPACE_END
879 948
880 #endif /* #if !UCONFIG_NO_FORMATTING */ 949 #endif /* #if !UCONFIG_NO_FORMATTING */
881 950
882 #endif // _DATEFMT 951 #endif // _DATEFMT
883 //eof 952 //eof
OLDNEW
« no previous file with comments | « source/i18n/unicode/currpinf.h ('k') | source/i18n/unicode/dcfmtsym.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698