1// © 2017 and later: Unicode, Inc. and others.
2// License & terms of use: http://www.unicode.org/copyright.html
3/*
4 *******************************************************************************
5 * Copyright (C) 2009-2017, International Business Machines Corporation, *
6 * Google, and others. All Rights Reserved. *
7 *******************************************************************************
8 */
9
10#ifndef __NOUNIT_H__
11#define __NOUNIT_H__
12
13#include "unicode/utypes.h"
14
15#if U_SHOW_CPLUSPLUS_API
16
17#if !UCONFIG_NO_FORMATTING
18
19#include "unicode/measunit.h"
20
21#ifndef U_HIDE_DRAFT_API
22
23/**
24 * \file
25 * \brief C++ API: units for percent and permille
26 */
27
28U_NAMESPACE_BEGIN
29
30/**
31 * Dimensionless unit for percent and permille.
32 * @see NumberFormatter
33 * @draft ICU 60
34 */
35class U_I18N_API NoUnit: public MeasureUnit {
36public:
37 /**
38 * Returns an instance for the base unit (dimensionless and no scaling).
39 *
40 * @return a NoUnit instance
41 * @draft ICU 60
42 */
43 static NoUnit U_EXPORT2 base();
44
45 /**
46 * Returns an instance for percent, or 1/100 of a base unit.
47 *
48 * @return a NoUnit instance
49 * @draft ICU 60
50 */
51 static NoUnit U_EXPORT2 percent();
52
53 /**
54 * Returns an instance for permille, or 1/1000 of a base unit.
55 *
56 * @return a NoUnit instance
57 * @draft ICU 60
58 */
59 static NoUnit U_EXPORT2 permille();
60
61 /**
62 * Copy operator.
63 * @draft ICU 60
64 */
65 NoUnit(const NoUnit& other);
66
67 /**
68 * Destructor.
69 * @draft ICU 60
70 */
71 virtual ~NoUnit();
72
73 /**
74 * Return a polymorphic clone of this object. The result will
75 * have the same class as returned by getDynamicClassID().
76 * @draft ICU 60
77 */
78 virtual NoUnit* clone() const;
79
80 /**
81 * Returns a unique class ID for this object POLYMORPHICALLY.
82 * This method implements a simple form of RTTI used by ICU.
83 * @return The class ID for this object. All objects of a given
84 * class have the same class ID. Objects of other classes have
85 * different class IDs.
86 * @draft ICU 60
87 */
88 virtual UClassID getDynamicClassID() const;
89
90 /**
91 * Returns the class ID for this class. This is used to compare to
92 * the return value of getDynamicClassID().
93 * @return The class ID for all objects of this class.
94 * @draft ICU 60
95 */
96 static UClassID U_EXPORT2 getStaticClassID();
97
98private:
99 /**
100 * Constructor
101 * @internal (private)
102 */
103 NoUnit(const char* subtype);
104
105};
106
107U_NAMESPACE_END
108
109#endif /* U_HIDE_DRAFT_API */
110#endif /* #if !UCONFIG_NO_FORMATTING */
111
112#endif /* U_SHOW_CPLUSPLUS_API */
113
114#endif // __NOUNIT_H__
115//eof
116//
117