Debian Codegraph @

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

raw
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 /**
22 * \file
23 * \brief C++ API: units for percent and permille
24 */
25
26 U_NAMESPACE_BEGIN
27
28 /**
29 * Dimensionless unit for percent and permille.
30 * Prior to ICU 68, this namespace was a class with the same name.
31 * @see NumberFormatter
32 * @stable ICU 68
33 */
34 namespace NoUnit {
35 /**
36 * Returns an instance for the base unit (dimensionless and no scaling).
37 *
38 * Prior to ICU 68, this function returned a NoUnit by value.
39 *
40 * Since ICU 68, this function returns the same value as the default MeasureUnit constructor.
41 *
42 * @return a MeasureUnit instance
43 * @stable ICU 68
44 */
45 static inline MeasureUnit U_EXPORT2 base() {
46 return {};
47 }
48
49 /**
50 * Returns an instance for percent, or 1/100 of a base unit.
51 *
52 * Prior to ICU 68, this function returned a NoUnit by value.
53 *
54 * Since ICU 68, this function returns the same value as MeasureUnit::getPercent().
55 *
56 * @return a MeasureUnit instance
57 * @stable ICU 68
58 */
59 static inline MeasureUnit U_EXPORT2 percent() {
60 return MeasureUnit::getPercent();
61 }
62
63 /**
64 * Returns an instance for permille, or 1/1000 of a base unit.
65 *
66 * Prior to ICU 68, this function returned a NoUnit by value.
67 *
68 * Since ICU 68, this function returns the same value as MeasureUnit::getPermille().
69 *
70 * @return a MeasureUnit instance
71 * @stable ICU 68
72 */
73 static inline MeasureUnit U_EXPORT2 permille() {
74 return MeasureUnit::getPermille();
75 }
76 }
77
78 U_NAMESPACE_END
79
80 #endif /* #if !UCONFIG_NO_FORMATTING */
81
82 #endif /* U_SHOW_CPLUSPLUS_API */
83
84 #endif // __NOUNIT_H__
85 //eof
86 //