]>
git.saurik.com Git - apple/icu.git/blob - icuSources/i18n/currfmt.cpp
2 **********************************************************************
3 * Copyright (c) 2004, 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
) :
22 fmt
= NumberFormat::createCurrencyInstance(locale
, ec
);
25 CurrencyFormat::CurrencyFormat(const CurrencyFormat
& other
) :
26 MeasureFormat(other
), fmt(NULL
) {
27 fmt
= (NumberFormat
*) other
.fmt
->clone();
30 CurrencyFormat::~CurrencyFormat() {
34 UBool
CurrencyFormat::operator==(const Format
& other
) const {
38 if (other
.getDynamicClassID() != CurrencyFormat::getStaticClassID()) {
41 const CurrencyFormat
* c
= (const CurrencyFormat
*) &other
;
42 return *fmt
== *c
->fmt
;
45 Format
* CurrencyFormat::clone() const {
46 return new CurrencyFormat(*this);
49 UnicodeString
& CurrencyFormat::format(const Formattable
& obj
,
50 UnicodeString
& appendTo
,
52 UErrorCode
& ec
) const {
53 return fmt
->format(obj
, appendTo
, pos
, ec
);
56 UnicodeString
& CurrencyFormat::format(const Formattable
& obj
,
57 UnicodeString
& appendTo
,
58 UErrorCode
& ec
) const {
59 return MeasureFormat::format(obj
, appendTo
, ec
);
62 void CurrencyFormat::parseObject(const UnicodeString
& source
,
64 ParsePosition
& pos
) const {
65 fmt
->parseCurrency(source
, result
, pos
);
68 void CurrencyFormat::parseObject(const UnicodeString
& source
,
70 UErrorCode
& ec
) const {
71 MeasureFormat::parseObject(source
, result
, ec
);
74 UOBJECT_DEFINE_RTTI_IMPLEMENTATION(CurrencyFormat
)
78 #endif /* #if !UCONFIG_NO_FORMATTING */