1ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/*
2ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru**********************************************************************
3ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* Copyright (c) 2004-2006, International Business Machines
4ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* Corporation and others.  All Rights Reserved.
5ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru**********************************************************************
6ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* Author: Alan Liu
7ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* Created: April 26, 2004
8ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* Since: ICU 3.0
9ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru**********************************************************************
10ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru*/
11ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#ifndef __CURRENCYUNIT_H__
12ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#define __CURRENCYUNIT_H__
13ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
14ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "unicode/utypes.h"
15ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
16ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#if !UCONFIG_NO_FORMATTING
17ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
18ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "unicode/measunit.h"
19ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
20ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/**
21ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * \file
22ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * \brief C++ API: Currency Unit Information.
23ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */
24ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
25ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_NAMESPACE_BEGIN
26ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
27ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/**
28ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * A unit of currency, such as USD (U.S. dollars) or JPY (Japanese
29ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * yen).  This class is a thin wrapper over a UChar string that
30ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * subclasses MeasureUnit, for use with Measure and MeasureFormat.
31ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
32ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @author Alan Liu
33ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.0
34ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */
35ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruclass U_I18N_API CurrencyUnit: public MeasureUnit {
36ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru public:
37ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
38ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Construct an object with the given ISO currency code.
39ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param isoCode the 3-letter ISO 4217 currency code; must not be
40ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * NULL and must have length 3
41ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param ec input-output error code. If the isoCode is invalid,
42ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * then this will be set to a failing value.
43ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 3.0
44ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
45ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    CurrencyUnit(const UChar* isoCode, UErrorCode &ec);
46ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
47ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
48ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Copy constructor
49ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 3.0
50ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
51ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    CurrencyUnit(const CurrencyUnit& other);
52ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
53ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
54ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Assignment operator
55ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 3.0
56ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
57ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    CurrencyUnit& operator=(const CurrencyUnit& other);
58ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
59ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
60ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Return a polymorphic clone of this object.  The result will
61ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * have the same class as returned by getDynamicClassID().
62ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 3.0
63ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
64ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UObject* clone() const;
65ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
66ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
67ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Destructor
68ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 3.0
69ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
70ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual ~CurrencyUnit();
71ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
72ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
73ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Equality operator.  Return true if this object is equal
74ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * to the given object.
75ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 3.0
76ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
77ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UBool operator==(const UObject& other) const;
78ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
79ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
80ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Returns a unique class ID for this object POLYMORPHICALLY.
81ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * This method implements a simple form of RTTI used by ICU.
82ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return The class ID for this object. All objects of a given
83ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * class have the same class ID.  Objects of other classes have
84ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * different class IDs.
85ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 3.0
86ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
87ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UClassID getDynamicClassID() const;
88ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
89ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
90ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Returns the class ID for this class. This is used to compare to
91ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * the return value of getDynamicClassID().
92ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return The class ID for all objects of this class.
93ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 3.0
94ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
95ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    static UClassID U_EXPORT2 getStaticClassID();
96ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
97ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
98ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Return the ISO currency code of this object.
99ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 3.0
100ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
101ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    inline const UChar* getISOCurrency() const;
102ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
103ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru private:
104ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
105ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * The ISO 4217 code of this object.
106ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
107ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UChar isoCode[4];
108ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru};
109ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
110ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruinline const UChar* CurrencyUnit::getISOCurrency() const {
111ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    return isoCode;
112ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru}
113ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
114ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_NAMESPACE_END
115ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
116ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#endif // !UCONFIG_NO_FORMATTING
117ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#endif // __CURRENCYUNIT_H__
118