]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/i18n/currfmt.cpp
ICU-57149.0.1.tar.gz
[apple/icu.git] / icuSources / i18n / currfmt.cpp
index 6b112406294ba69c1368728a6d3d98b49722a4cf..23a7d52acac1573e06a2cc0babcc1ba07281e294 100644 (file)
@@ -1,6 +1,6 @@
 /*
 **********************************************************************
-* Copyright (c) 2004-2008, International Business Machines
+* Copyright (c) 2004-2014 International Business Machines
 * Corporation and others.  All Rights Reserved.
 **********************************************************************
 * Author: Alan Liu
 
 #include "currfmt.h"
 #include "unicode/numfmt.h"
+#include "unicode/curramt.h"
 
 U_NAMESPACE_BEGIN
 
 CurrencyFormat::CurrencyFormat(const Locale& locale, UErrorCode& ec) :
-    fmt(NULL)
+    MeasureFormat(locale, UMEASFMT_WIDTH_WIDE, ec), fmt(NULL)
 {
     fmt = NumberFormat::createCurrencyInstance(locale, ec);
 }
@@ -33,17 +34,6 @@ CurrencyFormat::~CurrencyFormat() {
     delete fmt;
 }
 
-UBool CurrencyFormat::operator==(const Format& other) const {
-    if (this == &other) {
-        return TRUE;
-    }
-    if (other.getDynamicClassID() != CurrencyFormat::getStaticClassID()) {
-        return FALSE;
-    }
-    const CurrencyFormat* c = (const CurrencyFormat*) &other;
-    return *fmt == *c->fmt;
-}
-
 Format* CurrencyFormat::clone() const {
     return new CurrencyFormat(*this);
 }
@@ -60,7 +50,10 @@ void CurrencyFormat::parseObject(const UnicodeString& source,
                                  Formattable& result,
                                  ParsePosition& pos) const
 {
-    fmt->parseCurrency(source, result, pos);
+    CurrencyAmount* currAmt = fmt->parseCurrency(source, pos);
+    if (currAmt != NULL) {
+        result.adoptObject(currAmt);
+    }
 }
 
 UOBJECT_DEFINE_RTTI_IMPLEMENTATION(CurrencyFormat)