ICU 66.0.1  66.0.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"
24 #include "unicode/localpointer.h"
25 
48 
55 typedef enum UDateTimePatternField {
88 
89  /* Do not conditionalize the following with #ifndef U_HIDE_DEPRECATED_API,
90  * it is needed for layout of DateTimePatternGenerator object. */
91 #ifndef U_FORCE_HIDE_DEPRECATED_API
92 
97 #endif // U_FORCE_HIDE_DEPRECATED_API
99 
112 
125 #ifndef U_HIDE_INTERNAL_API
126 
130 #endif /* U_HIDE_INTERNAL_API */
131 
134 
146 #ifndef U_HIDE_DEPRECATED_API
147 
152 #endif // U_HIDE_DEPRECATED_API
154 
164 udatpg_open(const char *locale, UErrorCode *pErrorCode);
165 
174 udatpg_openEmpty(UErrorCode *pErrorCode);
175 
181 U_STABLE void U_EXPORT2
183 
184 #if U_SHOW_CPLUSPLUS_API
185 
186 U_NAMESPACE_BEGIN
187 
198 
199 U_NAMESPACE_END
200 
201 #endif
202 
212 udatpg_clone(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode);
213 
237 U_STABLE int32_t U_EXPORT2
239  const UChar *skeleton, int32_t length,
240  UChar *bestPattern, int32_t capacity,
241  UErrorCode *pErrorCode);
242 
273 U_STABLE int32_t U_EXPORT2
275  const UChar *skeleton, int32_t length,
277  UChar *bestPattern, int32_t capacity,
278  UErrorCode *pErrorCode);
279 
301 U_STABLE int32_t U_EXPORT2
303  const UChar *pattern, int32_t length,
304  UChar *skeleton, int32_t capacity,
305  UErrorCode *pErrorCode);
306 
331 U_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 
388 U_STABLE void U_EXPORT2
390  UDateTimePatternField field,
391  const UChar *value, int32_t length);
392 
403 U_STABLE const UChar * U_EXPORT2
405  UDateTimePatternField field,
406  int32_t *pLength);
407 
421 U_STABLE void U_EXPORT2
423  UDateTimePatternField field,
424  const UChar *value, int32_t length);
425 
438 U_STABLE const UChar * U_EXPORT2
440  UDateTimePatternField field,
441  int32_t *pLength);
442 
468 U_STABLE int32_t U_EXPORT2
470  UDateTimePatternField field,
472  UChar *fieldName, int32_t capacity,
473  UErrorCode *pErrorCode);
474 
498 U_STABLE void U_EXPORT2
500  const UChar *dtFormat, int32_t length);
501 
509 U_STABLE const UChar * U_EXPORT2
511  int32_t *pLength);
512 
526 U_STABLE void U_EXPORT2
528  const UChar *decimal, int32_t length);
529 
538 U_STABLE const UChar * U_EXPORT2
540  int32_t *pLength);
541 
567 U_STABLE int32_t U_EXPORT2
569  const UChar *pattern, int32_t patternLength,
570  const UChar *skeleton, int32_t skeletonLength,
571  UChar *dest, int32_t destCapacity,
572  UErrorCode *pErrorCode);
573 
604 U_STABLE int32_t U_EXPORT2
606  const UChar *pattern, int32_t patternLength,
607  const UChar *skeleton, int32_t skeletonLength,
609  UChar *dest, int32_t destCapacity,
610  UErrorCode *pErrorCode);
611 
623 U_STABLE UEnumeration * U_EXPORT2
625 
636 U_STABLE UEnumeration * U_EXPORT2
638 
649 U_STABLE const UChar * U_EXPORT2
651  const UChar *skeleton, int32_t skeletonLength,
652  int32_t *pLength);
653 
654 #endif
const UChar * udatpg_getAppendItemFormat(const UDateTimePatternGenerator *dtpg, UDateTimePatternField field, int32_t *pLength)
Getter corresponding to setAppendItemFormat.
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_getSkeleton(UDateTimePatternGenerator *unusedDtpg, const UChar *pattern, int32_t length, UChar *skeleton, int32_t capacity, UErrorCode *pErrorCode)
Get a unique skeleton from a given pattern.
const UChar * udatpg_getAppendItemName(const UDateTimePatternGenerator *dtpg, UDateTimePatternField field, int32_t *pLength)
Getter corresponding to setAppendItemNames.
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.
struct UEnumeration UEnumeration
structure representing an enumeration object instance
Definition: uenum.h:43
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.
"Smart pointer" class, closes a UDateTimePatternGenerator via udatpg_close().
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.
One more than the highest normal UDateTimePatternConflict value.
Definition: udatpg.h:151
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 udatpg_setAppendItemName(UDateTimePatternGenerator *dtpg, UDateTimePatternField field, const UChar *value, int32_t length)
Set the name of field, eg "era" in English for ERA.
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.
#define U_DEFINE_LOCAL_OPEN_POINTER(LocalPointerClassName, Type, closeFunction)
"Smart pointer" definition macro, deletes objects via the closeFunction.
Definition: localpointer.h:562
C++ API: "Smart pointers" for use with and in ICU4C C++ code.
UDateTimePatternGenerator * udatpg_open(const char *locale, UErrorCode *pErrorCode)
Open a generator according to a given locale.
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...
UDateTimePatternConflict
Status return values from udatpg_addPattern().
Definition: udatpg.h:139
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.
UEnumeration * udatpg_openSkeletons(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode)
Return a UEnumeration list of all the skeletons in canonical form.
UDateTimePatternGenerator * udatpg_clone(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode)
Create a copy pf a generator.
One more than the highest normal UDateTimePatternField value.
Definition: udatpg.h:96
uint16_t UChar
The base type for UTF-16 code units and pointers.
Definition: umachine.h:378
void udatpg_close(UDateTimePatternGenerator *dtpg)
Close a generator.
UDateTimePatternField
Field number constants for udatpg_getAppendItemFormats() and similar functions.
Definition: udatpg.h:55
void * UDateTimePatternGenerator
Opaque type for a date/time pattern generator object.
Definition: udatpg.h:47
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:104
UEnumeration * udatpg_openBaseSkeletons(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode)
Return a UEnumeration list of all the base skeletons in canonical form.
UDateTimePatternGenerator * udatpg_openEmpty(UErrorCode *pErrorCode)
Open an empty generator, to be constructed with udatpg_addPattern(...) etc.
C API: String Enumeration.
void udatpg_setDecimal(UDateTimePatternGenerator *dtpg, const UChar *decimal, int32_t length)
The decimal value is used in formatting fractions of seconds.
const UChar * udatpg_getDecimal(const UDateTimePatternGenerator *dtpg, int32_t *pLength)
Getter corresponding to setDecimal.
Basic definitions for ICU, for both C and C++ APIs.
const UChar * udatpg_getDateTimeFormat(const UDateTimePatternGenerator *dtpg, int32_t *pLength)
Getter corresponding to setDateTimeFormat.
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.
UDateTimePatternMatchOptions
Masks to control forcing the length of specified fields in the returned pattern to match those in the...
Definition: udatpg.h:120
const UChar * udatpg_getPatternForSkeleton(const UDateTimePatternGenerator *dtpg, const UChar *skeleton, int32_t skeletonLength, int32_t *pLength)
Get the pattern corresponding to a given skeleton.
#define U_STABLE
This is used to declare a function as a stable public ICU C API.
Definition: umachine.h:111
int8_t UBool
The ICU boolean type.
Definition: umachine.h:261