1 // Copyright (C) 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
4 **********************************************************************
5 * Copyright (c) 2004-2014, International Business Machines
6 * Corporation and others. All Rights Reserved.
7 **********************************************************************
9 * Created: April 26, 2004
11 **********************************************************************
13 #include "unicode/utypes.h"
15 #if !UCONFIG_NO_FORMATTING
17 #include "unicode/currunit.h"
18 #include "unicode/ustring.h"
22 CurrencyUnit::CurrencyUnit(const UChar* _isoCode, UErrorCode& ec) {
25 if (_isoCode && u_strlen(_isoCode)==3) {
26 u_strcpy(isoCode, _isoCode);
27 char simpleIsoCode[4];
28 u_UCharsToChars(isoCode, simpleIsoCode, 4);
29 initCurrency(simpleIsoCode);
31 ec = U_ILLEGAL_ARGUMENT_ERROR;
36 CurrencyUnit::CurrencyUnit(const CurrencyUnit& other) :
38 u_strcpy(isoCode, other.isoCode);
41 CurrencyUnit& CurrencyUnit::operator=(const CurrencyUnit& other) {
45 MeasureUnit::operator=(other);
46 u_strcpy(isoCode, other.isoCode);
50 UObject* CurrencyUnit::clone() const {
51 return new CurrencyUnit(*this);
54 CurrencyUnit::~CurrencyUnit() {
57 UOBJECT_DEFINE_RTTI_IMPLEMENTATION(CurrencyUnit)
61 #endif // !UCONFIG_NO_FORMATTING