ICU 69.1 69.1
uformattedvalue.h
Go to the documentation of this file.
1// © 2018 and later: Unicode, Inc. and others.
2// License & terms of use: http://www.unicode.org/copyright.html
3
4#ifndef __UFORMATTEDVALUE_H__
5#define __UFORMATTEDVALUE_H__
6
7#include "unicode/utypes.h"
8
9#if !UCONFIG_NO_FORMATTING
10
12
34typedef enum UFieldCategory {
41
48
55
62
69
76
77#ifndef U_HIDE_INTERNAL_API
80#endif /* U_HIDE_INTERNAL_API */
81
88
95
96#ifndef U_HIDE_DRAFT_API
103#endif // U_HIDE_DRAFT_API
104
106
107
121
122
134
135
145U_CAPI void U_EXPORT2
148 UErrorCode* ec);
149
150
157U_CAPI void U_EXPORT2
159
160
186U_CAPI void U_EXPORT2
189 int32_t category,
190 UErrorCode* ec);
191
192
219U_CAPI void U_EXPORT2
222 int32_t category,
223 int32_t field,
224 UErrorCode* ec);
225
226
239U_CAPI int32_t U_EXPORT2
241 const UConstrainedFieldPosition* ucfpos,
242 UErrorCode* ec);
243
244
257U_CAPI int32_t U_EXPORT2
259 const UConstrainedFieldPosition* ucfpos,
260 UErrorCode* ec);
261
262
274U_CAPI void U_EXPORT2
276 const UConstrainedFieldPosition* ucfpos,
277 int32_t* pStart,
278 int32_t* pLimit,
279 UErrorCode* ec);
280
281
294U_CAPI int64_t U_EXPORT2
296 const UConstrainedFieldPosition* ucfpos,
297 UErrorCode* ec);
298
299
310U_CAPI void U_EXPORT2
313 int64_t context,
314 UErrorCode* ec);
315
316
329U_CAPI UBool U_EXPORT2
331 const UConstrainedFieldPosition* ucfpos,
332 int32_t category,
333 int32_t field,
334 UErrorCode* ec);
335
336
353U_CAPI void U_EXPORT2
356 int32_t category,
357 int32_t field,
358 int32_t start,
359 int32_t limit,
360 UErrorCode* ec);
361
362
363struct UFormattedValue;
371
372
386U_CAPI const UChar* U_EXPORT2
388 const UFormattedValue* ufmtval,
389 int32_t* pLength,
390 UErrorCode* ec);
391
392
416U_CAPI UBool U_EXPORT2
418 const UFormattedValue* ufmtval,
420 UErrorCode* ec);
421
422
423#if U_SHOW_CPLUSPLUS_API
424U_NAMESPACE_BEGIN
425
441
442U_NAMESPACE_END
443#endif // U_SHOW_CPLUSPLUS_API
444
445
446#endif /* #if !UCONFIG_NO_FORMATTING */
447#endif // __UFORMATTEDVALUE_H__
"Smart pointer" class; closes a UConstrainedFieldPosition via ucfpos_close().
#define U_DEFINE_LOCAL_OPEN_POINTER(LocalPointerClassName, Type, closeFunction)
"Smart pointer" definition macro, deletes objects via the closeFunction.
Definition: localpointer.h:550
C API: UFieldPositionIterator for use with format APIs.
U_CAPI void ucfpos_constrainCategory(UConstrainedFieldPosition *ucfpos, int32_t category, UErrorCode *ec)
Sets a constraint on the field category.
U_CAPI void ucfpos_constrainField(UConstrainedFieldPosition *ucfpos, int32_t category, int32_t field, UErrorCode *ec)
Sets a constraint on the category and field.
U_CAPI void ucfpos_getIndexes(const UConstrainedFieldPosition *ucfpos, int32_t *pStart, int32_t *pLimit, UErrorCode *ec)
Gets the INCLUSIVE start and EXCLUSIVE end index stored for the current position.
UFieldCategory
All possible field categories in ICU.
@ UFIELD_CATEGORY_DATE_INTERVAL
Reserved for possible future fields in UDateIntervalFormatField.
@ UFIELD_CATEGORY_DATE_INTERVAL_SPAN
Category for spans in a date interval.
@ UFIELD_CATEGORY_DATE
For fields in UDateFormatField (udat.h), from ICU 3.0.
@ UFIELD_CATEGORY_LIST_SPAN
Category for spans in a list.
@ UFIELD_CATEGORY_RELATIVE_DATETIME
For fields in URelativeDateTimeFormatterField (ureldatefmt.h), from ICU 64.
@ UFIELD_CATEGORY_UNDEFINED
For an undefined field category.
@ UFIELD_CATEGORY_LIST
For fields in UListFormatterField (ulistformatter.h), from ICU 63.
@ UFIELD_CATEGORY_NUMBER_RANGE_SPAN
Category for spans in a number range.
@ UFIELD_CATEGORY_COUNT
@ UFIELD_CATEGORY_NUMBER
For fields in UNumberFormatFields (unum.h), from ICU 49.
U_CAPI void ucfpos_close(UConstrainedFieldPosition *ucfpos)
Destroys a UConstrainedFieldPosition and releases its memory.
struct UConstrainedFieldPosition UConstrainedFieldPosition
Represents a span of a string containing a given field.
U_CAPI UConstrainedFieldPosition * ucfpos_open(UErrorCode *ec)
Creates a new UConstrainedFieldPosition.
U_CAPI void ucfpos_reset(UConstrainedFieldPosition *ucfpos, UErrorCode *ec)
Resets a UConstrainedFieldPosition to its initial state, as if it were newly created.
U_CAPI UBool ucfpos_matchesField(const UConstrainedFieldPosition *ucfpos, int32_t category, int32_t field, UErrorCode *ec)
Determines whether a given field should be included given the constraints.
U_CAPI int32_t ucfpos_getCategory(const UConstrainedFieldPosition *ucfpos, UErrorCode *ec)
Gets the field category for the current position.
U_CAPI void ucfpos_setState(UConstrainedFieldPosition *ucfpos, int32_t category, int32_t field, int32_t start, int32_t limit, UErrorCode *ec)
Sets new values for the primary public getters.
U_CAPI int32_t ucfpos_getField(const UConstrainedFieldPosition *ucfpos, UErrorCode *ec)
Gets the field for the current position.
U_CAPI const UChar * ufmtval_getString(const UFormattedValue *ufmtval, int32_t *pLength, UErrorCode *ec)
Returns a pointer to the formatted string.
U_CAPI int64_t ucfpos_getInt64IterationContext(const UConstrainedFieldPosition *ucfpos, UErrorCode *ec)
Gets an int64 that FormattedValue implementations may use for storage.
U_CAPI UBool ufmtval_nextPosition(const UFormattedValue *ufmtval, UConstrainedFieldPosition *ucfpos, UErrorCode *ec)
Iterates over field positions in the UFormattedValue.
struct UFormattedValue UFormattedValue
An abstract formatted value: a string with associated field attributes.
U_CAPI void ucfpos_setInt64IterationContext(UConstrainedFieldPosition *ucfpos, int64_t context, UErrorCode *ec)
Sets an int64 that FormattedValue implementations may use for storage.
int8_t UBool
The ICU boolean type, a signed-byte integer.
Definition: umachine.h:269
#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:418
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition: utypes.h:415