|
||||
File indexing completed on 2025-01-18 10:13:03
0001 // © 2016 and later: Unicode, Inc. and others. 0002 // License & terms of use: http://www.unicode.org/copyright.html 0003 /* 0004 ********************************************************************** 0005 * Copyright (c) 2004-2006, International Business Machines 0006 * Corporation and others. All Rights Reserved. 0007 ********************************************************************** 0008 * Author: Alan Liu 0009 * Created: April 26, 2004 0010 * Since: ICU 3.0 0011 ********************************************************************** 0012 */ 0013 #ifndef __CURRENCYAMOUNT_H__ 0014 #define __CURRENCYAMOUNT_H__ 0015 0016 #include "unicode/utypes.h" 0017 0018 #if U_SHOW_CPLUSPLUS_API 0019 0020 #if !UCONFIG_NO_FORMATTING 0021 0022 #include "unicode/measure.h" 0023 #include "unicode/currunit.h" 0024 0025 /** 0026 * \file 0027 * \brief C++ API: Currency Amount Object. 0028 */ 0029 0030 U_NAMESPACE_BEGIN 0031 0032 /** 0033 * 0034 * A currency together with a numeric amount, such as 200 USD. 0035 * 0036 * @author Alan Liu 0037 * @stable ICU 3.0 0038 */ 0039 class U_I18N_API CurrencyAmount: public Measure { 0040 public: 0041 /** 0042 * Construct an object with the given numeric amount and the given 0043 * ISO currency code. 0044 * @param amount a numeric object; amount.isNumeric() must be true 0045 * @param isoCode the 3-letter ISO 4217 currency code; must not be 0046 * nullptr and must have length 3 0047 * @param ec input-output error code. If the amount or the isoCode 0048 * is invalid, then this will be set to a failing value. 0049 * @stable ICU 3.0 0050 */ 0051 CurrencyAmount(const Formattable& amount, ConstChar16Ptr isoCode, 0052 UErrorCode &ec); 0053 0054 /** 0055 * Construct an object with the given numeric amount and the given 0056 * ISO currency code. 0057 * @param amount the amount of the given currency 0058 * @param isoCode the 3-letter ISO 4217 currency code; must not be 0059 * nullptr and must have length 3 0060 * @param ec input-output error code. If the isoCode is invalid, 0061 * then this will be set to a failing value. 0062 * @stable ICU 3.0 0063 */ 0064 CurrencyAmount(double amount, ConstChar16Ptr isoCode, 0065 UErrorCode &ec); 0066 0067 /** 0068 * Copy constructor 0069 * @stable ICU 3.0 0070 */ 0071 CurrencyAmount(const CurrencyAmount& other); 0072 0073 /** 0074 * Assignment operator 0075 * @stable ICU 3.0 0076 */ 0077 CurrencyAmount& operator=(const CurrencyAmount& other); 0078 0079 /** 0080 * Return a polymorphic clone of this object. The result will 0081 * have the same class as returned by getDynamicClassID(). 0082 * @stable ICU 3.0 0083 */ 0084 virtual CurrencyAmount* clone() const override; 0085 0086 /** 0087 * Destructor 0088 * @stable ICU 3.0 0089 */ 0090 virtual ~CurrencyAmount(); 0091 0092 /** 0093 * Returns a unique class ID for this object POLYMORPHICALLY. 0094 * This method implements a simple form of RTTI used by ICU. 0095 * @return The class ID for this object. All objects of a given 0096 * class have the same class ID. Objects of other classes have 0097 * different class IDs. 0098 * @stable ICU 3.0 0099 */ 0100 virtual UClassID getDynamicClassID() const override; 0101 0102 /** 0103 * Returns the class ID for this class. This is used to compare to 0104 * the return value of getDynamicClassID(). 0105 * @return The class ID for all objects of this class. 0106 * @stable ICU 3.0 0107 */ 0108 static UClassID U_EXPORT2 getStaticClassID(); 0109 0110 /** 0111 * Return the currency unit object of this object. 0112 * @stable ICU 3.0 0113 */ 0114 const CurrencyUnit& getCurrency() const; 0115 0116 /** 0117 * Return the ISO currency code of this object. 0118 * @stable ICU 3.0 0119 */ 0120 inline const char16_t* getISOCurrency() const; 0121 }; 0122 0123 inline const char16_t* CurrencyAmount::getISOCurrency() const { 0124 return getCurrency().getISOCurrency(); 0125 } 0126 0127 U_NAMESPACE_END 0128 0129 #endif // !UCONFIG_NO_FORMATTING 0130 0131 #endif /* U_SHOW_CPLUSPLUS_API */ 0132 0133 #endif // __CURRENCYAMOUNT_H__
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |