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

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

Issue 845603002: Update ICU to 54.1 step 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/icu.git@master
Patch Set: remove unusued directories Created 5 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/utrans.h ('k') | source/i18n/uregex.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) 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 * Modification History: 6 * Modification History:
7 * 7 *
8 * Date Name Description 8 * Date Name Description
9 * 06/24/99 helena Integrated Alan's NF enhancements and Java2 bug fixe s 9 * 06/24/99 helena Integrated Alan's NF enhancements and Java2 bug fixe s
10 ******************************************************************************* 10 *******************************************************************************
11 */ 11 */
12 12
13 #include "unicode/utypes.h" 13 #include "unicode/utypes.h"
14 14
15 #if !UCONFIG_NO_FORMATTING 15 #if !UCONFIG_NO_FORMATTING
16 16
17 #include "unicode/unum.h" 17 #include "unicode/unum.h"
18 18
19 #include "unicode/uloc.h" 19 #include "unicode/uloc.h"
20 #include "unicode/numfmt.h" 20 #include "unicode/numfmt.h"
21 #include "unicode/decimfmt.h" 21 #include "unicode/decimfmt.h"
22 #include "unicode/rbnf.h" 22 #include "unicode/rbnf.h"
23 #include "unicode/ustring.h" 23 #include "unicode/ustring.h"
24 #include "unicode/fmtable.h" 24 #include "unicode/fmtable.h"
25 #include "unicode/dcfmtsym.h" 25 #include "unicode/dcfmtsym.h"
26 #include "unicode/curramt.h" 26 #include "unicode/curramt.h"
27 #include "unicode/localpointer.h" 27 #include "unicode/localpointer.h"
28 #include "unicode/udisplaycontext.h"
28 #include "uassert.h" 29 #include "uassert.h"
29 #include "cpputils.h" 30 #include "cpputils.h"
30 #include "cstring.h" 31 #include "cstring.h"
31 32
32 33
33 U_NAMESPACE_USE 34 U_NAMESPACE_USE
34 35
35 36
36 U_CAPI UNumberFormat* U_EXPORT2 37 U_CAPI UNumberFormat* U_EXPORT2
37 unum_open( UNumberFormatStyle style, 38 unum_open( UNumberFormatStyle style,
38 const UChar* pattern, 39 const UChar* pattern,
39 int32_t patternLength, 40 int32_t patternLength,
40 const char* locale, 41 const char* locale,
41 UParseError* parseErr, 42 UParseError* parseErr,
42 UErrorCode* status) { 43 UErrorCode* status) {
43 if(U_FAILURE(*status)) { 44 if(U_FAILURE(*status)) {
44 return NULL; 45 return NULL;
45 } 46 }
46 47
47 NumberFormat *retVal = NULL; 48 NumberFormat *retVal = NULL;
48 49
49 switch(style) { 50 switch(style) {
50 case UNUM_DECIMAL: 51 case UNUM_DECIMAL:
51 case UNUM_CURRENCY: 52 case UNUM_CURRENCY:
52 case UNUM_PERCENT: 53 case UNUM_PERCENT:
53 case UNUM_SCIENTIFIC: 54 case UNUM_SCIENTIFIC:
55 case UNUM_CURRENCY_ISO:
56 case UNUM_CURRENCY_PLURAL:
57 case UNUM_CURRENCY_ACCOUNTING:
58 case UNUM_CASH_CURRENCY:
54 retVal = NumberFormat::createInstance(Locale(locale), style, *status); 59 retVal = NumberFormat::createInstance(Locale(locale), style, *status);
55 break; 60 break;
56 61
57 case UNUM_PATTERN_DECIMAL: { 62 case UNUM_PATTERN_DECIMAL: {
58 UParseError tErr; 63 UParseError tErr;
59 /* UnicodeString can handle the case when patternLength = -1. */ 64 /* UnicodeString can handle the case when patternLength = -1. */
60 const UnicodeString pat(pattern, patternLength); 65 const UnicodeString pat(pattern, patternLength);
61 66
62 if(parseErr==NULL){ 67 if(parseErr==NULL){
63 parseErr = &tErr; 68 parseErr = &tErr;
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after
776 { 781 {
777 if (fmt == NULL) { 782 if (fmt == NULL) {
778 if (U_SUCCESS(*status)) { 783 if (U_SUCCESS(*status)) {
779 *status = U_ILLEGAL_ARGUMENT_ERROR; 784 *status = U_ILLEGAL_ARGUMENT_ERROR;
780 } 785 }
781 return NULL; 786 return NULL;
782 } 787 }
783 return ((const Format*)fmt)->getLocaleID(type, *status); 788 return ((const Format*)fmt)->getLocaleID(type, *status);
784 } 789 }
785 790
791 U_CAPI void U_EXPORT2
792 unum_setContext(UNumberFormat* fmt, UDisplayContext value, UErrorCode* status)
793 {
794 if (U_FAILURE(*status)) {
795 return;
796 }
797 ((NumberFormat*)fmt)->setContext(value, *status);
798 return;
799 }
800
801 U_CAPI UDisplayContext U_EXPORT2
802 unum_getContext(const UNumberFormat *fmt, UDisplayContextType type, UErrorCode* status)
803 {
804 if (U_FAILURE(*status)) {
805 return (UDisplayContext)0;
806 }
807 return ((const NumberFormat*)fmt)->getContext(type, *status);
808 }
809
786 U_INTERNAL UFormattable * U_EXPORT2 810 U_INTERNAL UFormattable * U_EXPORT2
787 unum_parseToUFormattable(const UNumberFormat* fmt, 811 unum_parseToUFormattable(const UNumberFormat* fmt,
788 UFormattable *result, 812 UFormattable *result,
789 const UChar* text, 813 const UChar* text,
790 int32_t textLength, 814 int32_t textLength,
791 int32_t* parsePos, /* 0 = start */ 815 int32_t* parsePos, /* 0 = start */
792 UErrorCode* status) { 816 UErrorCode* status) {
793 UFormattable *newFormattable = NULL; 817 UFormattable *newFormattable = NULL;
794 if (U_FAILURE(*status)) return result; 818 if (U_FAILURE(*status)) return result;
795 if (fmt == NULL || (text==NULL && textLength!=0)) { 819 if (fmt == NULL || (text==NULL && textLength!=0)) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 857
834 if(pos != 0) { 858 if(pos != 0) {
835 pos->beginIndex = fp.getBeginIndex(); 859 pos->beginIndex = fp.getBeginIndex();
836 pos->endIndex = fp.getEndIndex(); 860 pos->endIndex = fp.getEndIndex();
837 } 861 }
838 862
839 return res.extract(result, resultLength, *status); 863 return res.extract(result, resultLength, *status);
840 } 864 }
841 865
842 #endif /* #if !UCONFIG_NO_FORMATTING */ 866 #endif /* #if !UCONFIG_NO_FORMATTING */
OLDNEW
« no previous file with comments | « source/i18n/unicode/utrans.h ('k') | source/i18n/uregex.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698