| 1 |
// © 2016 and later: Unicode, Inc. and others. |
| 2 |
// License & terms of use: http://www.unicode.org/copyright.html |
| 3 |
/* |
| 4 |
********************************************************************** |
| 5 |
* Copyright (c) 2004, International Business Machines |
| 6 |
* Corporation and others. All Rights Reserved. |
| 7 |
********************************************************************** |
| 8 |
* Author: Alan Liu |
| 9 |
* Created: April 26, 2004 |
| 10 |
* Since: ICU 3.0 |
| 11 |
********************************************************************** |
| 12 |
*/ |
| 13 |
#include "unicode/utypes.h" |
| 14 |
|
| 15 |
#if !UCONFIG_NO_FORMATTING |
| 16 |
|
| 17 |
#include "unicode/curramt.h" |
| 18 |
#include "unicode/currunit.h" |
| 19 |
|
| 20 |
U_NAMESPACE_BEGIN |
| 21 |
|
| 22 |
CurrencyAmount::CurrencyAmount(const Formattable& amount, ConstChar16Ptr isoCode, |
| 23 |
UErrorCode& ec) : |
| 24 |
Measure(amount, new CurrencyUnit(isoCode, ec), ec) { |
| 25 |
} |
| 26 |
|
| 27 |
CurrencyAmount::CurrencyAmount(double amount, ConstChar16Ptr isoCode, |
| 28 |
UErrorCode& ec) : |
| 29 |
Measure(Formattable(amount), new CurrencyUnit(isoCode, ec), ec) { |
| 30 |
} |
| 31 |
|
| 32 |
CurrencyAmount::CurrencyAmount(const CurrencyAmount& other) : |
| 33 |
Measure(other) { |
| 34 |
} |
| 35 |
|
| 36 |
CurrencyAmount& CurrencyAmount::operator=(const CurrencyAmount& other) { |
| 37 |
Measure::operator=(other); |
| 38 |
return *this; |
| 39 |
} |
| 40 |
|
| 41 |
CurrencyAmount* CurrencyAmount::clone() const { |
| 42 |
return new CurrencyAmount(*this); |
| 43 |
} |
| 44 |
|
| 45 |
CurrencyAmount::~CurrencyAmount() { |
| 46 |
} |
| 47 |
|
| 48 |
const CurrencyUnit& CurrencyAmount::getCurrency() const { |
| 49 |
return static_cast<const CurrencyUnit&>(getUnit()); |
| 50 |
} |
| 51 |
|
| 52 |
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(CurrencyAmount) |
| 53 |
|
| 54 |
U_NAMESPACE_END |
| 55 |
|
| 56 |
#endif // !UCONFIG_NO_FORMATTING |