11cb0ef41Sopenharmony_ci// © 2016 and later: Unicode, Inc. and others. 21cb0ef41Sopenharmony_ci// License & terms of use: http://www.unicode.org/copyright.html 31cb0ef41Sopenharmony_ci/* 41cb0ef41Sopenharmony_ci********************************************************************** 51cb0ef41Sopenharmony_ci* Copyright (c) 2004, International Business Machines 61cb0ef41Sopenharmony_ci* Corporation and others. All Rights Reserved. 71cb0ef41Sopenharmony_ci********************************************************************** 81cb0ef41Sopenharmony_ci* Author: Alan Liu 91cb0ef41Sopenharmony_ci* Created: April 26, 2004 101cb0ef41Sopenharmony_ci* Since: ICU 3.0 111cb0ef41Sopenharmony_ci********************************************************************** 121cb0ef41Sopenharmony_ci*/ 131cb0ef41Sopenharmony_ci#include "unicode/utypes.h" 141cb0ef41Sopenharmony_ci 151cb0ef41Sopenharmony_ci#if !UCONFIG_NO_FORMATTING 161cb0ef41Sopenharmony_ci 171cb0ef41Sopenharmony_ci#include "unicode/curramt.h" 181cb0ef41Sopenharmony_ci#include "unicode/currunit.h" 191cb0ef41Sopenharmony_ci 201cb0ef41Sopenharmony_ciU_NAMESPACE_BEGIN 211cb0ef41Sopenharmony_ci 221cb0ef41Sopenharmony_ciCurrencyAmount::CurrencyAmount(const Formattable& amount, ConstChar16Ptr isoCode, 231cb0ef41Sopenharmony_ci UErrorCode& ec) : 241cb0ef41Sopenharmony_ci Measure(amount, new CurrencyUnit(isoCode, ec), ec) { 251cb0ef41Sopenharmony_ci} 261cb0ef41Sopenharmony_ci 271cb0ef41Sopenharmony_ciCurrencyAmount::CurrencyAmount(double amount, ConstChar16Ptr isoCode, 281cb0ef41Sopenharmony_ci UErrorCode& ec) : 291cb0ef41Sopenharmony_ci Measure(Formattable(amount), new CurrencyUnit(isoCode, ec), ec) { 301cb0ef41Sopenharmony_ci} 311cb0ef41Sopenharmony_ci 321cb0ef41Sopenharmony_ciCurrencyAmount::CurrencyAmount(const CurrencyAmount& other) : 331cb0ef41Sopenharmony_ci Measure(other) { 341cb0ef41Sopenharmony_ci} 351cb0ef41Sopenharmony_ci 361cb0ef41Sopenharmony_ciCurrencyAmount& CurrencyAmount::operator=(const CurrencyAmount& other) { 371cb0ef41Sopenharmony_ci Measure::operator=(other); 381cb0ef41Sopenharmony_ci return *this; 391cb0ef41Sopenharmony_ci} 401cb0ef41Sopenharmony_ci 411cb0ef41Sopenharmony_ciCurrencyAmount* CurrencyAmount::clone() const { 421cb0ef41Sopenharmony_ci return new CurrencyAmount(*this); 431cb0ef41Sopenharmony_ci} 441cb0ef41Sopenharmony_ci 451cb0ef41Sopenharmony_ciCurrencyAmount::~CurrencyAmount() { 461cb0ef41Sopenharmony_ci} 471cb0ef41Sopenharmony_ci 481cb0ef41Sopenharmony_ciconst CurrencyUnit& CurrencyAmount::getCurrency() const { 491cb0ef41Sopenharmony_ci return static_cast<const CurrencyUnit&>(getUnit()); 501cb0ef41Sopenharmony_ci} 511cb0ef41Sopenharmony_ci 521cb0ef41Sopenharmony_ciUOBJECT_DEFINE_RTTI_IMPLEMENTATION(CurrencyAmount) 531cb0ef41Sopenharmony_ci 541cb0ef41Sopenharmony_ciU_NAMESPACE_END 551cb0ef41Sopenharmony_ci 561cb0ef41Sopenharmony_ci#endif // !UCONFIG_NO_FORMATTING 57