Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/unicode/currunit.h
Line
Count
Source (jump to first uncovered line)
1
// © 2016 and later: Unicode, Inc. and others.
2
// License & terms of use: http://www.unicode.org/copyright.html
3
/*
4
**********************************************************************
5
* Copyright (c) 2004-2014, International Business Machines
6
* Corporation and others.  All Rights Reserved.
7
**********************************************************************
8
* Author: Alan Liu
9
* Created: April 26, 2004
10
* Since: ICU 3.0
11
**********************************************************************
12
*/
13
#ifndef __CURRENCYUNIT_H__
14
#define __CURRENCYUNIT_H__
15
16
#include "unicode/utypes.h"
17
18
#if !UCONFIG_NO_FORMATTING
19
20
#include "unicode/measunit.h"
21
22
/**
23
 * \file 
24
 * \brief C++ API: Currency Unit Information.
25
 */
26
 
27
U_NAMESPACE_BEGIN
28
29
/**
30
 * A unit of currency, such as USD (U.S. dollars) or JPY (Japanese
31
 * yen).  This class is a thin wrapper over a char16_t string that
32
 * subclasses MeasureUnit, for use with Measure and MeasureFormat.
33
 *
34
 * @author Alan Liu
35
 * @stable ICU 3.0
36
 */
37
class U_I18N_API CurrencyUnit: public MeasureUnit {
38
 public:
39
    /**
40
     * Default constructor.  Initializes currency code to "XXX" (no currency).
41
     * @draft ICU 60
42
     */
43
    CurrencyUnit();
44
45
    /**
46
     * Construct an object with the given ISO currency code.
47
     * @param isoCode the 3-letter ISO 4217 currency code; must have
48
     * length 3 and need not be NUL-terminated. If NULL, the currency
49
     * is initialized to the unknown currency XXX.
50
     * @param ec input-output error code. If the isoCode is invalid,
51
     * then this will be set to a failing value.
52
     * @stable ICU 3.0
53
     */
54
    CurrencyUnit(ConstChar16Ptr isoCode, UErrorCode &ec);
55
56
    /**
57
     * Copy constructor
58
     * @stable ICU 3.0
59
     */
60
    CurrencyUnit(const CurrencyUnit& other);
61
62
#ifndef U_HIDE_DRAFT_API
63
    /**
64
     * Copy constructor from MeasureUnit. This constructor allows you to
65
     * restore a CurrencyUnit that was sliced to MeasureUnit.
66
     *
67
     * @param measureUnit The MeasureUnit to copy from.
68
     * @param ec Set to a failing value if the MeasureUnit is not a currency.
69
     * @draft ICU 60
70
     */
71
    CurrencyUnit(const MeasureUnit& measureUnit, UErrorCode &ec);
72
#endif  /* U_HIDE_DRAFT_API */
73
74
    /**
75
     * Assignment operator
76
     * @stable ICU 3.0
77
     */
78
    CurrencyUnit& operator=(const CurrencyUnit& other);
79
80
    /**
81
     * Return a polymorphic clone of this object.  The result will
82
     * have the same class as returned by getDynamicClassID().
83
     * @stable ICU 3.0
84
     */
85
    virtual UObject* clone() const;
86
87
    /**
88
     * Destructor
89
     * @stable ICU 3.0
90
     */
91
    virtual ~CurrencyUnit();
92
93
    /**
94
     * Returns a unique class ID for this object POLYMORPHICALLY.
95
     * This method implements a simple form of RTTI used by ICU.
96
     * @return The class ID for this object. All objects of a given
97
     * class have the same class ID.  Objects of other classes have
98
     * different class IDs.
99
     * @stable ICU 3.0
100
     */
101
    virtual UClassID getDynamicClassID() const;
102
103
    /**
104
     * Returns the class ID for this class. This is used to compare to
105
     * the return value of getDynamicClassID().
106
     * @return The class ID for all objects of this class.
107
     * @stable ICU 3.0
108
     */
109
    static UClassID U_EXPORT2 getStaticClassID();
110
111
    /**
112
     * Return the ISO currency code of this object.
113
     * @stable ICU 3.0
114
     */
115
    inline const char16_t* getISOCurrency() const;
116
117
 private:
118
    /**
119
     * The ISO 4217 code of this object.
120
     */
121
    char16_t isoCode[4];
122
};
123
124
0
inline const char16_t* CurrencyUnit::getISOCurrency() const {
125
0
    return isoCode;
126
0
}
127
128
U_NAMESPACE_END
129
130
#endif // !UCONFIG_NO_FORMATTING
131
#endif // __CURRENCYUNIT_H__