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

Side by Side Diff: source/i18n/rbnf.cpp

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/quantityformatter.cpp ('k') | source/i18n/rbt.cpp » ('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 Corporation 3 * Copyright (C) 1997-2015, International Business Machines Corporation
4 * and others. All Rights Reserved. 4 * and others. All Rights Reserved.
5 ******************************************************************************* 5 *******************************************************************************
6 */ 6 */
7 7
8 #include "unicode/utypes.h" 8 #include "unicode/utypes.h"
9 #include "utypeinfo.h" // for 'typeid' to work 9 #include "utypeinfo.h" // for 'typeid' to work
10 10
11 #include "unicode/rbnf.h" 11 #include "unicode/rbnf.h"
12 12
13 #if U_HAVE_RBNF 13 #if U_HAVE_RBNF
(...skipping 15 matching lines...) Expand all
29 29
30 #include "cmemory.h" 30 #include "cmemory.h"
31 #include "cstring.h" 31 #include "cstring.h"
32 #include "patternprops.h" 32 #include "patternprops.h"
33 #include "uresimp.h" 33 #include "uresimp.h"
34 34
35 // debugging 35 // debugging
36 // #define RBNF_DEBUG 36 // #define RBNF_DEBUG
37 37
38 #ifdef RBNF_DEBUG 38 #ifdef RBNF_DEBUG
39 #include "stdio.h" 39 #include <stdio.h>
40 #endif 40 #endif
41 41
42 #define U_ICUDATA_RBNF U_ICUDATA_NAME U_TREE_SEPARATOR_STRING "rbnf" 42 #define U_ICUDATA_RBNF U_ICUDATA_NAME U_TREE_SEPARATOR_STRING "rbnf"
43 43
44 static const UChar gPercentPercent[] = 44 static const UChar gPercentPercent[] =
45 { 45 {
46 0x25, 0x25, 0 46 0x25, 0x25, 0
47 }; /* "%%" */ 47 }; /* "%%" */
48 48
49 // All urbnf objects are created through openRules, so we init all of the 49 // All urbnf objects are created through openRules, so we init all of the
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description, 654 RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description,
655 const UnicodeString& locs, 655 const UnicodeString& locs,
656 const Locale& alocale, UParseError& perror, UErrorCode& status) 656 const Locale& alocale, UParseError& perror, UErrorCode& status)
657 : ruleSets(NULL) 657 : ruleSets(NULL)
658 , ruleSetDescriptions(NULL) 658 , ruleSetDescriptions(NULL)
659 , numRuleSets(0) 659 , numRuleSets(0)
660 , defaultRuleSet(NULL) 660 , defaultRuleSet(NULL)
661 , locale(alocale) 661 , locale(alocale)
662 , collator(NULL) 662 , collator(NULL)
663 , decimalFormatSymbols(NULL) 663 , decimalFormatSymbols(NULL)
664 , defaultInfinityRule(NULL)
665 , defaultNaNRule(NULL)
664 , lenient(FALSE) 666 , lenient(FALSE)
665 , lenientParseRules(NULL) 667 , lenientParseRules(NULL)
666 , localizations(NULL) 668 , localizations(NULL)
667 , capitalizationInfoSet(FALSE) 669 , capitalizationInfoSet(FALSE)
668 , capitalizationForUIListMenu(FALSE) 670 , capitalizationForUIListMenu(FALSE)
669 , capitalizationForStandAlone(FALSE) 671 , capitalizationForStandAlone(FALSE)
670 , capitalizationBrkIter(NULL) 672 , capitalizationBrkIter(NULL)
671 { 673 {
672 LocalizationInfo* locinfo = StringLocalizationInfo::create(locs, perror, statu s); 674 LocalizationInfo* locinfo = StringLocalizationInfo::create(locs, perror, statu s);
673 init(description, locinfo, perror, status); 675 init(description, locinfo, perror, status);
674 } 676 }
675 677
676 RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description, 678 RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description,
677 const UnicodeString& locs, 679 const UnicodeString& locs,
678 UParseError& perror, UErrorCode& st atus) 680 UParseError& perror, UErrorCode& st atus)
679 : ruleSets(NULL) 681 : ruleSets(NULL)
680 , ruleSetDescriptions(NULL) 682 , ruleSetDescriptions(NULL)
681 , numRuleSets(0) 683 , numRuleSets(0)
682 , defaultRuleSet(NULL) 684 , defaultRuleSet(NULL)
683 , locale(Locale::getDefault()) 685 , locale(Locale::getDefault())
684 , collator(NULL) 686 , collator(NULL)
685 , decimalFormatSymbols(NULL) 687 , decimalFormatSymbols(NULL)
688 , defaultInfinityRule(NULL)
689 , defaultNaNRule(NULL)
686 , lenient(FALSE) 690 , lenient(FALSE)
687 , lenientParseRules(NULL) 691 , lenientParseRules(NULL)
688 , localizations(NULL) 692 , localizations(NULL)
689 , capitalizationInfoSet(FALSE) 693 , capitalizationInfoSet(FALSE)
690 , capitalizationForUIListMenu(FALSE) 694 , capitalizationForUIListMenu(FALSE)
691 , capitalizationForStandAlone(FALSE) 695 , capitalizationForStandAlone(FALSE)
692 , capitalizationBrkIter(NULL) 696 , capitalizationBrkIter(NULL)
693 { 697 {
694 LocalizationInfo* locinfo = StringLocalizationInfo::create(locs, perror, statu s); 698 LocalizationInfo* locinfo = StringLocalizationInfo::create(locs, perror, statu s);
695 init(description, locinfo, perror, status); 699 init(description, locinfo, perror, status);
696 } 700 }
697 701
698 RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description, 702 RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description,
699 LocalizationInfo* info, 703 LocalizationInfo* info,
700 const Locale& alocale, UParseError& perror, UErrorCode& status) 704 const Locale& alocale, UParseError& perror, UErrorCode& status)
701 : ruleSets(NULL) 705 : ruleSets(NULL)
702 , ruleSetDescriptions(NULL) 706 , ruleSetDescriptions(NULL)
703 , numRuleSets(0) 707 , numRuleSets(0)
704 , defaultRuleSet(NULL) 708 , defaultRuleSet(NULL)
705 , locale(alocale) 709 , locale(alocale)
706 , collator(NULL) 710 , collator(NULL)
707 , decimalFormatSymbols(NULL) 711 , decimalFormatSymbols(NULL)
712 , defaultInfinityRule(NULL)
713 , defaultNaNRule(NULL)
708 , lenient(FALSE) 714 , lenient(FALSE)
709 , lenientParseRules(NULL) 715 , lenientParseRules(NULL)
710 , localizations(NULL) 716 , localizations(NULL)
711 , capitalizationInfoSet(FALSE) 717 , capitalizationInfoSet(FALSE)
712 , capitalizationForUIListMenu(FALSE) 718 , capitalizationForUIListMenu(FALSE)
713 , capitalizationForStandAlone(FALSE) 719 , capitalizationForStandAlone(FALSE)
714 , capitalizationBrkIter(NULL) 720 , capitalizationBrkIter(NULL)
715 { 721 {
716 init(description, info, perror, status); 722 init(description, info, perror, status);
717 } 723 }
718 724
719 RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description, 725 RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description,
720 UParseError& perror, 726 UParseError& perror,
721 UErrorCode& status) 727 UErrorCode& status)
722 : ruleSets(NULL) 728 : ruleSets(NULL)
723 , ruleSetDescriptions(NULL) 729 , ruleSetDescriptions(NULL)
724 , numRuleSets(0) 730 , numRuleSets(0)
725 , defaultRuleSet(NULL) 731 , defaultRuleSet(NULL)
726 , locale(Locale::getDefault()) 732 , locale(Locale::getDefault())
727 , collator(NULL) 733 , collator(NULL)
728 , decimalFormatSymbols(NULL) 734 , decimalFormatSymbols(NULL)
735 , defaultInfinityRule(NULL)
736 , defaultNaNRule(NULL)
729 , lenient(FALSE) 737 , lenient(FALSE)
730 , lenientParseRules(NULL) 738 , lenientParseRules(NULL)
731 , localizations(NULL) 739 , localizations(NULL)
732 , capitalizationInfoSet(FALSE) 740 , capitalizationInfoSet(FALSE)
733 , capitalizationForUIListMenu(FALSE) 741 , capitalizationForUIListMenu(FALSE)
734 , capitalizationForStandAlone(FALSE) 742 , capitalizationForStandAlone(FALSE)
735 , capitalizationBrkIter(NULL) 743 , capitalizationBrkIter(NULL)
736 { 744 {
737 init(description, NULL, perror, status); 745 init(description, NULL, perror, status);
738 } 746 }
739 747
740 RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description, 748 RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description,
741 const Locale& aLocale, 749 const Locale& aLocale,
742 UParseError& perror, 750 UParseError& perror,
743 UErrorCode& status) 751 UErrorCode& status)
744 : ruleSets(NULL) 752 : ruleSets(NULL)
745 , ruleSetDescriptions(NULL) 753 , ruleSetDescriptions(NULL)
746 , numRuleSets(0) 754 , numRuleSets(0)
747 , defaultRuleSet(NULL) 755 , defaultRuleSet(NULL)
748 , locale(aLocale) 756 , locale(aLocale)
749 , collator(NULL) 757 , collator(NULL)
750 , decimalFormatSymbols(NULL) 758 , decimalFormatSymbols(NULL)
759 , defaultInfinityRule(NULL)
760 , defaultNaNRule(NULL)
751 , lenient(FALSE) 761 , lenient(FALSE)
752 , lenientParseRules(NULL) 762 , lenientParseRules(NULL)
753 , localizations(NULL) 763 , localizations(NULL)
754 , capitalizationInfoSet(FALSE) 764 , capitalizationInfoSet(FALSE)
755 , capitalizationForUIListMenu(FALSE) 765 , capitalizationForUIListMenu(FALSE)
756 , capitalizationForStandAlone(FALSE) 766 , capitalizationForStandAlone(FALSE)
757 , capitalizationBrkIter(NULL) 767 , capitalizationBrkIter(NULL)
758 { 768 {
759 init(description, NULL, perror, status); 769 init(description, NULL, perror, status);
760 } 770 }
761 771
762 RuleBasedNumberFormat::RuleBasedNumberFormat(URBNFRuleSetTag tag, const Locale& alocale, UErrorCode& status) 772 RuleBasedNumberFormat::RuleBasedNumberFormat(URBNFRuleSetTag tag, const Locale& alocale, UErrorCode& status)
763 : ruleSets(NULL) 773 : ruleSets(NULL)
764 , ruleSetDescriptions(NULL) 774 , ruleSetDescriptions(NULL)
765 , numRuleSets(0) 775 , numRuleSets(0)
766 , defaultRuleSet(NULL) 776 , defaultRuleSet(NULL)
767 , locale(alocale) 777 , locale(alocale)
768 , collator(NULL) 778 , collator(NULL)
769 , decimalFormatSymbols(NULL) 779 , decimalFormatSymbols(NULL)
780 , defaultInfinityRule(NULL)
781 , defaultNaNRule(NULL)
770 , lenient(FALSE) 782 , lenient(FALSE)
771 , lenientParseRules(NULL) 783 , lenientParseRules(NULL)
772 , localizations(NULL) 784 , localizations(NULL)
773 , capitalizationInfoSet(FALSE) 785 , capitalizationInfoSet(FALSE)
774 , capitalizationForUIListMenu(FALSE) 786 , capitalizationForUIListMenu(FALSE)
775 , capitalizationForStandAlone(FALSE) 787 , capitalizationForStandAlone(FALSE)
776 , capitalizationBrkIter(NULL) 788 , capitalizationBrkIter(NULL)
777 { 789 {
778 if (U_FAILURE(status)) { 790 if (U_FAILURE(status)) {
779 return; 791 return;
(...skipping 27 matching lines...) Expand all
807 ures_close(nfrb); 819 ures_close(nfrb);
808 return; 820 return;
809 } 821 }
810 822
811 UnicodeString desc; 823 UnicodeString desc;
812 while (ures_hasNext(ruleSets)) { 824 while (ures_hasNext(ruleSets)) {
813 desc.append(ures_getNextUnicodeString(ruleSets,NULL,&status)); 825 desc.append(ures_getNextUnicodeString(ruleSets,NULL,&status));
814 } 826 }
815 UParseError perror; 827 UParseError perror;
816 828
817 init (desc, locinfo, perror, status); 829 init(desc, locinfo, perror, status);
818 830
819 ures_close(ruleSets); 831 ures_close(ruleSets);
820 ures_close(rbnfRules); 832 ures_close(rbnfRules);
821 } 833 }
822 ures_close(nfrb); 834 ures_close(nfrb);
823 } 835 }
824 836
825 RuleBasedNumberFormat::RuleBasedNumberFormat(const RuleBasedNumberFormat& rhs) 837 RuleBasedNumberFormat::RuleBasedNumberFormat(const RuleBasedNumberFormat& rhs)
826 : NumberFormat(rhs) 838 : NumberFormat(rhs)
827 , ruleSets(NULL) 839 , ruleSets(NULL)
828 , ruleSetDescriptions(NULL) 840 , ruleSetDescriptions(NULL)
829 , numRuleSets(0) 841 , numRuleSets(0)
830 , defaultRuleSet(NULL) 842 , defaultRuleSet(NULL)
831 , locale(rhs.locale) 843 , locale(rhs.locale)
832 , collator(NULL) 844 , collator(NULL)
833 , decimalFormatSymbols(NULL) 845 , decimalFormatSymbols(NULL)
846 , defaultInfinityRule(NULL)
847 , defaultNaNRule(NULL)
834 , lenient(FALSE) 848 , lenient(FALSE)
835 , lenientParseRules(NULL) 849 , lenientParseRules(NULL)
836 , localizations(NULL) 850 , localizations(NULL)
837 , capitalizationInfoSet(FALSE) 851 , capitalizationInfoSet(FALSE)
838 , capitalizationForUIListMenu(FALSE) 852 , capitalizationForUIListMenu(FALSE)
839 , capitalizationForStandAlone(FALSE) 853 , capitalizationForStandAlone(FALSE)
840 , capitalizationBrkIter(NULL) 854 , capitalizationBrkIter(NULL)
841 { 855 {
842 this->operator=(rhs); 856 this->operator=(rhs);
843 } 857 }
844 858
845 // -------- 859 // --------
846 860
847 RuleBasedNumberFormat& 861 RuleBasedNumberFormat&
848 RuleBasedNumberFormat::operator=(const RuleBasedNumberFormat& rhs) 862 RuleBasedNumberFormat::operator=(const RuleBasedNumberFormat& rhs)
849 { 863 {
850 if (this == &rhs) { 864 if (this == &rhs) {
851 return *this; 865 return *this;
852 } 866 }
853 NumberFormat::operator=(rhs); 867 NumberFormat::operator=(rhs);
854 UErrorCode status = U_ZERO_ERROR; 868 UErrorCode status = U_ZERO_ERROR;
855 dispose(); 869 dispose();
856 locale = rhs.locale; 870 locale = rhs.locale;
857 lenient = rhs.lenient; 871 lenient = rhs.lenient;
858 872
859 UParseError perror; 873 UParseError perror;
874 setDecimalFormatSymbols(*rhs.getDecimalFormatSymbols());
860 init(rhs.originalDescription, rhs.localizations ? rhs.localizations->ref() : NULL, perror, status); 875 init(rhs.originalDescription, rhs.localizations ? rhs.localizations->ref() : NULL, perror, status);
861 setDecimalFormatSymbols(*rhs.getDecimalFormatSymbols());
862 setDefaultRuleSet(rhs.getDefaultRuleSetName(), status); 876 setDefaultRuleSet(rhs.getDefaultRuleSetName(), status);
863 877
864 capitalizationInfoSet = rhs.capitalizationInfoSet; 878 capitalizationInfoSet = rhs.capitalizationInfoSet;
865 capitalizationForUIListMenu = rhs.capitalizationForUIListMenu; 879 capitalizationForUIListMenu = rhs.capitalizationForUIListMenu;
866 capitalizationForStandAlone = rhs.capitalizationForStandAlone; 880 capitalizationForStandAlone = rhs.capitalizationForStandAlone;
867 #if !UCONFIG_NO_BREAK_ITERATION 881 #if !UCONFIG_NO_BREAK_ITERATION
868 capitalizationBrkIter = (rhs.capitalizationBrkIter!=NULL)? rhs.capitalizatio nBrkIter->clone(): NULL; 882 capitalizationBrkIter = (rhs.capitalizationBrkIter!=NULL)? rhs.capitalizatio nBrkIter->clone(): NULL;
869 #endif 883 #endif
870 884
871 return *this; 885 return *this;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
929 (*p)->appendRules(result); 943 (*p)->appendRules(result);
930 } 944 }
931 } 945 }
932 return result; 946 return result;
933 } 947 }
934 948
935 UnicodeString 949 UnicodeString
936 RuleBasedNumberFormat::getRuleSetName(int32_t index) const 950 RuleBasedNumberFormat::getRuleSetName(int32_t index) const
937 { 951 {
938 if (localizations) { 952 if (localizations) {
939 UnicodeString string(TRUE, localizations->getRuleSetName(index), (int32_t) -1); 953 UnicodeString string(TRUE, localizations->getRuleSetName(index), (int32_ t)-1);
940 return string; 954 return string;
941 } else if (ruleSets) { 955 }
956 else if (ruleSets) {
942 UnicodeString result; 957 UnicodeString result;
943 for (NFRuleSet** p = ruleSets; *p; ++p) { 958 for (NFRuleSet** p = ruleSets; *p; ++p) {
944 NFRuleSet* rs = *p; 959 NFRuleSet* rs = *p;
945 if (rs->isPublic()) { 960 if (rs->isPublic()) {
946 if (--index == -1) { 961 if (--index == -1) {
947 rs->getName(result); 962 rs->getName(result);
948 return result; 963 return result;
949 } 964 }
950 } 965 }
951 } 966 }
952 } 967 }
953 UnicodeString empty; 968 UnicodeString empty;
954 return empty; 969 return empty;
955 } 970 }
956 971
957 int32_t 972 int32_t
958 RuleBasedNumberFormat::getNumberOfRuleSetNames() const 973 RuleBasedNumberFormat::getNumberOfRuleSetNames() const
959 { 974 {
960 int32_t result = 0; 975 int32_t result = 0;
961 if (localizations) { 976 if (localizations) {
962 result = localizations->getNumberOfRuleSets(); 977 result = localizations->getNumberOfRuleSets();
963 } else if (ruleSets) { 978 }
979 else if (ruleSets) {
964 for (NFRuleSet** p = ruleSets; *p; ++p) { 980 for (NFRuleSet** p = ruleSets; *p; ++p) {
965 if ((**p).isPublic()) { 981 if ((**p).isPublic()) {
966 ++result; 982 ++result;
967 } 983 }
968 } 984 }
969 } 985 }
970 return result; 986 return result;
971 } 987 }
972 988
973 int32_t 989 int32_t
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
1061 } 1077 }
1062 1078
1063 UnicodeString& 1079 UnicodeString&
1064 RuleBasedNumberFormat::format(int32_t number, 1080 RuleBasedNumberFormat::format(int32_t number,
1065 UnicodeString& toAppendTo, 1081 UnicodeString& toAppendTo,
1066 FieldPosition& /* pos */) const 1082 FieldPosition& /* pos */) const
1067 { 1083 {
1068 if (defaultRuleSet) { 1084 if (defaultRuleSet) {
1069 UErrorCode status = U_ZERO_ERROR; 1085 UErrorCode status = U_ZERO_ERROR;
1070 int32_t startPos = toAppendTo.length(); 1086 int32_t startPos = toAppendTo.length();
1071 defaultRuleSet->format((int64_t)number, toAppendTo, toAppendTo.length(), status); 1087 defaultRuleSet->format((int64_t)number, toAppendTo, toAppendTo.length(), 0, status);
1072 adjustForCapitalizationContext(startPos, toAppendTo); 1088 adjustForCapitalizationContext(startPos, toAppendTo);
1073 } 1089 }
1074 return toAppendTo; 1090 return toAppendTo;
1075 } 1091 }
1076 1092
1077 1093
1078 UnicodeString& 1094 UnicodeString&
1079 RuleBasedNumberFormat::format(int64_t number, 1095 RuleBasedNumberFormat::format(int64_t number,
1080 UnicodeString& toAppendTo, 1096 UnicodeString& toAppendTo,
1081 FieldPosition& /* pos */) const 1097 FieldPosition& /* pos */) const
1082 { 1098 {
1083 if (defaultRuleSet) { 1099 if (defaultRuleSet) {
1084 UErrorCode status = U_ZERO_ERROR; 1100 UErrorCode status = U_ZERO_ERROR;
1085 int32_t startPos = toAppendTo.length(); 1101 int32_t startPos = toAppendTo.length();
1086 defaultRuleSet->format(number, toAppendTo, toAppendTo.length(), status); 1102 defaultRuleSet->format(number, toAppendTo, toAppendTo.length(), 0, statu s);
1087 adjustForCapitalizationContext(startPos, toAppendTo); 1103 adjustForCapitalizationContext(startPos, toAppendTo);
1088 } 1104 }
1089 return toAppendTo; 1105 return toAppendTo;
1090 } 1106 }
1091 1107
1092 1108
1093 UnicodeString& 1109 UnicodeString&
1094 RuleBasedNumberFormat::format(double number, 1110 RuleBasedNumberFormat::format(double number,
1095 UnicodeString& toAppendTo, 1111 UnicodeString& toAppendTo,
1096 FieldPosition& /* pos */) const 1112 FieldPosition& /* pos */) const
1097 { 1113 {
1098 int32_t startPos = toAppendTo.length(); 1114 int32_t startPos = toAppendTo.length();
1099 // Special case for NaN; adapted from what DecimalFormat::_format( double nu mber,...) does. 1115 if (defaultRuleSet) {
1100 if (uprv_isNaN(number)) {
1101 DecimalFormatSymbols* decFmtSyms = getDecimalFormatSymbols(); // RuleBas edNumberFormat internal
1102 if (decFmtSyms) {
1103 toAppendTo += decFmtSyms->getConstSymbol(DecimalFormatSymbols::kNaNS ymbol);
1104 }
1105 } else if (defaultRuleSet) {
1106 UErrorCode status = U_ZERO_ERROR; 1116 UErrorCode status = U_ZERO_ERROR;
1107 defaultRuleSet->format(number, toAppendTo, toAppendTo.length(), status); 1117 defaultRuleSet->format(number, toAppendTo, toAppendTo.length(), 0, statu s);
1108 } 1118 }
1109 return adjustForCapitalizationContext(startPos, toAppendTo); 1119 return adjustForCapitalizationContext(startPos, toAppendTo);
1110 } 1120 }
1111 1121
1112 1122
1113 UnicodeString& 1123 UnicodeString&
1114 RuleBasedNumberFormat::format(int32_t number, 1124 RuleBasedNumberFormat::format(int32_t number,
1115 const UnicodeString& ruleSetName, 1125 const UnicodeString& ruleSetName,
1116 UnicodeString& toAppendTo, 1126 UnicodeString& toAppendTo,
1117 FieldPosition& /* pos */, 1127 FieldPosition& /* pos */,
1118 UErrorCode& status) const 1128 UErrorCode& status) const
1119 { 1129 {
1120 // return format((int64_t)number, ruleSetName, toAppendTo, pos, status); 1130 // return format((int64_t)number, ruleSetName, toAppendTo, pos, status);
1121 if (U_SUCCESS(status)) { 1131 if (U_SUCCESS(status)) {
1122 if (ruleSetName.indexOf(gPercentPercent, 2, 0) == 0) { 1132 if (ruleSetName.indexOf(gPercentPercent, 2, 0) == 0) {
1123 // throw new IllegalArgumentException("Can't use internal rule set") ; 1133 // throw new IllegalArgumentException("Can't use internal rule set") ;
1124 status = U_ILLEGAL_ARGUMENT_ERROR; 1134 status = U_ILLEGAL_ARGUMENT_ERROR;
1125 } else { 1135 } else {
1126 NFRuleSet *rs = findRuleSet(ruleSetName, status); 1136 NFRuleSet *rs = findRuleSet(ruleSetName, status);
1127 if (rs) { 1137 if (rs) {
1128 int32_t startPos = toAppendTo.length(); 1138 int32_t startPos = toAppendTo.length();
1129 rs->format((int64_t)number, toAppendTo, toAppendTo.length(), sta tus); 1139 rs->format((int64_t)number, toAppendTo, toAppendTo.length(), 0, status);
1130 adjustForCapitalizationContext(startPos, toAppendTo); 1140 adjustForCapitalizationContext(startPos, toAppendTo);
1131 } 1141 }
1132 } 1142 }
1133 } 1143 }
1134 return toAppendTo; 1144 return toAppendTo;
1135 } 1145 }
1136 1146
1137 1147
1138 UnicodeString& 1148 UnicodeString&
1139 RuleBasedNumberFormat::format(int64_t number, 1149 RuleBasedNumberFormat::format(int64_t number,
1140 const UnicodeString& ruleSetName, 1150 const UnicodeString& ruleSetName,
1141 UnicodeString& toAppendTo, 1151 UnicodeString& toAppendTo,
1142 FieldPosition& /* pos */, 1152 FieldPosition& /* pos */,
1143 UErrorCode& status) const 1153 UErrorCode& status) const
1144 { 1154 {
1145 if (U_SUCCESS(status)) { 1155 if (U_SUCCESS(status)) {
1146 if (ruleSetName.indexOf(gPercentPercent, 2, 0) == 0) { 1156 if (ruleSetName.indexOf(gPercentPercent, 2, 0) == 0) {
1147 // throw new IllegalArgumentException("Can't use internal rule set") ; 1157 // throw new IllegalArgumentException("Can't use internal rule set") ;
1148 status = U_ILLEGAL_ARGUMENT_ERROR; 1158 status = U_ILLEGAL_ARGUMENT_ERROR;
1149 } else { 1159 } else {
1150 NFRuleSet *rs = findRuleSet(ruleSetName, status); 1160 NFRuleSet *rs = findRuleSet(ruleSetName, status);
1151 if (rs) { 1161 if (rs) {
1152 int32_t startPos = toAppendTo.length(); 1162 int32_t startPos = toAppendTo.length();
1153 rs->format(number, toAppendTo, toAppendTo.length(), status); 1163 rs->format(number, toAppendTo, toAppendTo.length(), 0, status);
1154 adjustForCapitalizationContext(startPos, toAppendTo); 1164 adjustForCapitalizationContext(startPos, toAppendTo);
1155 } 1165 }
1156 } 1166 }
1157 } 1167 }
1158 return toAppendTo; 1168 return toAppendTo;
1159 } 1169 }
1160 1170
1161 1171
1162 UnicodeString& 1172 UnicodeString&
1163 RuleBasedNumberFormat::format(double number, 1173 RuleBasedNumberFormat::format(double number,
1164 const UnicodeString& ruleSetName, 1174 const UnicodeString& ruleSetName,
1165 UnicodeString& toAppendTo, 1175 UnicodeString& toAppendTo,
1166 FieldPosition& /* pos */, 1176 FieldPosition& /* pos */,
1167 UErrorCode& status) const 1177 UErrorCode& status) const
1168 { 1178 {
1169 if (U_SUCCESS(status)) { 1179 if (U_SUCCESS(status)) {
1170 if (ruleSetName.indexOf(gPercentPercent, 2, 0) == 0) { 1180 if (ruleSetName.indexOf(gPercentPercent, 2, 0) == 0) {
1171 // throw new IllegalArgumentException("Can't use internal rule set") ; 1181 // throw new IllegalArgumentException("Can't use internal rule set") ;
1172 status = U_ILLEGAL_ARGUMENT_ERROR; 1182 status = U_ILLEGAL_ARGUMENT_ERROR;
1173 } else { 1183 } else {
1174 NFRuleSet *rs = findRuleSet(ruleSetName, status); 1184 NFRuleSet *rs = findRuleSet(ruleSetName, status);
1175 if (rs) { 1185 if (rs) {
1176 int32_t startPos = toAppendTo.length(); 1186 int32_t startPos = toAppendTo.length();
1177 rs->format(number, toAppendTo, toAppendTo.length(), status); 1187 rs->format(number, toAppendTo, toAppendTo.length(), 0, status);
1178 adjustForCapitalizationContext(startPos, toAppendTo); 1188 adjustForCapitalizationContext(startPos, toAppendTo);
1179 } 1189 }
1180 } 1190 }
1181 } 1191 }
1182 return toAppendTo; 1192 return toAppendTo;
1183 } 1193 }
1184 1194
1185 UnicodeString& 1195 UnicodeString&
1186 RuleBasedNumberFormat::adjustForCapitalizationContext(int32_t startPos, 1196 RuleBasedNumberFormat::adjustForCapitalizationContext(int32_t startPos,
1187 UnicodeString& currentResu lt) const 1197 UnicodeString& currentResu lt) const
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
1287 NFRuleSet* result = findRuleSet(ruleSetName, status); 1297 NFRuleSet* result = findRuleSet(ruleSetName, status);
1288 if (result != NULL) { 1298 if (result != NULL) {
1289 defaultRuleSet = result; 1299 defaultRuleSet = result;
1290 } 1300 }
1291 } 1301 }
1292 } 1302 }
1293 } 1303 }
1294 1304
1295 UnicodeString 1305 UnicodeString
1296 RuleBasedNumberFormat::getDefaultRuleSetName() const { 1306 RuleBasedNumberFormat::getDefaultRuleSetName() const {
1297 UnicodeString result; 1307 UnicodeString result;
1298 if (defaultRuleSet && defaultRuleSet->isPublic()) { 1308 if (defaultRuleSet && defaultRuleSet->isPublic()) {
1299 defaultRuleSet->getName(result); 1309 defaultRuleSet->getName(result);
1300 } else { 1310 } else {
1301 result.setToBogus(); 1311 result.setToBogus();
1302 } 1312 }
1303 return result; 1313 return result;
1304 } 1314 }
1305 1315
1306 void 1316 void
1307 RuleBasedNumberFormat::initDefaultRuleSet() 1317 RuleBasedNumberFormat::initDefaultRuleSet()
1308 { 1318 {
1309 defaultRuleSet = NULL; 1319 defaultRuleSet = NULL;
1310 if (!ruleSets) { 1320 if (!ruleSets) {
1311 return; 1321 return;
1312 } 1322 }
1313 1323
1314 const UnicodeString spellout = UNICODE_STRING_SIMPLE("%spellout-numbering"); 1324 const UnicodeString spellout(UNICODE_STRING_SIMPLE("%spellout-numbering"));
1315 const UnicodeString ordinal = UNICODE_STRING_SIMPLE("%digits-ordinal"); 1325 const UnicodeString ordinal(UNICODE_STRING_SIMPLE("%digits-ordinal"));
1316 const UnicodeString duration = UNICODE_STRING_SIMPLE("%duration"); 1326 const UnicodeString duration(UNICODE_STRING_SIMPLE("%duration"));
1317 1327
1318 NFRuleSet**p = &ruleSets[0]; 1328 NFRuleSet**p = &ruleSets[0];
1319 while (*p) { 1329 while (*p) {
1320 if ((*p)->isNamed(spellout) || (*p)->isNamed(ordinal) || (*p)->isNamed(d uration)) { 1330 if ((*p)->isNamed(spellout) || (*p)->isNamed(ordinal) || (*p)->isNamed(d uration)) {
1321 defaultRuleSet = *p; 1331 defaultRuleSet = *p;
1322 return; 1332 return;
1323 } else { 1333 } else {
1324 ++p; 1334 ++p;
1325 } 1335 }
1326 } 1336 }
(...skipping 14 matching lines...) Expand all
1341 RuleBasedNumberFormat::init(const UnicodeString& rules, LocalizationInfo* locali zationInfos, 1351 RuleBasedNumberFormat::init(const UnicodeString& rules, LocalizationInfo* locali zationInfos,
1342 UParseError& pErr, UErrorCode& status) 1352 UParseError& pErr, UErrorCode& status)
1343 { 1353 {
1344 // TODO: implement UParseError 1354 // TODO: implement UParseError
1345 uprv_memset(&pErr, 0, sizeof(UParseError)); 1355 uprv_memset(&pErr, 0, sizeof(UParseError));
1346 // Note: this can leave ruleSets == NULL, so remaining code should check 1356 // Note: this can leave ruleSets == NULL, so remaining code should check
1347 if (U_FAILURE(status)) { 1357 if (U_FAILURE(status)) {
1348 return; 1358 return;
1349 } 1359 }
1350 1360
1361 initializeDecimalFormatSymbols(status);
1362 initializeDefaultInfinityRule(status);
1363 initializeDefaultNaNRule(status);
1364 if (U_FAILURE(status)) {
1365 return;
1366 }
1367
1351 this->localizations = localizationInfos == NULL ? NULL : localizationInfos-> ref(); 1368 this->localizations = localizationInfos == NULL ? NULL : localizationInfos-> ref();
1352 1369
1353 UnicodeString description(rules); 1370 UnicodeString description(rules);
1354 if (!description.length()) { 1371 if (!description.length()) {
1355 status = U_MEMORY_ALLOCATION_ERROR; 1372 status = U_MEMORY_ALLOCATION_ERROR;
1356 return; 1373 return;
1357 } 1374 }
1358 1375
1359 // start by stripping the trailing whitespace from all the rules 1376 // start by stripping the trailing whitespace from all the rules
1360 // (this is all the whitespace follwing each semicolon in the 1377 // (this is all the whitespace follwing each semicolon in the
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
1438 if (ruleSetDescriptions == 0) { 1455 if (ruleSetDescriptions == 0) {
1439 status = U_MEMORY_ALLOCATION_ERROR; 1456 status = U_MEMORY_ALLOCATION_ERROR;
1440 return; 1457 return;
1441 } 1458 }
1442 1459
1443 { 1460 {
1444 int curRuleSet = 0; 1461 int curRuleSet = 0;
1445 int32_t start = 0; 1462 int32_t start = 0;
1446 for (int32_t p = description.indexOf(gSemiPercent, 2, 0); p != -1; p = d escription.indexOf(gSemiPercent, 2, start)) { 1463 for (int32_t p = description.indexOf(gSemiPercent, 2, 0); p != -1; p = d escription.indexOf(gSemiPercent, 2, start)) {
1447 ruleSetDescriptions[curRuleSet].setTo(description, start, p + 1 - st art); 1464 ruleSetDescriptions[curRuleSet].setTo(description, start, p + 1 - st art);
1448 ruleSets[curRuleSet] = new NFRuleSet(ruleSetDescriptions, curRuleSet , status); 1465 ruleSets[curRuleSet] = new NFRuleSet(this, ruleSetDescriptions, curR uleSet, status);
1449 if (ruleSets[curRuleSet] == 0) { 1466 if (ruleSets[curRuleSet] == 0) {
1450 status = U_MEMORY_ALLOCATION_ERROR; 1467 status = U_MEMORY_ALLOCATION_ERROR;
1451 return; 1468 return;
1452 } 1469 }
1453 ++curRuleSet; 1470 ++curRuleSet;
1454 start = p + 1; 1471 start = p + 1;
1455 } 1472 }
1456 ruleSetDescriptions[curRuleSet].setTo(description, start, description.le ngth() - start); 1473 ruleSetDescriptions[curRuleSet].setTo(description, start, description.le ngth() - start);
1457 ruleSets[curRuleSet] = new NFRuleSet(ruleSetDescriptions, curRuleSet, st atus); 1474 ruleSets[curRuleSet] = new NFRuleSet(this, ruleSetDescriptions, curRuleS et, status);
1458 if (ruleSets[curRuleSet] == 0) { 1475 if (ruleSets[curRuleSet] == 0) {
1459 status = U_MEMORY_ALLOCATION_ERROR; 1476 status = U_MEMORY_ALLOCATION_ERROR;
1460 return; 1477 return;
1461 } 1478 }
1462 } 1479 }
1463 1480
1464 // now we can take note of the formatter's default rule set, which 1481 // now we can take note of the formatter's default rule set, which
1465 // is the last public rule set in the description (it's the last 1482 // is the last public rule set in the description (it's the last
1466 // rather than the first so that a user can create a new formatter 1483 // rather than the first so that a user can create a new formatter
1467 // from an existing formatter and change its default behavior just 1484 // from an existing formatter and change its default behavior just
1468 // by appending more rule sets to the end) 1485 // by appending more rule sets to the end)
1469 1486
1470 // {dlf} Initialization of a fraction rule set requires the default rule 1487 // {dlf} Initialization of a fraction rule set requires the default rule
1471 // set to be known. For purposes of initialization, this is always the 1488 // set to be known. For purposes of initialization, this is always the
1472 // last public rule set, no matter what the localization data says. 1489 // last public rule set, no matter what the localization data says.
1473 initDefaultRuleSet(); 1490 initDefaultRuleSet();
1474 1491
1475 // finally, we can go back through the temporary descriptions 1492 // finally, we can go back through the temporary descriptions
1476 // list and finish seting up the substructure (and we throw 1493 // list and finish seting up the substructure (and we throw
1477 // away the temporary descriptions as we go) 1494 // away the temporary descriptions as we go)
1478 { 1495 {
1479 for (int i = 0; i < numRuleSets; i++) { 1496 for (int i = 0; i < numRuleSets; i++) {
1480 ruleSets[i]->parseRules(ruleSetDescriptions[i], this, status); 1497 ruleSets[i]->parseRules(ruleSetDescriptions[i], status);
1481 } 1498 }
1482 } 1499 }
1483 1500
1484 // Now that the rules are initialized, the 'real' default rule 1501 // Now that the rules are initialized, the 'real' default rule
1485 // set can be adjusted by the localization data. 1502 // set can be adjusted by the localization data.
1486 1503
1487 // The C code keeps the localization array as is, rather than building 1504 // The C code keeps the localization array as is, rather than building
1488 // a separate array of the public rule set names, so we have less work 1505 // a separate array of the public rule set names, so we have less work
1489 // to do here-- but we still need to check the names. 1506 // to do here-- but we still need to check the names.
1490 1507
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
1602 if (ruleSets) { 1619 if (ruleSets) {
1603 for (NFRuleSet** p = ruleSets; *p; ++p) { 1620 for (NFRuleSet** p = ruleSets; *p; ++p) {
1604 delete *p; 1621 delete *p;
1605 } 1622 }
1606 uprv_free(ruleSets); 1623 uprv_free(ruleSets);
1607 ruleSets = NULL; 1624 ruleSets = NULL;
1608 } 1625 }
1609 1626
1610 if (ruleSetDescriptions) { 1627 if (ruleSetDescriptions) {
1611 delete [] ruleSetDescriptions; 1628 delete [] ruleSetDescriptions;
1629 ruleSetDescriptions = NULL;
1612 } 1630 }
1613 1631
1614 #if !UCONFIG_NO_COLLATION 1632 #if !UCONFIG_NO_COLLATION
1615 delete collator; 1633 delete collator;
1616 #endif 1634 #endif
1617 collator = NULL; 1635 collator = NULL;
1618 1636
1619 delete decimalFormatSymbols; 1637 delete decimalFormatSymbols;
1620 decimalFormatSymbols = NULL; 1638 decimalFormatSymbols = NULL;
1621 1639
1640 delete defaultInfinityRule;
1641 defaultInfinityRule = NULL;
1642
1643 delete defaultNaNRule;
1644 defaultNaNRule = NULL;
1645
1622 delete lenientParseRules; 1646 delete lenientParseRules;
1623 lenientParseRules = NULL; 1647 lenientParseRules = NULL;
1624 1648
1625 #if !UCONFIG_NO_BREAK_ITERATION 1649 #if !UCONFIG_NO_BREAK_ITERATION
1626 delete capitalizationBrkIter; 1650 delete capitalizationBrkIter;
1627 capitalizationBrkIter = NULL; 1651 capitalizationBrkIter = NULL;
1628 #endif 1652 #endif
1629 1653
1630 if (localizations) localizations = localizations->unref(); 1654 if (localizations) {
1655 localizations = localizations->unref();
1656 }
1631 } 1657 }
1632 1658
1633 1659
1634 //----------------------------------------------------------------------- 1660 //-----------------------------------------------------------------------
1635 // package-internal API 1661 // package-internal API
1636 //----------------------------------------------------------------------- 1662 //-----------------------------------------------------------------------
1637 1663
1638 /** 1664 /**
1639 * Returns the collator to use for lenient parsing. The collator is lazily crea ted: 1665 * Returns the collator to use for lenient parsing. The collator is lazily crea ted:
1640 * this function creates it the first time it's called. 1666 * this function creates it the first time it's called.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1684 delete temp; 1710 delete temp;
1685 } 1711 }
1686 #endif 1712 #endif
1687 1713
1688 // if lenient-parse mode is off, this will be null 1714 // if lenient-parse mode is off, this will be null
1689 // (see setLenientParseMode()) 1715 // (see setLenientParseMode())
1690 return collator; 1716 return collator;
1691 } 1717 }
1692 1718
1693 1719
1694 /**
1695 * Returns the DecimalFormatSymbols object that should be used by all DecimalFor mat
1696 * instances owned by this formatter. This object is lazily created: this funct ion
1697 * creates it the first time it's called.
1698 * @return The DecimalFormatSymbols object that should be used by all DecimalFor mat
1699 * instances owned by this formatter.
1700 */
1701 DecimalFormatSymbols* 1720 DecimalFormatSymbols*
1702 RuleBasedNumberFormat::getDecimalFormatSymbols() const 1721 RuleBasedNumberFormat::initializeDecimalFormatSymbols(UErrorCode &status)
1703 { 1722 {
1704 // lazy-evaluate the DecimalFormatSymbols object. This object 1723 // lazy-evaluate the DecimalFormatSymbols object. This object
1705 // is shared by all DecimalFormat instances belonging to this 1724 // is shared by all DecimalFormat instances belonging to this
1706 // formatter 1725 // formatter
1707 if (decimalFormatSymbols == NULL) { 1726 if (decimalFormatSymbols == NULL) {
1708 UErrorCode status = U_ZERO_ERROR;
1709 DecimalFormatSymbols* temp = new DecimalFormatSymbols(locale, status); 1727 DecimalFormatSymbols* temp = new DecimalFormatSymbols(locale, status);
1710 if (U_SUCCESS(status)) { 1728 if (U_SUCCESS(status)) {
1711 ((RuleBasedNumberFormat*)this)->decimalFormatSymbols = temp; 1729 decimalFormatSymbols = temp;
1712 } else { 1730 }
1731 else {
1713 delete temp; 1732 delete temp;
1714 } 1733 }
1715 } 1734 }
1716 return decimalFormatSymbols; 1735 return decimalFormatSymbols;
1717 } 1736 }
1718 1737
1738 /**
1739 * Returns the DecimalFormatSymbols object that should be used by all DecimalFor mat
1740 * instances owned by this formatter.
1741 */
1742 const DecimalFormatSymbols*
1743 RuleBasedNumberFormat::getDecimalFormatSymbols() const
1744 {
1745 return decimalFormatSymbols;
1746 }
1747
1748 NFRule*
1749 RuleBasedNumberFormat::initializeDefaultInfinityRule(UErrorCode &status)
1750 {
1751 if (U_FAILURE(status)) {
1752 return NULL;
1753 }
1754 if (defaultInfinityRule == NULL) {
1755 UnicodeString rule(UNICODE_STRING_SIMPLE("Inf: "));
1756 rule.append(getDecimalFormatSymbols()->getSymbol(DecimalFormatSymbols::k InfinitySymbol));
1757 NFRule* temp = new NFRule(this, rule, status);
1758 if (U_SUCCESS(status)) {
1759 defaultInfinityRule = temp;
1760 }
1761 else {
1762 delete temp;
1763 }
1764 }
1765 return defaultInfinityRule;
1766 }
1767
1768 const NFRule*
1769 RuleBasedNumberFormat::getDefaultInfinityRule() const
1770 {
1771 return defaultInfinityRule;
1772 }
1773
1774 NFRule*
1775 RuleBasedNumberFormat::initializeDefaultNaNRule(UErrorCode &status)
1776 {
1777 if (U_FAILURE(status)) {
1778 return NULL;
1779 }
1780 if (defaultNaNRule == NULL) {
1781 UnicodeString rule(UNICODE_STRING_SIMPLE("NaN: "));
1782 rule.append(getDecimalFormatSymbols()->getSymbol(DecimalFormatSymbols::k NaNSymbol));
1783 NFRule* temp = new NFRule(this, rule, status);
1784 if (U_SUCCESS(status)) {
1785 defaultNaNRule = temp;
1786 }
1787 else {
1788 delete temp;
1789 }
1790 }
1791 return defaultNaNRule;
1792 }
1793
1794 const NFRule*
1795 RuleBasedNumberFormat::getDefaultNaNRule() const
1796 {
1797 return defaultNaNRule;
1798 }
1799
1719 // De-owning the current localized symbols and adopt the new symbols. 1800 // De-owning the current localized symbols and adopt the new symbols.
1720 void 1801 void
1721 RuleBasedNumberFormat::adoptDecimalFormatSymbols(DecimalFormatSymbols* symbolsTo Adopt) 1802 RuleBasedNumberFormat::adoptDecimalFormatSymbols(DecimalFormatSymbols* symbolsTo Adopt)
1722 { 1803 {
1723 if (symbolsToAdopt == NULL) { 1804 if (symbolsToAdopt == NULL) {
1724 return; // do not allow caller to set decimalFormatSymbols to NULL 1805 return; // do not allow caller to set decimalFormatSymbols to NULL
1725 } 1806 }
1726 1807
1727 if (decimalFormatSymbols != NULL) { 1808 if (decimalFormatSymbols != NULL) {
1728 delete decimalFormatSymbols; 1809 delete decimalFormatSymbols;
1729 } 1810 }
1730 1811
1731 decimalFormatSymbols = symbolsToAdopt; 1812 decimalFormatSymbols = symbolsToAdopt;
1732 1813
1733 { 1814 {
1734 // Apply the new decimalFormatSymbols by reparsing the rulesets 1815 // Apply the new decimalFormatSymbols by reparsing the rulesets
1735 UErrorCode status = U_ZERO_ERROR; 1816 UErrorCode status = U_ZERO_ERROR;
1736 1817
1737 for (int32_t i = 0; i < numRuleSets; i++) { 1818 delete defaultInfinityRule;
1738 ruleSets[i]->parseRules(ruleSetDescriptions[i], this, status); 1819 defaultInfinityRule = NULL;
1820 initializeDefaultInfinityRule(status); // Reset with the new DecimalForm atSymbols
1821
1822 delete defaultNaNRule;
1823 defaultNaNRule = NULL;
1824 initializeDefaultNaNRule(status); // Reset with the new DecimalFormatSym bols
1825
1826 if (ruleSets) {
1827 for (int32_t i = 0; i < numRuleSets; i++) {
1828 ruleSets[i]->setDecimalFormatSymbols(*symbolsToAdopt, status);
1829 }
1739 } 1830 }
1740 } 1831 }
1741 } 1832 }
1742 1833
1743 // Setting the symbols is equlivalent to adopting a newly created localized symb ols. 1834 // Setting the symbols is equlivalent to adopting a newly created localized symb ols.
1744 void 1835 void
1745 RuleBasedNumberFormat::setDecimalFormatSymbols(const DecimalFormatSymbols& symbo ls) 1836 RuleBasedNumberFormat::setDecimalFormatSymbols(const DecimalFormatSymbols& symbo ls)
1746 { 1837 {
1747 adoptDecimalFormatSymbols(new DecimalFormatSymbols(symbols)); 1838 adoptDecimalFormatSymbols(new DecimalFormatSymbols(symbols));
1748 } 1839 }
1749 1840
1750 PluralFormat * 1841 PluralFormat *
1751 RuleBasedNumberFormat::createPluralFormat(UPluralType pluralType, 1842 RuleBasedNumberFormat::createPluralFormat(UPluralType pluralType,
1752 const UnicodeString &pattern, 1843 const UnicodeString &pattern,
1753 UErrorCode& status) const 1844 UErrorCode& status) const
1754 { 1845 {
1755 return new PluralFormat(locale, pluralType, pattern, status); 1846 return new PluralFormat(locale, pluralType, pattern, status);
1756 } 1847 }
1757 1848
1758 U_NAMESPACE_END 1849 U_NAMESPACE_END
1759 1850
1760 /* U_HAVE_RBNF */ 1851 /* U_HAVE_RBNF */
1761 #endif 1852 #endif
OLDNEW
« no previous file with comments | « source/i18n/quantityformatter.cpp ('k') | source/i18n/rbt.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698