]>
git.saurik.com Git - apple/icu.git/blob - icuSources/i18n/currfmt.cpp
2 **********************************************************************
3 * Copyright (c) 2004-2008, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 **********************************************************************
7 * Created: April 20, 2004
9 **********************************************************************
11 #include "unicode/utypes.h"
13 #if !UCONFIG_NO_FORMATTING
16 #include "unicode/numfmt.h"
20 CurrencyFormat::CurrencyFormat(const Locale
& locale
, UErrorCode
& ec
) :
23 fmt
= NumberFormat::createCurrencyInstance(locale
, ec
);
26 CurrencyFormat::CurrencyFormat(const CurrencyFormat
& other
) :
27 MeasureFormat(other
), fmt(NULL
)
29 fmt
= (NumberFormat
*) other
.fmt
->clone();
32 CurrencyFormat::~CurrencyFormat() {
36 UBool
CurrencyFormat::operator==(const Format
& other
) const {
40 if (other
.getDynamicClassID() != CurrencyFormat::getStaticClassID()) {
43 const CurrencyFormat
* c
= (const CurrencyFormat
*) &other
;
44 return *fmt
== *c
->fmt
;
47 Format
* CurrencyFormat::clone() const {
48 return new CurrencyFormat(*this);
51 UnicodeString
& CurrencyFormat::format(const Formattable
& obj
,
52 UnicodeString
& appendTo
,
56 return fmt
->format(obj
, appendTo
, pos
, ec
);
59 void CurrencyFormat::parseObject(const UnicodeString
& source
,
61 ParsePosition
& pos
) const
63 fmt
->parseCurrency(source
, result
, pos
);
66 UOBJECT_DEFINE_RTTI_IMPLEMENTATION(CurrencyFormat
)
70 #endif /* #if !UCONFIG_NO_FORMATTING */