ICU 52.1  52.1
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"
150 typedef void* UDateFormat;
151 
155 typedef enum UDateFormatStyle {
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 
188 
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 {
502 
509 
516 
523 
532 
541 
548 
555 
570 
577 
584 
591 
598 
605 
612 
621 
630 
638 
645 
652 
659 
666 
673 
681 
695 
703 
712 
721 
728 
737 
738 #ifndef U_HIDE_DRAFT_API
739 
746 
754 
762 #endif /* U_HIDE_DRAFT_API */
763 
773 
775 
776 
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 
860 
861 #ifndef U_HIDE_INTERNAL_API
862 
872 U_INTERNAL UBool U_EXPORT2
874 
885 U_INTERNAL void U_EXPORT2
887 
888 #endif /* U_HIDE_INTERNAL_API */
889 
890 
891 
892 #if U_SHOW_CPLUSPLUS_API
893 
895 
906 
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
1033  UBool isLenient);
1034 
1044 U_STABLE const UCalendar* U_EXPORT2
1045 udat_getCalendar(const UDateFormat* fmt);
1046 
1056 U_STABLE void U_EXPORT2
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
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
1120  UErrorCode *status);
1121 
1132 U_STABLE void U_EXPORT2
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
1168  UBool localized,
1169  const UChar *pattern,
1170  int32_t patternLength);
1171 
1202  UDAT_STANDALONE_SHORT_MONTHS,
1203  UDAT_STANDALONE_NARROW_MONTHS,
1219  UDAT_STANDALONE_SHORT_QUARTERS,
1220 #ifndef U_HIDE_DRAFT_API
1221 
1234 #endif /* U_HIDE_DRAFT_API */
1236 
1237 struct 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
1318  ULocDataLocaleType type,
1319  UErrorCode* status);
1320 
1321 #ifndef U_HIDE_DRAFT_API
1322 
1330 U_DRAFT void U_EXPORT2
1332 
1342 U_DRAFT UDisplayContext U_EXPORT2
1344 
1345 #endif /* U_HIDE_DRAFT_API */
1346 
1347 #ifndef U_HIDE_INTERNAL_API
1348 
1359 U_INTERNAL int32_t U_EXPORT2
1361  UChar *result,
1362  int32_t resultLength,
1363  UErrorCode *status);
1364 
1376 U_INTERNAL int32_t U_EXPORT2
1378  UChar *result,
1379  int32_t resultLength,
1380  UErrorCode *status);
1381 
1394 U_INTERNAL void U_EXPORT2
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
1421 
1426 U_INTERNAL UDateFormatOpener U_EXPORT2
1428 #endif /* U_HIDE_INTERNAL_API */
1429 
1430 
1431 #endif /* #if !UCONFIG_NO_FORMATTING */
1432 
1433 #endif