intl/icu/source/i18n/unicode/curramt.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/intl/icu/source/i18n/unicode/curramt.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,130 @@
     1.4 +/*
     1.5 +**********************************************************************
     1.6 +* Copyright (c) 2004-2006, International Business Machines
     1.7 +* Corporation and others.  All Rights Reserved.
     1.8 +**********************************************************************
     1.9 +* Author: Alan Liu
    1.10 +* Created: April 26, 2004
    1.11 +* Since: ICU 3.0
    1.12 +**********************************************************************
    1.13 +*/
    1.14 +#ifndef __CURRENCYAMOUNT_H__
    1.15 +#define __CURRENCYAMOUNT_H__
    1.16 +
    1.17 +#include "unicode/utypes.h"
    1.18 +
    1.19 +#if !UCONFIG_NO_FORMATTING
    1.20 +
    1.21 +#include "unicode/measure.h"
    1.22 +#include "unicode/currunit.h"
    1.23 +
    1.24 +/**
    1.25 + * \file 
    1.26 + * \brief C++ API: Currency Amount Object.
    1.27 + */
    1.28 + 
    1.29 +U_NAMESPACE_BEGIN
    1.30 +
    1.31 +/**
    1.32 + *
    1.33 + * A currency together with a numeric amount, such as 200 USD.
    1.34 + *
    1.35 + * @author Alan Liu
    1.36 + * @stable ICU 3.0
    1.37 + */
    1.38 +class U_I18N_API CurrencyAmount: public Measure {
    1.39 + public:
    1.40 +    /**
    1.41 +     * Construct an object with the given numeric amount and the given
    1.42 +     * ISO currency code.
    1.43 +     * @param amount a numeric object; amount.isNumeric() must be TRUE
    1.44 +     * @param isoCode the 3-letter ISO 4217 currency code; must not be
    1.45 +     * NULL and must have length 3
    1.46 +     * @param ec input-output error code. If the amount or the isoCode
    1.47 +     * is invalid, then this will be set to a failing value.
    1.48 +     * @stable ICU 3.0
    1.49 +     */
    1.50 +    CurrencyAmount(const Formattable& amount, const UChar* isoCode,
    1.51 +                   UErrorCode &ec);
    1.52 +
    1.53 +    /**
    1.54 +     * Construct an object with the given numeric amount and the given
    1.55 +     * ISO currency code.
    1.56 +     * @param amount the amount of the given currency
    1.57 +     * @param isoCode the 3-letter ISO 4217 currency code; must not be
    1.58 +     * NULL and must have length 3
    1.59 +     * @param ec input-output error code. If the isoCode is invalid,
    1.60 +     * then this will be set to a failing value.
    1.61 +     * @stable ICU 3.0
    1.62 +     */
    1.63 +    CurrencyAmount(double amount, const UChar* isoCode,
    1.64 +                   UErrorCode &ec);
    1.65 +
    1.66 +    /**
    1.67 +     * Copy constructor
    1.68 +     * @stable ICU 3.0
    1.69 +     */
    1.70 +    CurrencyAmount(const CurrencyAmount& other);
    1.71 + 
    1.72 +    /**
    1.73 +     * Assignment operator
    1.74 +     * @stable ICU 3.0
    1.75 +     */
    1.76 +    CurrencyAmount& operator=(const CurrencyAmount& other);
    1.77 +
    1.78 +    /**
    1.79 +     * Return a polymorphic clone of this object.  The result will
    1.80 +     * have the same class as returned by getDynamicClassID().
    1.81 +     * @stable ICU 3.0
    1.82 +     */
    1.83 +    virtual UObject* clone() const;
    1.84 +
    1.85 +    /**
    1.86 +     * Destructor
    1.87 +     * @stable ICU 3.0
    1.88 +     */
    1.89 +    virtual ~CurrencyAmount();
    1.90 +    
    1.91 +    /**
    1.92 +     * Returns a unique class ID for this object POLYMORPHICALLY.
    1.93 +     * This method implements a simple form of RTTI used by ICU.
    1.94 +     * @return The class ID for this object. All objects of a given
    1.95 +     * class have the same class ID.  Objects of other classes have
    1.96 +     * different class IDs.
    1.97 +     * @stable ICU 3.0
    1.98 +     */
    1.99 +    virtual UClassID getDynamicClassID() const;
   1.100 +
   1.101 +    /**
   1.102 +     * Returns the class ID for this class. This is used to compare to
   1.103 +     * the return value of getDynamicClassID().
   1.104 +     * @return The class ID for all objects of this class.
   1.105 +     * @stable ICU 3.0
   1.106 +     */
   1.107 +    static UClassID U_EXPORT2 getStaticClassID();
   1.108 +
   1.109 +    /**
   1.110 +     * Return the currency unit object of this object.
   1.111 +     * @stable ICU 3.0
   1.112 +     */
   1.113 +    inline const CurrencyUnit& getCurrency() const;
   1.114 +
   1.115 +    /**
   1.116 +     * Return the ISO currency code of this object.
   1.117 +     * @stable ICU 3.0
   1.118 +     */
   1.119 +    inline const UChar* getISOCurrency() const;
   1.120 +};
   1.121 +
   1.122 +inline const CurrencyUnit& CurrencyAmount::getCurrency() const {
   1.123 +    return (const CurrencyUnit&) getUnit();
   1.124 +}
   1.125 +
   1.126 +inline const UChar* CurrencyAmount::getISOCurrency() const {
   1.127 +    return getCurrency().getISOCurrency();
   1.128 +}
   1.129 +
   1.130 +U_NAMESPACE_END
   1.131 +
   1.132 +#endif // !UCONFIG_NO_FORMATTING
   1.133 +#endif // __CURRENCYAMOUNT_H__

mercurial