annotate CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/include/unicode/curramt.h @ 69:33d812a61356

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