Index: source/i18n/currunit.cpp |
diff --git a/source/i18n/currunit.cpp b/source/i18n/currunit.cpp |
index 870d9d0c4ce8bb6f60500e9ac7ce9960ebd3f036..eaf5000d9b23b9298b8f480811a2d5be2d4eaaaa 100644 |
--- a/source/i18n/currunit.cpp |
+++ b/source/i18n/currunit.cpp |
@@ -1,6 +1,6 @@ |
/* |
********************************************************************** |
-* Copyright (c) 2004-2012, International Business Machines |
+* Copyright (c) 2004-2014, International Business Machines |
* Corporation and others. All Rights Reserved. |
********************************************************************** |
* Author: Alan Liu |
@@ -8,8 +8,6 @@ |
* Since: ICU 3.0 |
********************************************************************** |
*/ |
-#include "utypeinfo.h" // for 'typeid' to work |
- |
#include "unicode/utypes.h" |
#if !UCONFIG_NO_FORMATTING |
@@ -24,6 +22,9 @@ CurrencyUnit::CurrencyUnit(const UChar* _isoCode, UErrorCode& ec) { |
if (U_SUCCESS(ec)) { |
if (_isoCode && u_strlen(_isoCode)==3) { |
u_strcpy(isoCode, _isoCode); |
+ char simpleIsoCode[4]; |
+ u_UCharsToChars(isoCode, simpleIsoCode, 4); |
+ initCurrency(simpleIsoCode); |
} else { |
ec = U_ILLEGAL_ARGUMENT_ERROR; |
} |
@@ -32,13 +33,15 @@ CurrencyUnit::CurrencyUnit(const UChar* _isoCode, UErrorCode& ec) { |
CurrencyUnit::CurrencyUnit(const CurrencyUnit& other) : |
MeasureUnit(other) { |
- *this = other; |
+ u_strcpy(isoCode, other.isoCode); |
} |
CurrencyUnit& CurrencyUnit::operator=(const CurrencyUnit& other) { |
- if (this != &other) { |
- u_strcpy(isoCode, other.isoCode); |
+ if (this == &other) { |
+ return *this; |
} |
+ MeasureUnit::operator=(other); |
+ u_strcpy(isoCode, other.isoCode); |
return *this; |
} |
@@ -49,12 +52,6 @@ UObject* CurrencyUnit::clone() const { |
CurrencyUnit::~CurrencyUnit() { |
} |
-UBool CurrencyUnit::operator==(const UObject& other) const { |
- const CurrencyUnit& c = (const CurrencyUnit&) other; |
- return typeid(*this) == typeid(other) && |
- u_strcmp(isoCode, c.isoCode) == 0; |
-} |
- |
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(CurrencyUnit) |
U_NAMESPACE_END |