]> git.saurik.com Git - apple/icu.git/blame - icuSources/i18n/unicode/curramt.h
ICU-400.42.tar.gz
[apple/icu.git] / icuSources / i18n / unicode / curramt.h
CommitLineData
374ca955
A
1/*
2**********************************************************************
73c04bcf 3* Copyright (c) 2004-2006, International Business Machines
374ca955
A
4* Corporation and others. All Rights Reserved.
5**********************************************************************
6* Author: Alan Liu
7* Created: April 26, 2004
8* Since: ICU 3.0
9**********************************************************************
10*/
11#ifndef __CURRENCYAMOUNT_H__
12#define __CURRENCYAMOUNT_H__
13
14#include "unicode/utypes.h"
15
16#if !UCONFIG_NO_FORMATTING
17
18#include "unicode/measure.h"
19#include "unicode/currunit.h"
20
73c04bcf
A
21/**
22 * \file
23 * \brief C++ API: Currency Amount Object.
24 */
25
374ca955
A
26U_NAMESPACE_BEGIN
27
28/**
73c04bcf 29 *
374ca955
A
30 * A currency together with a numeric amount, such as 200 USD.
31 *
32 * @author Alan Liu
73c04bcf 33 * @stable ICU 3.0
374ca955
A
34 */
35class U_I18N_API CurrencyAmount: public Measure {
36 public:
37 /**
38 * Construct an object with the given numeric amount and the given
39 * ISO currency code.
40 * @param amount a numeric object; amount.isNumeric() must be TRUE
41 * @param isoCode the 3-letter ISO 4217 currency code; must not be
42 * NULL and must have length 3
43 * @param ec input-output error code. If the amount or the isoCode
44 * is invalid, then this will be set to a failing value.
73c04bcf 45 * @stable ICU 3.0
374ca955
A
46 */
47 CurrencyAmount(const Formattable& amount, const UChar* isoCode,
48 UErrorCode &ec);
49
50 /**
51 * Construct an object with the given numeric amount and the given
52 * ISO currency code.
53 * @param amount the amount of the given currency
54 * @param isoCode the 3-letter ISO 4217 currency code; must not be
55 * NULL and must have length 3
56 * @param ec input-output error code. If the isoCode is invalid,
57 * then this will be set to a failing value.
73c04bcf 58 * @stable ICU 3.0
374ca955
A
59 */
60 CurrencyAmount(double amount, const UChar* isoCode,
61 UErrorCode &ec);
62
63 /**
64 * Copy constructor
73c04bcf 65 * @stable ICU 3.0
374ca955
A
66 */
67 CurrencyAmount(const CurrencyAmount& other);
68
69 /**
70 * Assignment operator
73c04bcf 71 * @stable ICU 3.0
374ca955
A
72 */
73 CurrencyAmount& operator=(const CurrencyAmount& other);
74
75 /**
76 * Return a polymorphic clone of this object. The result will
77 * have the same class as returned by getDynamicClassID().
73c04bcf 78 * @stable ICU 3.0
374ca955
A
79 */
80 virtual UObject* clone() const;
81
82 /**
83 * Destructor
73c04bcf 84 * @stable ICU 3.0
374ca955
A
85 */
86 virtual ~CurrencyAmount();
87
88 /**
89 * Returns a unique class ID for this object POLYMORPHICALLY.
90 * This method implements a simple form of RTTI used by ICU.
91 * @return The class ID for this object. All objects of a given
92 * class have the same class ID. Objects of other classes have
93 * different class IDs.
73c04bcf 94 * @stable ICU 3.0
374ca955
A
95 */
96 virtual UClassID getDynamicClassID() const;
97
98 /**
99 * Returns the class ID for this class. This is used to compare to
100 * the return value of getDynamicClassID().
101 * @return The class ID for all objects of this class.
73c04bcf 102 * @stable ICU 3.0
374ca955
A
103 */
104 static UClassID U_EXPORT2 getStaticClassID();
105
106 /**
107 * Return the currency unit object of this object.
73c04bcf 108 * @stable ICU 3.0
374ca955
A
109 */
110 inline const CurrencyUnit& getCurrency() const;
111
112 /**
113 * Return the ISO currency code of this object.
73c04bcf 114 * @stable ICU 3.0
374ca955
A
115 */
116 inline const UChar* getISOCurrency() const;
117};
118
119inline const CurrencyUnit& CurrencyAmount::getCurrency() const {
120 return (const CurrencyUnit&) getUnit();
121}
122
123inline const UChar* CurrencyAmount::getISOCurrency() const {
124 return getCurrency().getISOCurrency();
125}
126
127U_NAMESPACE_END
128
129#endif // !UCONFIG_NO_FORMATTING
130#endif // __CURRENCYAMOUNT_H__