]>
git.saurik.com Git - apple/icu.git/blob - icuSources/i18n/currfmt.cpp
2 **********************************************************************
3 * Copyright (c) 2004-2014 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"
17 #include "unicode/curramt.h"
21 CurrencyFormat::CurrencyFormat(const Locale
& locale
, UErrorCode
& ec
) :
22 MeasureFormat(locale
, UMEASFMT_WIDTH_WIDE
, ec
), fmt(NULL
)
24 fmt
= NumberFormat::createCurrencyInstance(locale
, ec
);
27 CurrencyFormat::CurrencyFormat(const CurrencyFormat
& other
) :
28 MeasureFormat(other
), fmt(NULL
)
30 fmt
= (NumberFormat
*) other
.fmt
->clone();
33 CurrencyFormat::~CurrencyFormat() {
37 Format
* CurrencyFormat::clone() const {
38 return new CurrencyFormat(*this);
41 UnicodeString
& CurrencyFormat::format(const Formattable
& obj
,
42 UnicodeString
& appendTo
,
46 return fmt
->format(obj
, appendTo
, pos
, ec
);
49 void CurrencyFormat::parseObject(const UnicodeString
& source
,
51 ParsePosition
& pos
) const
53 CurrencyAmount
* currAmt
= fmt
->parseCurrency(source
, pos
);
54 if (currAmt
!= NULL
) {
55 result
.adoptObject(currAmt
);
59 UOBJECT_DEFINE_RTTI_IMPLEMENTATION(CurrencyFormat
)
63 #endif /* #if !UCONFIG_NO_FORMATTING */