ICU 52.1
52.1
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
File List
Globals
i18n
unicode
udat.h
Go to the documentation of this file.
1
/*
2
*******************************************************************************
3
* Copyright (C) 1996-2013, International Business Machines
4
* Corporation and others. All Rights Reserved.
5
*******************************************************************************
6
*/
7
8
#ifndef UDAT_H
9
#define UDAT_H
10
11
#include "
unicode/utypes.h
"
12
13
#if !UCONFIG_NO_FORMATTING
14
15
#include "
unicode/localpointer.h
"
16
#include "
unicode/ucal.h
"
17
#include "
unicode/unum.h
"
18
#include "
unicode/udisplaycontext.h
"
150
typedef
void
*
UDateFormat
;
151
155
typedef
enum
UDateFormatStyle
{
157
UDAT_FULL
,
159
UDAT_LONG
,
161
UDAT_MEDIUM
,
163
UDAT_SHORT
,
165
UDAT_DEFAULT
=
UDAT_MEDIUM
,
166
168
UDAT_RELATIVE
= (1 << 7),
169
170
UDAT_FULL_RELATIVE =
UDAT_FULL
|
UDAT_RELATIVE
,
171
172
UDAT_LONG_RELATIVE =
UDAT_LONG
|
UDAT_RELATIVE
,
173
174
UDAT_MEDIUM_RELATIVE =
UDAT_MEDIUM
|
UDAT_RELATIVE
,
175
176
UDAT_SHORT_RELATIVE =
UDAT_SHORT
|
UDAT_RELATIVE
,
177
178
180
UDAT_NONE
= -1,
181
187
UDAT_PATTERN
= -2,
188
190
UDAT_IGNORE
=
UDAT_PATTERN
191
}
UDateFormatStyle
;
192
193
/* Skeletons for dates. */
194
199
#define UDAT_YEAR "y"
200
#ifndef U_HIDE_DRAFT_API
201
205
#define UDAT_QUARTER "QQQQ"
206
210
#define UDAT_ABBR_QUARTER "QQQ"
211
#endif
/* U_HIDE_DRAFT_API */
212
216
#define UDAT_YEAR_QUARTER "yQQQQ"
217
221
#define UDAT_YEAR_ABBR_QUARTER "yQQQ"
222
226
#define UDAT_MONTH "MMMM"
227
231
#define UDAT_ABBR_MONTH "MMM"
232
236
#define UDAT_NUM_MONTH "M"
237
241
#define UDAT_YEAR_MONTH "yMMMM"
242
246
#define UDAT_YEAR_ABBR_MONTH "yMMM"
247
251
#define UDAT_YEAR_NUM_MONTH "yM"
252
256
#define UDAT_DAY "d"
257
262
#define UDAT_YEAR_MONTH_DAY "yMMMMd"
263
268
#define UDAT_YEAR_ABBR_MONTH_DAY "yMMMd"
269
274
#define UDAT_YEAR_NUM_MONTH_DAY "yMd"
275
#ifndef U_HIDE_DRAFT_API
276
280
#define UDAT_WEEKDAY "EEEE"
281
285
#define UDAT_ABBR_WEEKDAY "E"
286
#endif
/* U_HIDE_DRAFT_API */
287
292
#define UDAT_YEAR_MONTH_WEEKDAY_DAY "yMMMMEEEEd"
293
298
#define UDAT_YEAR_ABBR_MONTH_WEEKDAY_DAY "yMMMEd"
299
304
#define UDAT_YEAR_NUM_MONTH_WEEKDAY_DAY "yMEd"
305
310
#define UDAT_MONTH_DAY "MMMMd"
311
316
#define UDAT_ABBR_MONTH_DAY "MMMd"
317
322
#define UDAT_NUM_MONTH_DAY "Md"
323
328
#define UDAT_MONTH_WEEKDAY_DAY "MMMMEEEEd"
329
334
#define UDAT_ABBR_MONTH_WEEKDAY_DAY "MMMEd"
335
340
#define UDAT_NUM_MONTH_WEEKDAY_DAY "MEd"
341
342
/* Skeletons for times. */
343
348
#define UDAT_HOUR "j"
349
#ifndef U_HIDE_DRAFT_API
350
354
#define UDAT_HOUR24 "H"
355
359
#define UDAT_MINUTE "m"
360
#endif
/* U_HIDE_DRAFT_API */
361
366
#define UDAT_HOUR_MINUTE "jm"
367
372
#define UDAT_HOUR24_MINUTE "Hm"
373
#ifndef U_HIDE_DRAFT_API
374
378
#define UDAT_SECOND "s"
379
#endif
/* U_HIDE_DRAFT_API */
380
386
#define UDAT_HOUR_MINUTE_SECOND "jms"
387
393
#define UDAT_HOUR24_MINUTE_SECOND "Hms"
394
399
#define UDAT_MINUTE_SECOND "ms"
400
401
/* Skeletons for time zones. */
402
403
#ifndef U_HIDE_DRAFT_API
404
411
#define UDAT_LOCATION_TZ "VVVV"
412
419
#define UDAT_GENERIC_TZ "vvvv"
420
427
#define UDAT_ABBR_GENERIC_TZ "v"
428
435
#define UDAT_SPECIFIC_TZ "zzzz"
436
443
#define UDAT_ABBR_SPECIFIC_TZ "z"
444
451
#define UDAT_ABBR_UTC_TZ "ZZZZ"
452
#endif
/* U_HIDE_DRAFT_API */
453
454
/* deprecated skeleton constants */
455
456
#ifndef U_HIDE_DEPRECATED_API
457
461
#define UDAT_STANDALONE_MONTH "LLLL"
462
466
#define UDAT_ABBR_STANDALONE_MONTH "LLL"
467
472
#define UDAT_HOUR_MINUTE_GENERIC_TZ "jmv"
473
477
#define UDAT_HOUR_MINUTE_TZ "jmz"
478
482
#define UDAT_HOUR_GENERIC_TZ "jv"
483
487
#define UDAT_HOUR_TZ "jz"
488
#endif
/* U_HIDE_DEPRECATED_API */
489
495
typedef
enum
UDateFormatField
{
501
UDAT_ERA_FIELD
= 0,
502
508
UDAT_YEAR_FIELD
= 1,
509
515
UDAT_MONTH_FIELD
= 2,
516
522
UDAT_DATE_FIELD
= 3,
523
531
UDAT_HOUR_OF_DAY1_FIELD
= 4,
532
540
UDAT_HOUR_OF_DAY0_FIELD
= 5,
541
547
UDAT_MINUTE_FIELD
= 6,
548
554
UDAT_SECOND_FIELD
= 7,
555
569
UDAT_FRACTIONAL_SECOND_FIELD
= 8,
570
576
UDAT_DAY_OF_WEEK_FIELD
= 9,
577
583
UDAT_DAY_OF_YEAR_FIELD
= 10,
584
590
UDAT_DAY_OF_WEEK_IN_MONTH_FIELD
= 11,
591
597
UDAT_WEEK_OF_YEAR_FIELD
= 12,
598
604
UDAT_WEEK_OF_MONTH_FIELD
= 13,
605
611
UDAT_AM_PM_FIELD
= 14,
612
620
UDAT_HOUR1_FIELD
= 15,
621
629
UDAT_HOUR0_FIELD
= 16,
630
637
UDAT_TIMEZONE_FIELD
= 17,
638
644
UDAT_YEAR_WOY_FIELD
= 18,
645
651
UDAT_DOW_LOCAL_FIELD
= 19,
652
658
UDAT_EXTENDED_YEAR_FIELD
= 20,
659
665
UDAT_JULIAN_DAY_FIELD
= 21,
666
672
UDAT_MILLISECONDS_IN_DAY_FIELD
= 22,
673
680
UDAT_TIMEZONE_RFC_FIELD
= 23,
681
687
UDAT_TIMEZONE_GENERIC_FIELD
= 24,
694
UDAT_STANDALONE_DAY_FIELD
= 25,
695
702
UDAT_STANDALONE_MONTH_FIELD
= 26,
703
711
UDAT_QUARTER_FIELD
= 27,
712
720
UDAT_STANDALONE_QUARTER_FIELD
= 28,
721
727
UDAT_TIMEZONE_SPECIAL_FIELD
= 29,
728
736
UDAT_YEAR_NAME_FIELD
= 30,
737
738
#ifndef U_HIDE_DRAFT_API
739
745
UDAT_TIMEZONE_LOCALIZED_GMT_OFFSET_FIELD
= 31,
746
753
UDAT_TIMEZONE_ISO_FIELD
= 32,
754
761
UDAT_TIMEZONE_ISO_LOCAL_FIELD
= 33,
762
#endif
/* U_HIDE_DRAFT_API */
763
772
UDAT_FIELD_COUNT
= 34
773
774
}
UDateFormatField
;
775
776
785
U_STABLE
UCalendarDateFields
U_EXPORT2
786
udat_toCalendarDateField
(
UDateFormatField
field);
787
788
817
U_STABLE
UDateFormat
* U_EXPORT2
818
udat_open
(
UDateFormatStyle
timeStyle,
819
UDateFormatStyle
dateStyle,
820
const
char
*locale,
821
const
UChar
*tzID,
822
int32_t tzIDLength,
823
const
UChar
*pattern,
824
int32_t patternLength,
825
UErrorCode
*status);
826
827
834
U_STABLE
void
U_EXPORT2
835
udat_close
(
UDateFormat
* format);
836
837
842
typedef
enum
UDateFormatBooleanAttribute
{
847
UDAT_PARSE_ALLOW_WHITESPACE
,
853
UDAT_PARSE_ALLOW_NUMERIC
,
858
UDAT_BOOLEAN_ATTRIBUTE_COUNT
859
}
UDateFormatBooleanAttribute
;
860
861
#ifndef U_HIDE_INTERNAL_API
862
872
U_INTERNAL
UBool
U_EXPORT2
873
udat_getBooleanAttribute
(
const
UDateFormat
* fmt,
UDateFormatBooleanAttribute
attr,
UErrorCode
* status);
874
885
U_INTERNAL
void
U_EXPORT2
886
udat_setBooleanAttribute
(
UDateFormat
*fmt,
UDateFormatBooleanAttribute
attr,
UBool
,
UErrorCode
* status);
887
888
#endif
/* U_HIDE_INTERNAL_API */
889
890
891
892
#if U_SHOW_CPLUSPLUS_API
893
894
U_NAMESPACE_BEGIN
895
905
U_DEFINE_LOCAL_OPEN_POINTER
(
LocalUDateFormatPointer
,
UDateFormat
,
udat_close
);
906
907
U_NAMESPACE_END
908
909
#endif
910
919
U_STABLE
UDateFormat
* U_EXPORT2
920
udat_clone
(
const
UDateFormat
*fmt,
921
UErrorCode
*status);
922
941
U_STABLE
int32_t U_EXPORT2
942
udat_format
(
const
UDateFormat
* format,
943
UDate
dateToFormat,
944
UChar
* result,
945
int32_t resultLength,
946
UFieldPosition
* position,
947
UErrorCode
* status);
948
974
U_STABLE
UDate
U_EXPORT2
975
udat_parse
(
const
UDateFormat
* format,
976
const
UChar
* text,
977
int32_t textLength,
978
int32_t *parsePos,
979
UErrorCode
*status);
980
1002
U_STABLE
void
U_EXPORT2
1003
udat_parseCalendar
(
const
UDateFormat
* format,
1004
UCalendar
* calendar,
1005
const
UChar
* text,
1006
int32_t textLength,
1007
int32_t *parsePos,
1008
UErrorCode
*status);
1009
1019
U_STABLE
UBool
U_EXPORT2
1020
udat_isLenient
(
const
UDateFormat
* fmt);
1021
1031
U_STABLE
void
U_EXPORT2
1032
udat_setLenient
(
UDateFormat
* fmt,
1033
UBool
isLenient);
1034
1044
U_STABLE
const
UCalendar
* U_EXPORT2
1045
udat_getCalendar
(
const
UDateFormat
* fmt);
1046
1056
U_STABLE
void
U_EXPORT2
1057
udat_setCalendar
(
UDateFormat
* fmt,
1058
const
UCalendar
* calendarToSet);
1059
1069
U_STABLE
const
UNumberFormat
* U_EXPORT2
1070
udat_getNumberFormat
(
const
UDateFormat
* fmt);
1071
1081
U_STABLE
void
U_EXPORT2
1082
udat_setNumberFormat
(
UDateFormat
* fmt,
1083
const
UNumberFormat
* numberFormatToSet);
1084
1094
U_STABLE
const
char
* U_EXPORT2
1095
udat_getAvailable
(int32_t localeIndex);
1096
1105
U_STABLE
int32_t U_EXPORT2
1106
udat_countAvailable
(
void
);
1107
1118
U_STABLE
UDate
U_EXPORT2
1119
udat_get2DigitYearStart
(
const
UDateFormat
*fmt,
1120
UErrorCode
*status);
1121
1132
U_STABLE
void
U_EXPORT2
1133
udat_set2DigitYearStart
(
UDateFormat
*fmt,
1134
UDate
d,
1135
UErrorCode
*status);
1136
1149
U_STABLE
int32_t U_EXPORT2
1150
udat_toPattern
(
const
UDateFormat
*fmt,
1151
UBool
localized,
1152
UChar
*result,
1153
int32_t resultLength,
1154
UErrorCode
*status);
1155
1166
U_STABLE
void
U_EXPORT2
1167
udat_applyPattern
(
UDateFormat
*format,
1168
UBool
localized,
1169
const
UChar
*pattern,
1170
int32_t patternLength);
1171
1176
typedef
enum
UDateFormatSymbolType
{
1178
UDAT_ERAS
,
1180
UDAT_MONTHS
,
1182
UDAT_SHORT_MONTHS
,
1184
UDAT_WEEKDAYS
,
1189
UDAT_SHORT_WEEKDAYS
,
1191
UDAT_AM_PMS
,
1193
UDAT_LOCALIZED_CHARS
,
1195
UDAT_ERA_NAMES
,
1197
UDAT_NARROW_MONTHS
,
1199
UDAT_NARROW_WEEKDAYS
,
1201
UDAT_STANDALONE_MONTHS
,
1202
UDAT_STANDALONE_SHORT_MONTHS,
1203
UDAT_STANDALONE_NARROW_MONTHS,
1205
UDAT_STANDALONE_WEEKDAYS
,
1210
UDAT_STANDALONE_SHORT_WEEKDAYS
,
1212
UDAT_STANDALONE_NARROW_WEEKDAYS
,
1214
UDAT_QUARTERS
,
1216
UDAT_SHORT_QUARTERS
,
1218
UDAT_STANDALONE_QUARTERS
,
1219
UDAT_STANDALONE_SHORT_QUARTERS,
1220
#ifndef U_HIDE_DRAFT_API
1221
1228
UDAT_SHORTER_WEEKDAYS
,
1233
UDAT_STANDALONE_SHORTER_WEEKDAYS
1234
#endif
/* U_HIDE_DRAFT_API */
1235
}
UDateFormatSymbolType
;
1236
1237
struct
UDateFormatSymbols
;
1242
typedef
struct
UDateFormatSymbols
UDateFormatSymbols
;
1243
1260
U_STABLE
int32_t U_EXPORT2
1261
udat_getSymbols
(
const
UDateFormat
*fmt,
1262
UDateFormatSymbolType
type,
1263
int32_t symbolIndex,
1264
UChar
*result,
1265
int32_t resultLength,
1266
UErrorCode
*status);
1267
1280
U_STABLE
int32_t U_EXPORT2
1281
udat_countSymbols
(
const
UDateFormat
*fmt,
1282
UDateFormatSymbolType
type);
1283
1299
U_STABLE
void
U_EXPORT2
1300
udat_setSymbols
(
UDateFormat
*format,
1301
UDateFormatSymbolType
type,
1302
int32_t symbolIndex,
1303
UChar
*value,
1304
int32_t valueLength,
1305
UErrorCode
*status);
1306
1316
U_STABLE
const
char
* U_EXPORT2
1317
udat_getLocaleByType
(
const
UDateFormat
*fmt,
1318
ULocDataLocaleType
type,
1319
UErrorCode
* status);
1320
1321
#ifndef U_HIDE_DRAFT_API
1322
1330
U_DRAFT
void
U_EXPORT2
1331
udat_setContext
(
UDateFormat
* fmt,
UDisplayContext
value,
UErrorCode
* status);
1332
1342
U_DRAFT
UDisplayContext
U_EXPORT2
1343
udat_getContext
(
UDateFormat
* fmt,
UDisplayContextType
type,
UErrorCode
* status);
1344
1345
#endif
/* U_HIDE_DRAFT_API */
1346
1347
#ifndef U_HIDE_INTERNAL_API
1348
1359
U_INTERNAL
int32_t U_EXPORT2
1360
udat_toPatternRelativeDate
(
const
UDateFormat
*fmt,
1361
UChar
*result,
1362
int32_t resultLength,
1363
UErrorCode
*status);
1364
1376
U_INTERNAL
int32_t U_EXPORT2
1377
udat_toPatternRelativeTime
(
const
UDateFormat
*fmt,
1378
UChar
*result,
1379
int32_t resultLength,
1380
UErrorCode
*status);
1381
1394
U_INTERNAL
void
U_EXPORT2
1395
udat_applyPatternRelative
(
UDateFormat
*format,
1396
const
UChar
*datePattern,
1397
int32_t datePatternLength,
1398
const
UChar
*timePattern,
1399
int32_t timePatternLength,
1400
UErrorCode
*status);
1401
1406
typedef
UDateFormat
* (U_EXPORT2 *
UDateFormatOpener
) (
UDateFormatStyle
timeStyle,
1407
UDateFormatStyle
dateStyle,
1408
const
char
*locale,
1409
const
UChar
*tzID,
1410
int32_t tzIDLength,
1411
const
UChar
*pattern,
1412
int32_t patternLength,
1413
UErrorCode
*status);
1414
1419
U_INTERNAL
void
U_EXPORT2
1420
udat_registerOpener
(
UDateFormatOpener
opener,
UErrorCode
*status);
1421
1426
U_INTERNAL
UDateFormatOpener
U_EXPORT2
1427
udat_unregisterOpener
(
UDateFormatOpener
opener,
UErrorCode
*status);
1428
#endif
/* U_HIDE_INTERNAL_API */
1429
1430
1431
#endif
/* #if !UCONFIG_NO_FORMATTING */
1432
1433
#endif
Generated on Fri Oct 4 2013 14:10:21 for ICU 52.1 by
1.8.1.2