Home | History | Annotate | Download | only in i18n
      1 /*
      2 **********************************************************************
      3 * Copyright (c) 2004-2014, International Business Machines
      4 * Corporation and others.  All Rights Reserved.
      5 **********************************************************************
      6 * Author: Alan Liu
      7 * Created: April 20, 2004
      8 * Since: ICU 3.0
      9 **********************************************************************
     10 */
     11 #ifndef CURRENCYFORMAT_H
     12 #define CURRENCYFORMAT_H
     13 
     14 #include "unicode/utypes.h"
     15 
     16 #if !UCONFIG_NO_FORMATTING
     17 
     18 #include "unicode/measfmt.h"
     19 
     20 U_NAMESPACE_BEGIN
     21 
     22 class NumberFormat;
     23 
     24 /**
     25  * Temporary internal concrete subclass of MeasureFormat implementing
     26  * parsing and formatting of currency amount objects.  This class is
     27  * likely to be redesigned and rewritten in the near future.
     28  *
     29  * <p>This class currently delegates to DecimalFormat for parsing and
     30  * formatting.
     31  *
     32  * @see MeasureFormat
     33  * @author Alan Liu
     34  * @internal
     35  */
     36 class CurrencyFormat : public MeasureFormat {
     37 
     38  public:
     39 
     40     /**
     41      * Construct a CurrencyFormat for the given locale.
     42      */
     43     CurrencyFormat(const Locale& locale, UErrorCode& ec);
     44 
     45     /**
     46      * Copy constructor.
     47      */
     48     CurrencyFormat(const CurrencyFormat& other);
     49 
     50     /**
     51      * Destructor.
     52      */
     53     virtual ~CurrencyFormat();
     54 
     55     /**
     56      * Override Format API.
     57      */
     58     virtual Format* clone() const;
     59 
     60 
     61     using MeasureFormat::format;
     62 
     63     /**
     64      * Override Format API.
     65      */
     66     virtual UnicodeString& format(const Formattable& obj,
     67                                   UnicodeString& appendTo,
     68                                   FieldPosition& pos,
     69                                   UErrorCode& ec) const;
     70 
     71     /**
     72      * Override Format API.
     73      */
     74     virtual void parseObject(const UnicodeString& source,
     75                              Formattable& result,
     76                              ParsePosition& pos) const;
     77 
     78     /**
     79      * Override Format API.
     80      */
     81     virtual UClassID getDynamicClassID() const;
     82 
     83     /**
     84      * Returns the class ID for this class.
     85      */
     86     static UClassID U_EXPORT2 getStaticClassID();
     87 
     88  private:
     89 
     90     NumberFormat* fmt;
     91 };
     92 
     93 U_NAMESPACE_END
     94 
     95 #endif // #if !UCONFIG_NO_FORMATTING
     96 #endif // #ifndef CURRENCYFORMAT_H
     97