Home | History | Annotate | Download | only in i18n
      1 /*
      2 **********************************************************************
      3 * Copyright (c) 2004-2010, 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 UBool operator==(const Format& other) const;
     59 
     60     /**
     61      * Override Format API.
     62      */
     63     virtual Format* clone() const;
     64 
     65 
     66     using MeasureFormat::format;
     67 
     68     /**
     69      * Override Format API.
     70      */
     71     virtual UnicodeString& format(const Formattable& obj,
     72                                   UnicodeString& appendTo,
     73                                   FieldPosition& pos,
     74                                   UErrorCode& ec) const;
     75 
     76     /**
     77      * Override Format API.
     78      */
     79     virtual void parseObject(const UnicodeString& source,
     80                              Formattable& result,
     81                              ParsePosition& pos) const;
     82 
     83     /**
     84      * Override Format API.
     85      */
     86     virtual UClassID getDynamicClassID() const;
     87 
     88     /**
     89      * Returns the class ID for this class.
     90      */
     91     static UClassID U_EXPORT2 getStaticClassID();
     92 
     93  private:
     94 
     95     NumberFormat* fmt;
     96 };
     97 
     98 U_NAMESPACE_END
     99 
    100 #endif // #if !UCONFIG_NO_FORMATTING
    101 #endif // #ifndef CURRENCYFORMAT_H
    102