ICU 69.1  69.1
udatpg.h
Go to the documentation of this file.
1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /*
4 *******************************************************************************
5 *
6 * Copyright (C) 2007-2015, International Business Machines
7 * Corporation and others. All Rights Reserved.
8 *
9 *******************************************************************************
10 * file name: udatpg.h
11 * encoding: UTF-8
12 * tab size: 8 (not used)
13 * indentation:4
14 *
15 * created on: 2007jul30
16 * created by: Markus W. Scherer
17 */
18 
19 #ifndef __UDATPG_H__
20 #define __UDATPG_H__
21 
22 #include "unicode/utypes.h"
23 #include "unicode/udat.h"
24 #include "unicode/uenum.h"
25 
26 #if U_SHOW_CPLUSPLUS_API
27 #include "unicode/localpointer.h"
28 #endif // U_SHOW_CPLUSPLUS_API
29 
52 
59 typedef enum UDateTimePatternField {
92 
93  /* Do not conditionalize the following with #ifndef U_HIDE_DEPRECATED_API,
94  * it is needed for layout of DateTimePatternGenerator object. */
95 #ifndef U_FORCE_HIDE_DEPRECATED_API
96 
101 #endif // U_FORCE_HIDE_DEPRECATED_API
103 
116 
129 #ifndef U_HIDE_INTERNAL_API
130 
134 #endif /* U_HIDE_INTERNAL_API */
135 
138 
150 #ifndef U_HIDE_DEPRECATED_API
151 
156 #endif // U_HIDE_DEPRECATED_API
158 
168 udatpg_open(const char *locale, UErrorCode *pErrorCode);
169 
178 udatpg_openEmpty(UErrorCode *pErrorCode);
179 
185 U_CAPI void U_EXPORT2
187 
188 #if U_SHOW_CPLUSPLUS_API
189 
190 U_NAMESPACE_BEGIN
191 
202 
203 U_NAMESPACE_END
204 
205 #endif
206 
216 udatpg_clone(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode);
217 
241 U_CAPI int32_t U_EXPORT2
243  const UChar *skeleton, int32_t length,
244  UChar *bestPattern, int32_t capacity,
245  UErrorCode *pErrorCode);
246 
277 U_CAPI int32_t U_EXPORT2
279  const UChar *skeleton, int32_t length,
281  UChar *bestPattern, int32_t capacity,
282  UErrorCode *pErrorCode);
283 
305 U_CAPI int32_t U_EXPORT2
307  const UChar *pattern, int32_t length,
308  UChar *skeleton, int32_t capacity,
309  UErrorCode *pErrorCode);
310 
335 U_CAPI int32_t U_EXPORT2
337  const UChar *pattern, int32_t length,
338  UChar *baseSkeleton, int32_t capacity,
339  UErrorCode *pErrorCode);
340 
367  const UChar *pattern, int32_t patternLength,
368  UBool override,
369  UChar *conflictingPattern, int32_t capacity, int32_t *pLength,
370  UErrorCode *pErrorCode);
371 
392 U_CAPI void U_EXPORT2
394  UDateTimePatternField field,
395  const UChar *value, int32_t length);
396 
407 U_CAPI const UChar * U_EXPORT2
409  UDateTimePatternField field,
410  int32_t *pLength);
411 
425 U_CAPI void U_EXPORT2
427  UDateTimePatternField field,
428  const UChar *value, int32_t length);
429 
442 U_CAPI const UChar * U_EXPORT2
444  UDateTimePatternField field,
445  int32_t *pLength);
446 
472 U_CAPI int32_t U_EXPORT2
474  UDateTimePatternField field,
476  UChar *fieldName, int32_t capacity,
477  UErrorCode *pErrorCode);
478 
502 U_CAPI void U_EXPORT2
504  const UChar *dtFormat, int32_t length);
505 
513 U_CAPI const UChar * U_EXPORT2
515  int32_t *pLength);
516 
530 U_CAPI void U_EXPORT2
532  const UChar *decimal, int32_t length);
533 
542 U_CAPI const UChar * U_EXPORT2
544  int32_t *pLength);
545 
571 U_CAPI int32_t U_EXPORT2
573  const UChar *pattern, int32_t patternLength,
574  const UChar *skeleton, int32_t skeletonLength,
575  UChar *dest, int32_t destCapacity,
576  UErrorCode *pErrorCode);
577 
608 U_CAPI int32_t U_EXPORT2
610  const UChar *pattern, int32_t patternLength,
611  const UChar *skeleton, int32_t skeletonLength,
613  UChar *dest, int32_t destCapacity,
614  UErrorCode *pErrorCode);
615 
627 U_CAPI UEnumeration * U_EXPORT2
629 
640 U_CAPI UEnumeration * U_EXPORT2
642 
653 U_CAPI const UChar * U_EXPORT2
655  const UChar *skeleton, int32_t skeletonLength,
656  int32_t *pLength);
657 
658 #if !UCONFIG_NO_FORMATTING
659 
675 
676 #endif /* #if !UCONFIG_NO_FORMATTING */
677 
678 #endif
U_CAPI void udatpg_close(UDateTimePatternGenerator *dtpg)
Close a generator.
U_CAPI int32_t udatpg_getBaseSkeleton(UDateTimePatternGenerator *unusedDtpg, const UChar *pattern, int32_t length, UChar *baseSkeleton, int32_t capacity, UErrorCode *pErrorCode)
Get a unique base skeleton from a given pattern.
#define U_CAPI
This is used to declare a function as a public ICU C API.
Definition: umachine.h:110
U_CAPI void udatpg_setDecimal(UDateTimePatternGenerator *dtpg, const UChar *decimal, int32_t length)
The decimal value is used in formatting fractions of seconds.
U_CAPI const UChar * udatpg_getAppendItemFormat(const UDateTimePatternGenerator *dtpg, UDateTimePatternField field, int32_t *pLength)
Getter corresponding to setAppendItemFormat.
struct UEnumeration UEnumeration
structure representing an enumeration object instance
Definition: uenum.h:44
U_CAPI UEnumeration * udatpg_openBaseSkeletons(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode)
Return a UEnumeration list of all the base skeletons in canonical form.
UDateFormatHourCycle
Hour Cycle.
Definition: udat.h:983
"Smart pointer" class, closes a UDateTimePatternGenerator via udatpg_close().
U_CAPI const UChar * udatpg_getAppendItemName(const UDateTimePatternGenerator *dtpg, UDateTimePatternField field, int32_t *pLength)
Getter corresponding to setAppendItemNames.
U_CAPI int32_t udatpg_getBestPatternWithOptions(UDateTimePatternGenerator *dtpg, const UChar *skeleton, int32_t length, UDateTimePatternMatchOptions options, UChar *bestPattern, int32_t capacity, UErrorCode *pErrorCode)
Get the best pattern matching the input skeleton.
One more than the highest normal UDateTimePatternConflict value.
Definition: udatpg.h:155
U_CAPI int32_t udatpg_getBestPattern(UDateTimePatternGenerator *dtpg, const UChar *skeleton, int32_t length, UChar *bestPattern, int32_t capacity, UErrorCode *pErrorCode)
Get the best pattern matching the input skeleton.
U_CAPI const UChar * udatpg_getPatternForSkeleton(const UDateTimePatternGenerator *dtpg, const UChar *skeleton, int32_t skeletonLength, int32_t *pLength)
Get the pattern corresponding to a given skeleton.
U_CAPI int32_t udatpg_replaceFieldTypesWithOptions(UDateTimePatternGenerator *dtpg, const UChar *pattern, int32_t patternLength, const UChar *skeleton, int32_t skeletonLength, UDateTimePatternMatchOptions options, UChar *dest, int32_t destCapacity, UErrorCode *pErrorCode)
Adjusts the field types (width and subtype) of a pattern to match what is in a skeleton.
#define U_DEFINE_LOCAL_OPEN_POINTER(LocalPointerClassName, Type, closeFunction)
"Smart pointer" definition macro, deletes objects via the closeFunction.
Definition: localpointer.h:550
C++ API: "Smart pointers" for use with and in ICU4C C++ code.
C API: DateFormat.
U_CAPI const UChar * udatpg_getDateTimeFormat(const UDateTimePatternGenerator *dtpg, int32_t *pLength)
Getter corresponding to setDateTimeFormat.
U_CAPI int32_t udatpg_getSkeleton(UDateTimePatternGenerator *unusedDtpg, const UChar *pattern, int32_t length, UChar *skeleton, int32_t capacity, UErrorCode *pErrorCode)
Get a unique skeleton from a given pattern.
U_CAPI UDateTimePatternGenerator * udatpg_open(const char *locale, UErrorCode *pErrorCode)
Open a generator according to a given locale.
UDateTimePatternConflict
Status return values from udatpg_addPattern().
Definition: udatpg.h:143
U_CAPI const UChar * udatpg_getDecimal(const UDateTimePatternGenerator *dtpg, int32_t *pLength)
Getter corresponding to setDecimal.
One more than the highest normal UDateTimePatternField value.
Definition: udatpg.h:100
U_CAPI UDateFormatHourCycle udatpg_getDefaultHourCycle(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode)
Return the default hour cycle for a locale.
char16_t UChar
The base type for UTF-16 code units and pointers.
Definition: umachine.h:418
U_CAPI int32_t udatpg_replaceFieldTypes(UDateTimePatternGenerator *dtpg, const UChar *pattern, int32_t patternLength, const UChar *skeleton, int32_t skeletonLength, UChar *dest, int32_t destCapacity, UErrorCode *pErrorCode)
Adjusts the field types (width and subtype) of a pattern to match what is in a skeleton.
UDateTimePatternField
Field number constants for udatpg_getAppendItemFormats() and similar functions.
Definition: udatpg.h:59
U_CAPI UEnumeration * udatpg_openSkeletons(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode)
Return a UEnumeration list of all the skeletons in canonical form.
U_CAPI void udatpg_setAppendItemFormat(UDateTimePatternGenerator *dtpg, UDateTimePatternField field, const UChar *value, int32_t length)
An AppendItem format is a pattern used to append a field if there is no good match.
void * UDateTimePatternGenerator
Opaque type for a date/time pattern generator object.
Definition: udatpg.h:51
U_CAPI UDateTimePatternConflict udatpg_addPattern(UDateTimePatternGenerator *dtpg, const UChar *pattern, int32_t patternLength, UBool override, UChar *conflictingPattern, int32_t capacity, int32_t *pLength, UErrorCode *pErrorCode)
Adds a pattern to the generator.
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition: utypes.h:415
UDateTimePGDisplayWidth
Field display name width constants for udatpg_getFieldDisplayName().
Definition: udatpg.h:108
C API: String Enumeration.
U_CAPI void udatpg_setDateTimeFormat(const UDateTimePatternGenerator *dtpg, const UChar *dtFormat, int32_t length)
The DateTimeFormat is a message format pattern used to compose date and time patterns.
Basic definitions for ICU, for both C and C++ APIs.
U_CAPI int32_t udatpg_getFieldDisplayName(const UDateTimePatternGenerator *dtpg, UDateTimePatternField field, UDateTimePGDisplayWidth width, UChar *fieldName, int32_t capacity, UErrorCode *pErrorCode)
The general interface to get a display name for a particular date/time field, in one of several possi...
U_CAPI UDateTimePatternGenerator * udatpg_openEmpty(UErrorCode *pErrorCode)
Open an empty generator, to be constructed with udatpg_addPattern(...) etc.
U_CAPI void udatpg_setAppendItemName(UDateTimePatternGenerator *dtpg, UDateTimePatternField field, const UChar *value, int32_t length)
Set the name of field, eg "era" in English for ERA.
UDateTimePatternMatchOptions
Masks to control forcing the length of specified fields in the returned pattern to match those in the...
Definition: udatpg.h:124
U_CAPI UDateTimePatternGenerator * udatpg_clone(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode)
Create a copy pf a generator.
int8_t UBool
The ICU boolean type, a signed-byte integer.
Definition: umachine.h:269