ICU 75.1 75.1
Loading...
Searching...
No Matches
usimplenumberformatter.h
Go to the documentation of this file.
1// © 2022 and later: Unicode, Inc. and others.
2// License & terms of use: http://www.unicode.org/copyright.html
3
4#ifndef __USIMPLENUMBERFORMATTER_H__
5#define __USIMPLENUMBERFORMATTER_H__
6
7#include "unicode/utypes.h"
8
9#if !UCONFIG_NO_FORMATTING
10
13
78
79
80struct USimpleNumber;
87
88
96
97
103U_CAPI USimpleNumber* U_EXPORT2
104usnum_openForInt64(int64_t value, UErrorCode* ec);
105
106
114U_CAPI void U_EXPORT2
115usnum_setToInt64(USimpleNumber* unumber, int64_t value, UErrorCode* ec);
116
117
125U_CAPI void U_EXPORT2
127
128
137U_CAPI void U_EXPORT2
138usnum_roundTo(USimpleNumber* unumber, int32_t power, UNumberFormatRoundingMode roundingMode, UErrorCode* ec);
139
140
146U_CAPI void U_EXPORT2
147usnum_setMinimumIntegerDigits(USimpleNumber* unumber, int32_t minimumIntegerDigits, UErrorCode* ec);
148
149
155U_CAPI void U_EXPORT2
156usnum_setMinimumFractionDigits(USimpleNumber* unumber, int32_t minimumFractionDigits, UErrorCode* ec);
157
158
159#ifndef U_HIDE_DRAFT_API
165U_CAPI void U_EXPORT2
166usnum_setMaximumIntegerDigits(USimpleNumber* unumber, int32_t maximumIntegerDigits, UErrorCode* ec);
167#endif // U_HIDE_DRAFT_API
168
169
170#ifndef U_HIDE_DEPRECATED_API
177U_CAPI void U_EXPORT2
178usnum_truncateStart(USimpleNumber* unumber, int32_t maximumIntegerDigits, UErrorCode* ec);
179#endif // U_HIDE_DEPRECATED_API
180
181
191U_CAPI void U_EXPORT2
193
194
201usnumf_openForLocale(const char* locale, UErrorCode* ec);
202
203
211 const char* locale, UNumberGroupingStrategy groupingStrategy, UErrorCode* ec);
212
213
222U_CAPI void U_EXPORT2
224 const USimpleNumberFormatter* uformatter,
225 USimpleNumber* unumber,
226 UFormattedNumber* uresult,
227 UErrorCode* ec);
228
229
237U_CAPI void U_EXPORT2
239 const USimpleNumberFormatter* uformatter,
240 int64_t value,
241 UFormattedNumber* uresult,
242 UErrorCode* ec);
243
244
252U_CAPI void U_EXPORT2
254
255
261U_CAPI void U_EXPORT2
263
264
265#if U_SHOW_CPLUSPLUS_API
266U_NAMESPACE_BEGIN
267
287
304
305U_NAMESPACE_END
306#endif // U_SHOW_CPLUSPLUS_API
307
308#endif /* #if !UCONFIG_NO_FORMATTING */
309#endif //__USIMPLENUMBERFORMATTER_H__
"Smart pointer" class; closes a USimpleNumberFormatter via usnumf_close().
"Smart pointer" class; closes a USimpleNumber via usnum_close().
#define U_DEFINE_LOCAL_OPEN_POINTER(LocalPointerClassName, Type, closeFunction)
"Smart pointer" definition macro, deletes objects via the closeFunction.
C API: Formatted number result from various number formatting functions.
struct UFormattedNumber UFormattedNumber
C-compatible version of icu::number::FormattedNumber.
#define U_CAPI
This is used to declare a function as a public ICU C API.
Definition umachine.h:110
C API: Header-only input options for various number formatting APIs.
UNumberFormatRoundingMode
The possible number format rounding modes.
UNumberGroupingStrategy
An enum declaring the strategy for when and how to display grouping separators (i....
USimpleNumberSign
An explicit sign option for a SimpleNumber.
@ UNUM_SIMPLE_NUMBER_MINUS_SIGN
Render a minus sign.
@ UNUM_SIMPLE_NUMBER_NO_SIGN
Render no sign.
@ UNUM_SIMPLE_NUMBER_PLUS_SIGN
Render a plus sign.
U_CAPI USimpleNumberFormatter * usnumf_openForLocale(const char *locale, UErrorCode *ec)
Creates a new USimpleNumberFormatter with all locale defaults.
U_CAPI void usnum_setSign(USimpleNumber *unumber, USimpleNumberSign sign, UErrorCode *ec)
Sets the sign of the number: an explicit plus sign, explicit minus sign, or no sign.
U_CAPI USimpleNumberFormatter * usnumf_openForLocaleAndGroupingStrategy(const char *locale, UNumberGroupingStrategy groupingStrategy, UErrorCode *ec)
Creates a new USimpleNumberFormatter, overriding the grouping strategy.
U_CAPI void usnum_roundTo(USimpleNumber *unumber, int32_t power, UNumberFormatRoundingMode roundingMode, UErrorCode *ec)
Rounds the value currently stored in the USimpleNumber to the given power of 10, which can be before ...
U_CAPI void usnum_truncateStart(USimpleNumber *unumber, int32_t maximumIntegerDigits, UErrorCode *ec)
Alias for setMaximumIntegerDigits.
U_CAPI void usnum_close(USimpleNumber *unumber)
Frees the memory held by a USimpleNumber.
U_CAPI void usnum_setToInt64(USimpleNumber *unumber, int64_t value, UErrorCode *ec)
Overwrites the value in a USimpleNumber to an int64_t.
U_CAPI void usnumf_formatInt64(const USimpleNumberFormatter *uformatter, int64_t value, UFormattedNumber *uresult, UErrorCode *ec)
Formats an integer using this SimpleNumberFormatter.
U_CAPI void usnum_setMaximumIntegerDigits(USimpleNumber *unumber, int32_t maximumIntegerDigits, UErrorCode *ec)
Sets the number of integer digits to the given amount, truncating if necessary.
U_CAPI void usnum_setMinimumIntegerDigits(USimpleNumber *unumber, int32_t minimumIntegerDigits, UErrorCode *ec)
Pads the beginning of the number with zeros up to the given minimum number of integer digits.
struct USimpleNumberFormatter USimpleNumberFormatter
C-compatible version of icu::number::SimpleNumberFormatter.
U_CAPI USimpleNumber * usnum_openForInt64(int64_t value, UErrorCode *ec)
Creates a new USimpleNumber to be formatted with a USimpleNumberFormatter.
U_CAPI void usnumf_close(USimpleNumberFormatter *uformatter)
Frees the memory held by a USimpleNumberFormatter.
U_CAPI void usnumf_format(const USimpleNumberFormatter *uformatter, USimpleNumber *unumber, UFormattedNumber *uresult, UErrorCode *ec)
Formats a number using this SimpleNumberFormatter.
struct USimpleNumber USimpleNumber
C-compatible version of icu::number::SimpleNumber.
U_CAPI void usnum_setMinimumFractionDigits(USimpleNumber *unumber, int32_t minimumFractionDigits, UErrorCode *ec)
Pads the end of the number with zeros up to the given minimum number of fraction digits.
U_CAPI void usnum_multiplyByPowerOfTen(USimpleNumber *unumber, int32_t power, UErrorCode *ec)
Changes the value of the USimpleNumber by a power of 10.
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition utypes.h:415