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

Side by Side Diff: source/i18n/currfmt.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/currfmt.h ('k') | source/i18n/currunit.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) 2004-2012 International Business Machines 3 * Copyright (c) 2004-2014 International Business Machines
4 * Corporation and others. All Rights Reserved. 4 * Corporation and others. All Rights Reserved.
5 ********************************************************************** 5 **********************************************************************
6 * Author: Alan Liu 6 * Author: Alan Liu
7 * Created: April 20, 2004 7 * Created: April 20, 2004
8 * Since: ICU 3.0 8 * Since: ICU 3.0
9 ********************************************************************** 9 **********************************************************************
10 */ 10 */
11 #include "utypeinfo.h" // for 'typeid' to work
12
13 #include "unicode/utypes.h" 11 #include "unicode/utypes.h"
14 12
15 #if !UCONFIG_NO_FORMATTING 13 #if !UCONFIG_NO_FORMATTING
16 14
17 #include "currfmt.h" 15 #include "currfmt.h"
18 #include "unicode/numfmt.h" 16 #include "unicode/numfmt.h"
19 #include "unicode/curramt.h" 17 #include "unicode/curramt.h"
20 18
21 U_NAMESPACE_BEGIN 19 U_NAMESPACE_BEGIN
22 20
23 CurrencyFormat::CurrencyFormat(const Locale& locale, UErrorCode& ec) : 21 CurrencyFormat::CurrencyFormat(const Locale& locale, UErrorCode& ec) :
24 fmt(NULL) 22 MeasureFormat(locale, UMEASFMT_WIDTH_WIDE, ec), fmt(NULL)
25 { 23 {
26 fmt = NumberFormat::createCurrencyInstance(locale, ec); 24 fmt = NumberFormat::createCurrencyInstance(locale, ec);
27 } 25 }
28 26
29 CurrencyFormat::CurrencyFormat(const CurrencyFormat& other) : 27 CurrencyFormat::CurrencyFormat(const CurrencyFormat& other) :
30 MeasureFormat(other), fmt(NULL) 28 MeasureFormat(other), fmt(NULL)
31 { 29 {
32 fmt = (NumberFormat*) other.fmt->clone(); 30 fmt = (NumberFormat*) other.fmt->clone();
33 } 31 }
34 32
35 CurrencyFormat::~CurrencyFormat() { 33 CurrencyFormat::~CurrencyFormat() {
36 delete fmt; 34 delete fmt;
37 } 35 }
38 36
39 UBool CurrencyFormat::operator==(const Format& other) const {
40 if (this == &other) {
41 return TRUE;
42 }
43 if (typeid(*this) != typeid(other)) {
44 return FALSE;
45 }
46 const CurrencyFormat* c = (const CurrencyFormat*) &other;
47 return *fmt == *c->fmt;
48 }
49
50 Format* CurrencyFormat::clone() const { 37 Format* CurrencyFormat::clone() const {
51 return new CurrencyFormat(*this); 38 return new CurrencyFormat(*this);
52 } 39 }
53 40
54 UnicodeString& CurrencyFormat::format(const Formattable& obj, 41 UnicodeString& CurrencyFormat::format(const Formattable& obj,
55 UnicodeString& appendTo, 42 UnicodeString& appendTo,
56 FieldPosition& pos, 43 FieldPosition& pos,
57 UErrorCode& ec) const 44 UErrorCode& ec) const
58 { 45 {
59 return fmt->format(obj, appendTo, pos, ec); 46 return fmt->format(obj, appendTo, pos, ec);
60 } 47 }
61 48
62 void CurrencyFormat::parseObject(const UnicodeString& source, 49 void CurrencyFormat::parseObject(const UnicodeString& source,
63 Formattable& result, 50 Formattable& result,
64 ParsePosition& pos) const 51 ParsePosition& pos) const
65 { 52 {
66 CurrencyAmount* currAmt = fmt->parseCurrency(source, pos); 53 CurrencyAmount* currAmt = fmt->parseCurrency(source, pos);
67 if (currAmt != NULL) { 54 if (currAmt != NULL) {
68 result.adoptObject(currAmt); 55 result.adoptObject(currAmt);
69 } 56 }
70 } 57 }
71 58
72 UOBJECT_DEFINE_RTTI_IMPLEMENTATION(CurrencyFormat) 59 UOBJECT_DEFINE_RTTI_IMPLEMENTATION(CurrencyFormat)
73 60
74 U_NAMESPACE_END 61 U_NAMESPACE_END
75 62
76 #endif /* #if !UCONFIG_NO_FORMATTING */ 63 #endif /* #if !UCONFIG_NO_FORMATTING */
OLDNEW
« no previous file with comments | « source/i18n/currfmt.h ('k') | source/i18n/currunit.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698