ICU 74.1 74.1

uformattednumber.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 __UFORMATTEDNUMBER_H__
5 #define __UFORMATTEDNUMBER_H__
6
7 #include "unicode/utypes.h"
8
9 #if !UCONFIG_NO_FORMATTING
10
11 #include "unicode/ufieldpositer.h"
12 #include "unicode/uformattedvalue.h"
13 #include "unicode/umisc.h"
14
35 struct UFormattedNumber;
43 typedef struct UFormattedNumber UFormattedNumber;
44
45
54 U_CAPI UFormattedNumber* U_EXPORT2
55 unumf_openResult(UErrorCode* ec);
56
57
72 U_CAPI const UFormattedValue* U_EXPORT2
73 unumf_resultAsValue(const UFormattedNumber* uresult, UErrorCode* ec);
74
75
95 U_CAPI int32_t U_EXPORT2
96 unumf_resultToString(const UFormattedNumber* uresult, UChar* buffer, int32_t bufferCapacity,
97 UErrorCode* ec);
98
99
133 U_CAPI UBool U_EXPORT2
134 unumf_resultNextFieldPosition(const UFormattedNumber* uresult, UFieldPosition* ufpos, UErrorCode* ec);
135
136
158 U_CAPI void U_EXPORT2
159 unumf_resultGetAllFieldPositions(const UFormattedNumber* uresult, UFieldPositionIterator* ufpositer,
160 UErrorCode* ec);
161
162
181 U_CAPI int32_t U_EXPORT2
182 unumf_resultToDecimalNumber(
183 const UFormattedNumber* uresult,
184 char* dest,
185 int32_t destCapacity,
186 UErrorCode* ec);
187
188
195 U_CAPI void U_EXPORT2
196 unumf_closeResult(UFormattedNumber* uresult);
197
198
199 #if U_SHOW_CPLUSPLUS_API
200 U_NAMESPACE_BEGIN
201
217 U_DEFINE_LOCAL_OPEN_POINTER(LocalUFormattedNumberPointer, UFormattedNumber, unumf_closeResult);
218
219 U_NAMESPACE_END
220 #endif // U_SHOW_CPLUSPLUS_API
221
222
223 #endif /* #if !UCONFIG_NO_FORMATTING */
224 #endif //__UFORMATTEDNUMBER_H__
LocalUFormattedNumberPointer
"Smart pointer" class; closes a UFormattedNumber via unumf_closeResult().
Definition: unumberrangeformatter.h:448
U_DEFINE_LOCAL_OPEN_POINTER
#define U_DEFINE_LOCAL_OPEN_POINTER(LocalPointerClassName, Type, closeFunction)
"Smart pointer" definition macro, deletes objects via the closeFunction.
Definition: localpointer.h:550
UFieldPosition
A struct representing a range of text containing a specific field.
Definition: umisc.h:34
ufieldpositer.h
C API: UFieldPositionIterator for use with format APIs.
UFieldPositionIterator
struct UFieldPositionIterator UFieldPositionIterator
C typedef for struct UFieldPositionIterator.
Definition: ufieldpositer.h:46
unumf_resultAsValue
U_CAPI const UFormattedValue * unumf_resultAsValue(const UFormattedNumber *uresult, UErrorCode *ec)
Returns a representation of a UFormattedNumber as a UFormattedValue, which can be subsequently passed...
unumf_closeResult
U_CAPI void unumf_closeResult(UFormattedNumber *uresult)
Releases the UFormattedNumber created by unumf_openResult().
UFormattedNumber
struct UFormattedNumber UFormattedNumber
C-compatible version of icu::number::FormattedNumber.
Definition: uformattednumber.h:43
unumf_openResult
U_CAPI UFormattedNumber * unumf_openResult(UErrorCode *ec)
Creates an object to hold the result of a UNumberFormatter operation.
unumf_resultToDecimalNumber
U_CAPI int32_t unumf_resultToDecimalNumber(const UFormattedNumber *uresult, char *dest, int32_t destCapacity, UErrorCode *ec)
Extracts the formatted number as a "numeric string" conforming to the syntax defined in the Decimal A...
unumf_resultToString
U_CAPI int32_t unumf_resultToString(const UFormattedNumber *uresult, UChar *buffer, int32_t bufferCapacity, UErrorCode *ec)
Extracts the result number string out of a UFormattedNumber to a UChar buffer if possible.
unumf_resultNextFieldPosition
U_CAPI UBool unumf_resultNextFieldPosition(const UFormattedNumber *uresult, UFieldPosition *ufpos, UErrorCode *ec)
Determines the start and end indices of the next occurrence of the given field in the output string.
unumf_resultGetAllFieldPositions
U_CAPI void unumf_resultGetAllFieldPositions(const UFormattedNumber *uresult, UFieldPositionIterator *ufpositer, UErrorCode *ec)
Populates the given iterator with all fields in the formatted output string.
uformattedvalue.h
C API: Abstract operations for localized strings.
UFormattedValue
struct UFormattedValue UFormattedValue
An abstract formatted value: a string with associated field attributes.
Definition: uformattedvalue.h:368
UBool
int8_t UBool
The ICU boolean type, a signed-byte integer.
Definition: umachine.h:247
U_CAPI
#define U_CAPI
This is used to declare a function as a public ICU C API.
Definition: umachine.h:110
UChar
char16_t UChar
The base type for UTF-16 code units and pointers.
Definition: umachine.h:386
umisc.h
C API: Miscellaneous definitions.
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition: utypes.h:415