ICU 56.1: udatpg.h Source File

ICU 56.1 56.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

udatpg.h
Go to the documentation of this file.
1 /*
2 *******************************************************************************
3 *
4 * Copyright (C) 2007-2015, International Business Machines
5 * Corporation and others. All Rights Reserved.
6 *
7 *******************************************************************************
8 * file name: udatpg.h
9 * encoding: US-ASCII
10 * tab size: 8 (not used)
11 * indentation:4
12 *
13 * created on: 2007jul30
14 * created by: Markus W. Scherer
15 */
16
17 #ifndef __UDATPG_H__
18 #define __UDATPG_H__
19
20 #include "unicode/utypes.h"
21 #include "unicode/uenum.h"
22 #include "unicode/localpointer.h"
23
45 typedef void *UDateTimePatternGenerator;
46
53 typedef enum UDateTimePatternField {
55 UDATPG_ERA_FIELD,
57 UDATPG_YEAR_FIELD,
59 UDATPG_QUARTER_FIELD,
61 UDATPG_MONTH_FIELD,
63 UDATPG_WEEK_OF_YEAR_FIELD,
65 UDATPG_WEEK_OF_MONTH_FIELD,
67 UDATPG_WEEKDAY_FIELD,
69 UDATPG_DAY_OF_YEAR_FIELD,
71 UDATPG_DAY_OF_WEEK_IN_MONTH_FIELD,
73 UDATPG_DAY_FIELD,
75 UDATPG_DAYPERIOD_FIELD,
77 UDATPG_HOUR_FIELD,
79 UDATPG_MINUTE_FIELD,
81 UDATPG_SECOND_FIELD,
83 UDATPG_FRACTIONAL_SECOND_FIELD,
85 UDATPG_ZONE_FIELD,
87 UDATPG_FIELD_COUNT
88 } UDateTimePatternField;
89
97 typedef enum UDateTimePatternMatchOptions {
99 UDATPG_MATCH_NO_OPTIONS = 0,
101 UDATPG_MATCH_HOUR_FIELD_LENGTH = 1 << UDATPG_HOUR_FIELD,
102 #ifndef U_HIDE_INTERNAL_API
103
104 UDATPG_MATCH_MINUTE_FIELD_LENGTH = 1 << UDATPG_MINUTE_FIELD,
106 UDATPG_MATCH_SECOND_FIELD_LENGTH = 1 << UDATPG_SECOND_FIELD,
107 #endif /* U_HIDE_INTERNAL_API */
108
109 UDATPG_MATCH_ALL_FIELDS_LENGTH = (1 << UDATPG_FIELD_COUNT) - 1
110 } UDateTimePatternMatchOptions;
111
116 typedef enum UDateTimePatternConflict {
118 UDATPG_NO_CONFLICT,
120 UDATPG_BASE_CONFLICT,
122 UDATPG_CONFLICT,
124 UDATPG_CONFLICT_COUNT
125 } UDateTimePatternConflict;
126
135 U_STABLE UDateTimePatternGenerator * U_EXPORT2
136 udatpg_open(const char *locale, UErrorCode *pErrorCode);
137
145 U_STABLE UDateTimePatternGenerator * U_EXPORT2
146 udatpg_openEmpty(UErrorCode *pErrorCode);
147
153 U_STABLE void U_EXPORT2
154 udatpg_close(UDateTimePatternGenerator *dtpg);
155
156 #if U_SHOW_CPLUSPLUS_API
157
158 U_NAMESPACE_BEGIN
159
169 U_DEFINE_LOCAL_OPEN_POINTER(LocalUDateTimePatternGeneratorPointer, UDateTimePatternGenerator, udatpg_close);
170
171 U_NAMESPACE_END
172
173 #endif
174
183 U_STABLE UDateTimePatternGenerator * U_EXPORT2
184 udatpg_clone(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode);
185
209 U_STABLE int32_t U_EXPORT2
210 udatpg_getBestPattern(UDateTimePatternGenerator *dtpg,
211 const UChar *skeleton, int32_t length,
212 UChar *bestPattern, int32_t capacity,
213 UErrorCode *pErrorCode);
214
245 U_STABLE int32_t U_EXPORT2
246 udatpg_getBestPatternWithOptions(UDateTimePatternGenerator *dtpg,
247 const UChar *skeleton, int32_t length,
248 UDateTimePatternMatchOptions options,
249 UChar *bestPattern, int32_t capacity,
250 UErrorCode *pErrorCode);
251
273 U_STABLE int32_t U_EXPORT2
274 udatpg_getSkeleton(UDateTimePatternGenerator *unusedDtpg,
275 const UChar *pattern, int32_t length,
276 UChar *skeleton, int32_t capacity,
277 UErrorCode *pErrorCode);
278
303 U_STABLE int32_t U_EXPORT2
304 udatpg_getBaseSkeleton(UDateTimePatternGenerator *unusedDtpg,
305 const UChar *pattern, int32_t length,
306 UChar *baseSkeleton, int32_t capacity,
307 UErrorCode *pErrorCode);
308
333 U_STABLE UDateTimePatternConflict U_EXPORT2
334 udatpg_addPattern(UDateTimePatternGenerator *dtpg,
335 const UChar *pattern, int32_t patternLength,
336 UBool override,
337 UChar *conflictingPattern, int32_t capacity, int32_t *pLength,
338 UErrorCode *pErrorCode);
339
360 U_STABLE void U_EXPORT2
361 udatpg_setAppendItemFormat(UDateTimePatternGenerator *dtpg,
362 UDateTimePatternField field,
363 const UChar *value, int32_t length);
364
375 U_STABLE const UChar * U_EXPORT2
376 udatpg_getAppendItemFormat(const UDateTimePatternGenerator *dtpg,
377 UDateTimePatternField field,
378 int32_t *pLength);
379
393 U_STABLE void U_EXPORT2
394 udatpg_setAppendItemName(UDateTimePatternGenerator *dtpg,
395 UDateTimePatternField field,
396 const UChar *value, int32_t length);
397
408 U_STABLE const UChar * U_EXPORT2
409 udatpg_getAppendItemName(const UDateTimePatternGenerator *dtpg,
410 UDateTimePatternField field,
411 int32_t *pLength);
412
436 U_STABLE void U_EXPORT2
437 udatpg_setDateTimeFormat(const UDateTimePatternGenerator *dtpg,
438 const UChar *dtFormat, int32_t length);
439
447 U_STABLE const UChar * U_EXPORT2
448 udatpg_getDateTimeFormat(const UDateTimePatternGenerator *dtpg,
449 int32_t *pLength);
450
464 U_STABLE void U_EXPORT2
465 udatpg_setDecimal(UDateTimePatternGenerator *dtpg,
466 const UChar *decimal, int32_t length);
467
476 U_STABLE const UChar * U_EXPORT2
477 udatpg_getDecimal(const UDateTimePatternGenerator *dtpg,
478 int32_t *pLength);
479
505 U_STABLE int32_t U_EXPORT2
506 udatpg_replaceFieldTypes(UDateTimePatternGenerator *dtpg,
507 const UChar *pattern, int32_t patternLength,
508 const UChar *skeleton, int32_t skeletonLength,
509 UChar *dest, int32_t destCapacity,
510 UErrorCode *pErrorCode);
511
542 U_STABLE int32_t U_EXPORT2
543 udatpg_replaceFieldTypesWithOptions(UDateTimePatternGenerator *dtpg,
544 const UChar *pattern, int32_t patternLength,
545 const UChar *skeleton, int32_t skeletonLength,
546 UDateTimePatternMatchOptions options,
547 UChar *dest, int32_t destCapacity,
548 UErrorCode *pErrorCode);
549
561 U_STABLE UEnumeration * U_EXPORT2
562 udatpg_openSkeletons(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode);
563
574 U_STABLE UEnumeration * U_EXPORT2
575 udatpg_openBaseSkeletons(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode);
576
587 U_STABLE const UChar * U_EXPORT2
588 udatpg_getPatternForSkeleton(const UDateTimePatternGenerator *dtpg,
589 const UChar *skeleton, int32_t skeletonLength,
590 int32_t *pLength);
591
592 #endif
udatpg_getAppendItemFormat
const UChar * udatpg_getAppendItemFormat(const UDateTimePatternGenerator *dtpg, UDateTimePatternField field, int32_t *pLength)
Getter corresponding to setAppendItemFormat.
udatpg_getBestPatternWithOptions
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.
UDATPG_MATCH_SECOND_FIELD_LENGTH
Definition: udatpg.h:106
UDATPG_HOUR_FIELD
Definition: udatpg.h:77
udatpg_getSkeleton
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.
UDATPG_ERA_FIELD
Definition: udatpg.h:55
UDATPG_NO_CONFLICT
Definition: udatpg.h:118
udatpg_getAppendItemName
const UChar * udatpg_getAppendItemName(const UDateTimePatternGenerator *dtpg, UDateTimePatternField field, int32_t *pLength)
Getter corresponding to setAppendItemNames.
udatpg_replaceFieldTypes
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.
UEnumeration
struct UEnumeration UEnumeration
structure representing an enumeration object instance
Definition: uenum.h:39
UDATPG_MONTH_FIELD
Definition: udatpg.h:61
udatpg_setDateTimeFormat
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.
UDATPG_WEEKDAY_FIELD
Definition: udatpg.h:67
UDATPG_SECOND_FIELD
Definition: udatpg.h:81
LocalUDateTimePatternGeneratorPointer
"Smart pointer" class, closes a UDateTimePatternGenerator via udatpg_close().
UDATPG_CONFLICT
Definition: udatpg.h:122
udatpg_getBestPattern
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.
UDATPG_MINUTE_FIELD
Definition: udatpg.h:79
UDATPG_WEEK_OF_YEAR_FIELD
Definition: udatpg.h:63
UDATPG_CONFLICT_COUNT
Definition: udatpg.h:124
udatpg_setAppendItemFormat
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.
UDATPG_DAYPERIOD_FIELD
Definition: udatpg.h:75
udatpg_setAppendItemName
void udatpg_setAppendItemName(UDateTimePatternGenerator *dtpg, UDateTimePatternField field, const UChar *value, int32_t length)
Set the name of field, eg "era" in English for ERA.
U_NAMESPACE_BEGIN
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:129
udatpg_addPattern
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.
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:535
UDATPG_MATCH_MINUTE_FIELD_LENGTH
Definition: udatpg.h:104
localpointer.h
C++ API: "Smart pointers" for use with and in ICU4C C++ code.
udatpg_open
UDateTimePatternGenerator * udatpg_open(const char *locale, UErrorCode *pErrorCode)
Open a generator according to a given locale.
UDATPG_DAY_OF_YEAR_FIELD
Definition: udatpg.h:69
UDATPG_MATCH_NO_OPTIONS
Definition: udatpg.h:99
UDATPG_DAY_FIELD
Definition: udatpg.h:73
UDateTimePatternConflict
UDateTimePatternConflict
Status return values from udatpg_addPattern().
Definition: udatpg.h:116
UDATPG_YEAR_FIELD
Definition: udatpg.h:57
udatpg_getBaseSkeleton
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.
udatpg_openSkeletons
UEnumeration * udatpg_openSkeletons(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode)
Return a UEnumeration list of all the skeletons in canonical form.
udatpg_clone
UDateTimePatternGenerator * udatpg_clone(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode)
Create a copy pf a generator.
UDATPG_FIELD_COUNT
Definition: udatpg.h:87
UChar
uint16_t UChar
Define UChar to be UCHAR_TYPE, if that is #defined (for example, to char16_t), or wchar_t if that is ...
Definition: umachine.h:312
udatpg_close
void udatpg_close(UDateTimePatternGenerator *dtpg)
Close a generator.
UDATPG_WEEK_OF_MONTH_FIELD
Definition: udatpg.h:65
U_NAMESPACE_END
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition: uversion.h:130
UDateTimePatternField
UDateTimePatternField
Field number constants for udatpg_getAppendItemFormats() and similar functions.
Definition: udatpg.h:53
UDATPG_MATCH_ALL_FIELDS_LENGTH
Definition: udatpg.h:109
UDateTimePatternGenerator
void * UDateTimePatternGenerator
Opaque type for a date/time pattern generator object.
Definition: udatpg.h:45
UDATPG_ZONE_FIELD
Definition: udatpg.h:85
UErrorCode
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers...
Definition: utypes.h:476
udatpg_openBaseSkeletons
UEnumeration * udatpg_openBaseSkeletons(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode)
Return a UEnumeration list of all the base skeletons in canonical form.
udatpg_openEmpty
UDateTimePatternGenerator * udatpg_openEmpty(UErrorCode *pErrorCode)
Open an empty generator, to be constructed with udatpg_addPattern(...) etc.
UDATPG_DAY_OF_WEEK_IN_MONTH_FIELD
Definition: udatpg.h:71
UDATPG_MATCH_HOUR_FIELD_LENGTH
Definition: udatpg.h:101
uenum.h
C API: String Enumeration.
udatpg_setDecimal
void udatpg_setDecimal(UDateTimePatternGenerator *dtpg, const UChar *decimal, int32_t length)
The decimal value is used in formatting fractions of seconds.
udatpg_getDecimal
const UChar * udatpg_getDecimal(const UDateTimePatternGenerator *dtpg, int32_t *pLength)
Getter corresponding to setDecimal.
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
udatpg_getDateTimeFormat
const UChar * udatpg_getDateTimeFormat(const UDateTimePatternGenerator *dtpg, int32_t *pLength)
Getter corresponding to setDateTimeFormat.
udatpg_replaceFieldTypesWithOptions
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
UDateTimePatternMatchOptions
Masks to control forcing the length of specified fields in the returned pattern to match those in the...
Definition: udatpg.h:97
UDATPG_QUARTER_FIELD
Definition: udatpg.h:59
udatpg_getPatternForSkeleton
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_STABLE
#define U_STABLE
This is used to declare a function as a stable public ICU C API.
Definition: umachine.h:109
UDATPG_FRACTIONAL_SECOND_FIELD
Definition: udatpg.h:83
UBool
int8_t UBool
The ICU boolean type.
Definition: umachine.h:234
UDATPG_BASE_CONFLICT
Definition: udatpg.h:120