ICU 75.1 75.1
Loading...
Searching...
No Matches
unumberrangeformatter.h
Go to the documentation of this file.
1// © 2020 and later: Unicode, Inc. and others.
2// License & terms of use: http://www.unicode.org/copyright.html
3
4#ifndef __UNUMBERRANGEFORMATTER_H__
5#define __UNUMBERRANGEFORMATTER_H__
6
7#include "unicode/utypes.h"
8
9#if !UCONFIG_NO_FORMATTING
10
11#include "unicode/parseerr.h"
13#include "unicode/umisc.h"
16
17
117
157
199
200
210
211
221
222
246 const UChar* skeleton,
247 int32_t skeletonLen,
248 UNumberRangeCollapse collapse,
249 UNumberRangeIdentityFallback identityFallback,
250 const char* locale,
251 UParseError* perror,
252 UErrorCode* ec);
253
254
265
266
282U_CAPI void U_EXPORT2
284 const UNumberRangeFormatter* uformatter,
285 double first,
286 double second,
287 UFormattedNumberRange* uresult,
288 UErrorCode* ec);
289
290
310U_CAPI void U_EXPORT2
312 const UNumberRangeFormatter* uformatter,
313 const char* first,
314 int32_t firstLen,
315 const char* second,
316 int32_t secondLen,
317 UFormattedNumberRange* uresult,
318 UErrorCode* ec);
319
320
335U_CAPI const UFormattedValue* U_EXPORT2
337
338
351 const UFormattedNumberRange* uresult,
352 UErrorCode* ec);
353
354
374U_CAPI int32_t U_EXPORT2
376 const UFormattedNumberRange* uresult,
377 char* dest,
378 int32_t destCapacity,
379 UErrorCode* ec);
380
381
401U_CAPI int32_t U_EXPORT2
403 const UFormattedNumberRange* uresult,
404 char* dest,
405 int32_t destCapacity,
406 UErrorCode* ec);
407
408
415U_CAPI void U_EXPORT2
417
418
425U_CAPI void U_EXPORT2
427
428
429#if U_SHOW_CPLUSPLUS_API
430U_NAMESPACE_BEGIN
431
449
465U_DEFINE_LOCAL_OPEN_POINTER(LocalUFormattedNumberRangePointer, UFormattedNumberRange, unumrf_closeResult);
466
467U_NAMESPACE_END
468#endif // U_SHOW_CPLUSPLUS_API
469
470#endif /* #if !UCONFIG_NO_FORMATTING */
471#endif //__UNUMBERRANGEFORMATTER_H__
"Smart pointer" class; closes a UNumberFormatter via unumf_close().
#define U_DEFINE_LOCAL_OPEN_POINTER(LocalPointerClassName, Type, closeFunction)
"Smart pointer" definition macro, deletes objects via the closeFunction.
C API: Parse Error Information.
A UParseError struct is used to returned detailed information about parsing errors.
Definition parseerr.h:58
C API: UFieldPositionIterator for use with format APIs.
C API: UFormattable is a thin wrapper for primitive types used for formatting and parsing.
C API: Abstract operations for localized strings.
struct UFormattedValue UFormattedValue
An abstract formatted value: a string with associated field attributes.
#define U_CAPI
This is used to declare a function as a public ICU C API.
Definition umachine.h:110
char16_t UChar
The base type for UTF-16 code units and pointers.
Definition umachine.h:378
C API: Miscellaneous definitions.
UNumberRangeIdentityResult
Used in the result class FormattedNumberRange to indicate to the user whether the numbers formatted i...
@ UNUM_IDENTITY_RESULT_EQUAL_BEFORE_ROUNDING
Used to indicate that the two numbers in the range were equal, even before any rounding rules were ap...
@ UNUM_IDENTITY_RESULT_NOT_EQUAL
Used to indicate that the two numbers in the range were not equal, even after rounding rules were app...
@ UNUM_IDENTITY_RESULT_EQUAL_AFTER_ROUNDING
Used to indicate that the two numbers in the range were equal, but only after rounding rules were app...
@ UNUM_IDENTITY_RESULT_COUNT
The number of entries in this enum.
U_CAPI void unumrf_formatDoubleRange(const UNumberRangeFormatter *uformatter, double first, double second, UFormattedNumberRange *uresult, UErrorCode *ec)
Uses a UNumberRangeFormatter to format a range of doubles.
U_CAPI int32_t unumrf_resultGetFirstDecimalNumber(const UFormattedNumberRange *uresult, char *dest, int32_t destCapacity, UErrorCode *ec)
Extracts the first formatted number as a decimal number.
U_CAPI UNumberRangeFormatter * unumrf_openForSkeletonWithCollapseAndIdentityFallback(const UChar *skeleton, int32_t skeletonLen, UNumberRangeCollapse collapse, UNumberRangeIdentityFallback identityFallback, const char *locale, UParseError *perror, UErrorCode *ec)
Creates a new UNumberFormatter for the given skeleton string, collapse option, identity fallback opti...
U_CAPI UFormattedNumberRange * unumrf_openResult(UErrorCode *ec)
Creates an object to hold the result of a UNumberRangeFormatter operation.
U_CAPI void unumrf_closeResult(UFormattedNumberRange *uresult)
Releases the UFormattedNumber created by unumf_openResult().
UNumberRangeIdentityFallback
Defines the behavior when the two numbers in the range are identical after rounding.
@ UNUM_IDENTITY_FALLBACK_APPROXIMATELY
Show the number using a locale-sensitive approximation pattern.
@ UNUM_IDENTITY_FALLBACK_APPROXIMATELY_OR_SINGLE_VALUE
Show the number using a locale-sensitive approximation pattern.
@ UNUM_IDENTITY_FALLBACK_SINGLE_VALUE
Show the number as a single value rather than a range.
@ UNUM_IDENTITY_FALLBACK_RANGE
Show the number as the range of two equal values.
U_CAPI void unumrf_close(UNumberRangeFormatter *uformatter)
Releases the UNumberFormatter created by unumf_openForSkeletonAndLocale().
struct UFormattedNumberRange UFormattedNumberRange
C-compatible version of icu::number::FormattedNumberRange.
U_CAPI UNumberRangeIdentityResult unumrf_resultGetIdentityResult(const UFormattedNumberRange *uresult, UErrorCode *ec)
Extracts the identity result from a UFormattedNumberRange.
U_CAPI void unumrf_formatDecimalRange(const UNumberRangeFormatter *uformatter, const char *first, int32_t firstLen, const char *second, int32_t secondLen, UFormattedNumberRange *uresult, UErrorCode *ec)
Uses a UNumberRangeFormatter to format a range of decimal numbers.
UNumberRangeCollapse
Defines how to merge fields that are identical across the range sign.
@ UNUM_RANGE_COLLAPSE_ALL
Collapse any field that is equal across the range sign.
@ UNUM_RANGE_COLLAPSE_AUTO
Use locale data and heuristics to determine how much of the string to collapse.
@ UNUM_RANGE_COLLAPSE_UNIT
Collapse the unit part of the number, but not the notation, if present.
@ UNUM_RANGE_COLLAPSE_NONE
Do not collapse any part of the number.
U_CAPI int32_t unumrf_resultGetSecondDecimalNumber(const UFormattedNumberRange *uresult, char *dest, int32_t destCapacity, UErrorCode *ec)
Extracts the second formatted number as a decimal number.
struct UNumberRangeFormatter UNumberRangeFormatter
C-compatible version of icu::number::LocalizedNumberRangeFormatter.
U_CAPI const UFormattedValue * unumrf_resultAsValue(const UFormattedNumberRange *uresult, UErrorCode *ec)
Returns a representation of a UFormattedNumberRange as a UFormattedValue, which can be subsequently p...
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition utypes.h:415