]>
git.saurik.com Git - apple/icu.git/blob - icuSources/i18n/currfmt.cpp
2 **********************************************************************
3 * Copyright (c) 2004-2010, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 **********************************************************************
7 * Created: April 20, 2004
9 **********************************************************************
11 #include <typeinfo> // for 'typeid' to work
13 #include "unicode/utypes.h"
15 #if !UCONFIG_NO_FORMATTING
18 #include "unicode/numfmt.h"
22 CurrencyFormat::CurrencyFormat(const Locale
& locale
, UErrorCode
& ec
) :
25 fmt
= NumberFormat::createCurrencyInstance(locale
, ec
);
28 CurrencyFormat::CurrencyFormat(const CurrencyFormat
& other
) :
29 MeasureFormat(other
), fmt(NULL
)
31 fmt
= (NumberFormat
*) other
.fmt
->clone();
34 CurrencyFormat::~CurrencyFormat() {
38 UBool
CurrencyFormat::operator==(const Format
& other
) const {
42 if (typeid(*this) != typeid(other
)) {
45 const CurrencyFormat
* c
= (const CurrencyFormat
*) &other
;
46 return *fmt
== *c
->fmt
;
49 Format
* CurrencyFormat::clone() const {
50 return new CurrencyFormat(*this);
53 UnicodeString
& CurrencyFormat::format(const Formattable
& obj
,
54 UnicodeString
& appendTo
,
58 return fmt
->format(obj
, appendTo
, pos
, ec
);
61 void CurrencyFormat::parseObject(const UnicodeString
& source
,
63 ParsePosition
& pos
) const
65 fmt
->parseCurrency(source
, result
, pos
);
68 UOBJECT_DEFINE_RTTI_IMPLEMENTATION(CurrencyFormat
)
72 #endif /* #if !UCONFIG_NO_FORMATTING */