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