ICU 62.1 62.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/uenum.h"
25
48
97
98#ifndef U_HIDE_DRAFT_API
111#endif // U_HIDE_DRAFT_API
112
134
146#ifndef U_HIDE_DEPRECATED_API
152#endif // U_HIDE_DEPRECATED_API
154
164udatpg_open(const char *locale, UErrorCode *pErrorCode);
165
175
181U_STABLE void U_EXPORT2
183
184#if U_SHOW_CPLUSPLUS_API
185
187
198
200
201#endif
202
213
237U_STABLE int32_t U_EXPORT2
239 const UChar *skeleton, int32_t length,
240 UChar *bestPattern, int32_t capacity,
241 UErrorCode *pErrorCode);
242
273U_STABLE int32_t U_EXPORT2
275 const UChar *skeleton, int32_t length,
277 UChar *bestPattern, int32_t capacity,
278 UErrorCode *pErrorCode);
279
301U_STABLE int32_t U_EXPORT2
303 const UChar *pattern, int32_t length,
304 UChar *skeleton, int32_t capacity,
305 UErrorCode *pErrorCode);
306
331U_STABLE int32_t U_EXPORT2
333 const UChar *pattern, int32_t length,
334 UChar *baseSkeleton, int32_t capacity,
335 UErrorCode *pErrorCode);
336
363 const UChar *pattern, int32_t patternLength,
364 UBool override,
365 UChar *conflictingPattern, int32_t capacity, int32_t *pLength,
366 UErrorCode *pErrorCode);
367
388U_STABLE void U_EXPORT2
391 const UChar *value, int32_t length);
392
403U_STABLE const UChar * U_EXPORT2
406 int32_t *pLength);
407
421U_STABLE void U_EXPORT2
424 const UChar *value, int32_t length);
425
438U_STABLE const UChar * U_EXPORT2
441 int32_t *pLength);
442
443#ifndef U_HIDE_DRAFT_API
469U_DRAFT int32_t U_EXPORT2
473 UChar *fieldName, int32_t capacity,
474 UErrorCode *pErrorCode);
475#endif // U_HIDE_DRAFT_API
476
500U_STABLE void U_EXPORT2
502 const UChar *dtFormat, int32_t length);
503
511U_STABLE const UChar * U_EXPORT2
513 int32_t *pLength);
514
528U_STABLE void U_EXPORT2
530 const UChar *decimal, int32_t length);
531
540U_STABLE const UChar * U_EXPORT2
542 int32_t *pLength);
543
569U_STABLE int32_t U_EXPORT2
571 const UChar *pattern, int32_t patternLength,
572 const UChar *skeleton, int32_t skeletonLength,
573 UChar *dest, int32_t destCapacity,
574 UErrorCode *pErrorCode);
575
606U_STABLE int32_t U_EXPORT2
608 const UChar *pattern, int32_t patternLength,
609 const UChar *skeleton, int32_t skeletonLength,
611 UChar *dest, int32_t destCapacity,
612 UErrorCode *pErrorCode);
613
625U_STABLE UEnumeration * U_EXPORT2
627
638U_STABLE UEnumeration * U_EXPORT2
640
651U_STABLE const UChar * U_EXPORT2
653 const UChar *skeleton, int32_t skeletonLength,
654 int32_t *pLength);
655
656#endif
"Smart pointer" class, closes a UDateTimePatternGenerator via udatpg_close().
C++ API: "Smart pointers" for use with and in ICU4C C++ code.
#define U_DEFINE_LOCAL_OPEN_POINTER(LocalPointerClassName, Type, closeFunction)
"Smart pointer" definition macro, deletes objects via the closeFunction.
UDateTimePGDisplayWidth
Field display name width constants for udatpg_getFieldDisplayName().
Definition udatpg.h:103
@ UDATPG_ABBREVIATED
Definition udatpg.h:107
@ UDATPG_WIDE
Definition udatpg.h:105
@ UDATPG_NARROW
Definition udatpg.h:109
void udatpg_close(UDateTimePatternGenerator *dtpg)
Close a generator.
UDateTimePatternGenerator * udatpg_open(const char *locale, UErrorCode *pErrorCode)
Open a generator according to a given locale.
void * UDateTimePatternGenerator
Opaque type for a date/time pattern generator object.
Definition udatpg.h:47
const UChar * udatpg_getPatternForSkeleton(const UDateTimePatternGenerator *dtpg, const UChar *skeleton, int32_t skeletonLength, int32_t *pLength)
Get the pattern corresponding to a given skeleton.
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.
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...
void udatpg_setAppendItemName(UDateTimePatternGenerator *dtpg, UDateTimePatternField field, const UChar *value, int32_t length)
Set the name of field, eg "era" in English for ERA.
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.
void udatpg_setDecimal(UDateTimePatternGenerator *dtpg, const UChar *decimal, int32_t length)
The decimal value is used in formatting fractions of seconds.
const UChar * udatpg_getAppendItemName(const UDateTimePatternGenerator *dtpg, UDateTimePatternField field, int32_t *pLength)
Getter corresponding to setAppendItemNames.
const UChar * udatpg_getAppendItemFormat(const UDateTimePatternGenerator *dtpg, UDateTimePatternField field, int32_t *pLength)
Getter corresponding to setAppendItemFormat.
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.
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.
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.
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.
UDateTimePatternGenerator * udatpg_openEmpty(UErrorCode *pErrorCode)
Open an empty generator, to be constructed with udatpg_addPattern(...) etc.
UDateTimePatternConflict
Status return values from udatpg_addPattern().
Definition udatpg.h:139
@ UDATPG_NO_CONFLICT
Definition udatpg.h:141
@ UDATPG_BASE_CONFLICT
Definition udatpg.h:143
@ UDATPG_CONFLICT
Definition udatpg.h:145
@ UDATPG_CONFLICT_COUNT
One more than the highest normal UDateTimePatternConflict value.
Definition udatpg.h:151
UEnumeration * udatpg_openBaseSkeletons(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode)
Return a UEnumeration list of all the base skeletons in canonical form.
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.
const UChar * udatpg_getDateTimeFormat(const UDateTimePatternGenerator *dtpg, int32_t *pLength)
Getter corresponding to setDateTimeFormat.
UDateTimePatternMatchOptions
Masks to control forcing the length of specified fields in the returned pattern to match those in the...
Definition udatpg.h:120
@ UDATPG_MATCH_HOUR_FIELD_LENGTH
Definition udatpg.h:124
@ UDATPG_MATCH_MINUTE_FIELD_LENGTH
Definition udatpg.h:127
@ UDATPG_MATCH_SECOND_FIELD_LENGTH
Definition udatpg.h:129
@ UDATPG_MATCH_NO_OPTIONS
Definition udatpg.h:122
@ UDATPG_MATCH_ALL_FIELDS_LENGTH
Definition udatpg.h:132
const UChar * udatpg_getDecimal(const UDateTimePatternGenerator *dtpg, int32_t *pLength)
Getter corresponding to setDecimal.
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.
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.
UDateTimePatternGenerator * udatpg_clone(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode)
Create a copy pf a generator.
UEnumeration * udatpg_openSkeletons(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode)
Return a UEnumeration list of all the skeletons in canonical form.
UDateTimePatternField
Field number constants for udatpg_getAppendItemFormats() and similar functions.
Definition udatpg.h:55
@ UDATPG_WEEK_OF_YEAR_FIELD
Definition udatpg.h:65
@ UDATPG_DAY_OF_YEAR_FIELD
Definition udatpg.h:71
@ UDATPG_QUARTER_FIELD
Definition udatpg.h:61
@ UDATPG_WEEKDAY_FIELD
Definition udatpg.h:69
@ UDATPG_DAYPERIOD_FIELD
Definition udatpg.h:77
@ UDATPG_MONTH_FIELD
Definition udatpg.h:63
@ UDATPG_DAY_FIELD
Definition udatpg.h:75
@ UDATPG_SECOND_FIELD
Definition udatpg.h:83
@ UDATPG_ZONE_FIELD
Definition udatpg.h:87
@ UDATPG_FRACTIONAL_SECOND_FIELD
Definition udatpg.h:85
@ UDATPG_DAY_OF_WEEK_IN_MONTH_FIELD
Definition udatpg.h:73
@ UDATPG_YEAR_FIELD
Definition udatpg.h:59
@ UDATPG_FIELD_COUNT
One more than the highest normal UDateTimePatternField value.
Definition udatpg.h:95
@ UDATPG_WEEK_OF_MONTH_FIELD
Definition udatpg.h:67
@ UDATPG_HOUR_FIELD
Definition udatpg.h:79
@ UDATPG_ERA_FIELD
Definition udatpg.h:57
@ UDATPG_MINUTE_FIELD
Definition udatpg.h:81
C API: String Enumeration.
struct UEnumeration UEnumeration
structure representing an enumeration object instance
Definition uenum.h:43
int8_t UBool
The ICU boolean type.
Definition umachine.h:236
#define U_DRAFT
This is used to declare a function as a draft public ICU C API
Definition umachine.h:113
uint16_t UChar
The base type for UTF-16 code units and pointers.
Definition umachine.h:353
#define U_STABLE
This is used to declare a function as a stable public ICU C API.
Definition umachine.h:111
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers,...
Definition utypes.h:396
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition uversion.h:138
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition uversion.h:137