]>
git.saurik.com Git - apple/icu.git/blob - icuSources/i18n/currunit.cpp
2 **********************************************************************
3 * Copyright (c) 2004-2012, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 **********************************************************************
7 * Created: April 26, 2004
9 **********************************************************************
11 #include "utypeinfo.h" // for 'typeid' to work
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
);
28 ec
= U_ILLEGAL_ARGUMENT_ERROR
;
33 CurrencyUnit::CurrencyUnit(const CurrencyUnit
& other
) :
38 CurrencyUnit
& CurrencyUnit::operator=(const CurrencyUnit
& other
) {
40 u_strcpy(isoCode
, other
.isoCode
);
45 UObject
* CurrencyUnit::clone() const {
46 return new CurrencyUnit(*this);
49 CurrencyUnit::~CurrencyUnit() {
52 UBool
CurrencyUnit::operator==(const UObject
& other
) const {
53 const CurrencyUnit
& c
= (const CurrencyUnit
&) other
;
54 return typeid(*this) == typeid(other
) &&
55 u_strcmp(isoCode
, c
.isoCode
) == 0;
58 UOBJECT_DEFINE_RTTI_IMPLEMENTATION(CurrencyUnit
)
62 #endif // !UCONFIG_NO_FORMATTING