/*
**********************************************************************
-* 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);
}
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);
}
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)