]>
Commit | Line | Data |
---|---|---|
f3c0d7a5 A |
1 | // © 2016 and later: Unicode, Inc. and others. |
2 | // License & terms of use: http://www.unicode.org/copyright.html | |
374ca955 A |
3 | /* |
4 | ********************************************************************** | |
57a6839d | 5 | * Copyright (c) 2004-2014 International Business Machines |
374ca955 A |
6 | * Corporation and others. All Rights Reserved. |
7 | ********************************************************************** | |
8 | * Author: Alan Liu | |
9 | * Created: April 20, 2004 | |
10 | * Since: ICU 3.0 | |
11 | ********************************************************************** | |
12 | */ | |
13 | #include "unicode/utypes.h" | |
14 | ||
15 | #if !UCONFIG_NO_FORMATTING | |
16 | ||
17 | #include "currfmt.h" | |
18 | #include "unicode/numfmt.h" | |
4388f060 | 19 | #include "unicode/curramt.h" |
374ca955 A |
20 | |
21 | U_NAMESPACE_BEGIN | |
22 | ||
23 | CurrencyFormat::CurrencyFormat(const Locale& locale, UErrorCode& ec) : | |
3d1f044b | 24 | MeasureFormat(locale, UMEASFMT_WIDTH_WIDE, ec) |
46f4442e | 25 | { |
374ca955 A |
26 | } |
27 | ||
28 | CurrencyFormat::CurrencyFormat(const CurrencyFormat& other) : | |
3d1f044b | 29 | MeasureFormat(other) |
46f4442e | 30 | { |
374ca955 A |
31 | } |
32 | ||
33 | CurrencyFormat::~CurrencyFormat() { | |
374ca955 A |
34 | } |
35 | ||
374ca955 A |
36 | Format* CurrencyFormat::clone() const { |
37 | return new CurrencyFormat(*this); | |
38 | } | |
39 | ||
40 | UnicodeString& CurrencyFormat::format(const Formattable& obj, | |
41 | UnicodeString& appendTo, | |
42 | FieldPosition& pos, | |
46f4442e A |
43 | UErrorCode& ec) const |
44 | { | |
3d1f044b | 45 | return getCurrencyFormatInternal().format(obj, appendTo, pos, ec); |
374ca955 A |
46 | } |
47 | ||
374ca955 A |
48 | void CurrencyFormat::parseObject(const UnicodeString& source, |
49 | Formattable& result, | |
46f4442e A |
50 | ParsePosition& pos) const |
51 | { | |
3d1f044b | 52 | CurrencyAmount* currAmt = getCurrencyFormatInternal().parseCurrency(source, pos); |
4388f060 A |
53 | if (currAmt != NULL) { |
54 | result.adoptObject(currAmt); | |
55 | } | |
374ca955 A |
56 | } |
57 | ||
374ca955 A |
58 | UOBJECT_DEFINE_RTTI_IMPLEMENTATION(CurrencyFormat) |
59 | ||
60 | U_NAMESPACE_END | |
61 | ||
62 | #endif /* #if !UCONFIG_NO_FORMATTING */ |