1 // © 2017 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
4 *******************************************************************************
5 * Copyright (C) 2009-2017, International Business Machines Corporation, *
6 * Google, and others. All Rights Reserved. *
7 *******************************************************************************
13 #include "unicode/utypes.h"
15 #if U_SHOW_CPLUSPLUS_API
17 #if !UCONFIG_NO_FORMATTING
19 #include "unicode/measunit.h"
23 * \brief C++ API: units for percent and permille
29 * Dimensionless unit for percent and permille.
30 * Prior to ICU 68, this namespace was a class with the same name.
31 * @see NumberFormatter
36 * Returns an instance for the base unit (dimensionless and no scaling).
38 * Prior to ICU 68, this function returned a NoUnit by value.
40 * Since ICU 68, this function returns the same value as the default MeasureUnit constructor.
42 * @return a MeasureUnit instance
45 static inline MeasureUnit U_EXPORT2 base() {
50 * Returns an instance for percent, or 1/100 of a base unit.
52 * Prior to ICU 68, this function returned a NoUnit by value.
54 * Since ICU 68, this function returns the same value as MeasureUnit::getPercent().
56 * @return a MeasureUnit instance
59 static inline MeasureUnit U_EXPORT2 percent() {
60 return MeasureUnit::getPercent();
64 * Returns an instance for permille, or 1/1000 of a base unit.
66 * Prior to ICU 68, this function returned a NoUnit by value.
68 * Since ICU 68, this function returns the same value as MeasureUnit::getPermille().
70 * @return a MeasureUnit instance
73 static inline MeasureUnit U_EXPORT2 permille() {
74 return MeasureUnit::getPermille();
80 #endif /* #if !UCONFIG_NO_FORMATTING */
82 #endif /* U_SHOW_CPLUSPLUS_API */
84 #endif // __NOUNIT_H__