ICU 57.1  57.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
udat.h
Go to the documentation of this file.
1 /*
2  *******************************************************************************
3  * Copyright (C) 1996-2016, 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"
19 #include "unicode/ufieldpositer.h"
151 typedef void* UDateFormat;
152 
156 typedef enum UDateFormatStyle {
167 
169  UDAT_RELATIVE = (1 << 7),
170 
171  UDAT_FULL_RELATIVE = UDAT_FULL | UDAT_RELATIVE,
172 
173  UDAT_LONG_RELATIVE = UDAT_LONG | UDAT_RELATIVE,
174 
175  UDAT_MEDIUM_RELATIVE = UDAT_MEDIUM | UDAT_RELATIVE,
176 
177  UDAT_SHORT_RELATIVE = UDAT_SHORT | UDAT_RELATIVE,
178 
179 
181  UDAT_NONE = -1,
182 
189 
190 #ifndef U_HIDE_INTERNAL_API
193 #endif /* U_HIDE_INTERNAL_API */
195 
196 /* Skeletons for dates. */
197 
202 #define UDAT_YEAR "y"
203 
207 #define UDAT_QUARTER "QQQQ"
208 
212 #define UDAT_ABBR_QUARTER "QQQ"
213 
217 #define UDAT_YEAR_QUARTER "yQQQQ"
218 
222 #define UDAT_YEAR_ABBR_QUARTER "yQQQ"
223 
227 #define UDAT_MONTH "MMMM"
228 
232 #define UDAT_ABBR_MONTH "MMM"
233 
237 #define UDAT_NUM_MONTH "M"
238 
242 #define UDAT_YEAR_MONTH "yMMMM"
243 
247 #define UDAT_YEAR_ABBR_MONTH "yMMM"
248 
252 #define UDAT_YEAR_NUM_MONTH "yM"
253 
257 #define UDAT_DAY "d"
258 
263 #define UDAT_YEAR_MONTH_DAY "yMMMMd"
264 
269 #define UDAT_YEAR_ABBR_MONTH_DAY "yMMMd"
270 
275 #define UDAT_YEAR_NUM_MONTH_DAY "yMd"
276 
280 #define UDAT_WEEKDAY "EEEE"
281 
285 #define UDAT_ABBR_WEEKDAY "E"
286 
291 #define UDAT_YEAR_MONTH_WEEKDAY_DAY "yMMMMEEEEd"
292 
297 #define UDAT_YEAR_ABBR_MONTH_WEEKDAY_DAY "yMMMEd"
298 
303 #define UDAT_YEAR_NUM_MONTH_WEEKDAY_DAY "yMEd"
304 
309 #define UDAT_MONTH_DAY "MMMMd"
310 
315 #define UDAT_ABBR_MONTH_DAY "MMMd"
316 
321 #define UDAT_NUM_MONTH_DAY "Md"
322 
327 #define UDAT_MONTH_WEEKDAY_DAY "MMMMEEEEd"
328 
333 #define UDAT_ABBR_MONTH_WEEKDAY_DAY "MMMEd"
334 
339 #define UDAT_NUM_MONTH_WEEKDAY_DAY "MEd"
340 
341 /* Skeletons for times. */
342 
347 #define UDAT_HOUR "j"
348 
352 #define UDAT_HOUR24 "H"
353 
357 #define UDAT_MINUTE "m"
358 
363 #define UDAT_HOUR_MINUTE "jm"
364 
369 #define UDAT_HOUR24_MINUTE "Hm"
370 
374 #define UDAT_SECOND "s"
375 
381 #define UDAT_HOUR_MINUTE_SECOND "jms"
382 
388 #define UDAT_HOUR24_MINUTE_SECOND "Hms"
389 
394 #define UDAT_MINUTE_SECOND "ms"
395 
396 /* Skeletons for time zones. */
397 
405 #define UDAT_LOCATION_TZ "VVVV"
406 
413 #define UDAT_GENERIC_TZ "vvvv"
414 
421 #define UDAT_ABBR_GENERIC_TZ "v"
422 
429 #define UDAT_SPECIFIC_TZ "zzzz"
430 
437 #define UDAT_ABBR_SPECIFIC_TZ "z"
438 
445 #define UDAT_ABBR_UTC_TZ "ZZZZ"
446 
447 /* deprecated skeleton constants */
448 
449 #ifndef U_HIDE_DEPRECATED_API
450 
454 #define UDAT_STANDALONE_MONTH "LLLL"
455 
459 #define UDAT_ABBR_STANDALONE_MONTH "LLL"
460 
465 #define UDAT_HOUR_MINUTE_GENERIC_TZ "jmv"
466 
470 #define UDAT_HOUR_MINUTE_TZ "jmz"
471 
475 #define UDAT_HOUR_GENERIC_TZ "jv"
476 
480 #define UDAT_HOUR_TZ "jz"
481 #endif /* U_HIDE_DEPRECATED_API */
482 
488 typedef enum UDateFormatField {
495 
502 
509 
516 
525 
534 
541 
548 
563 
570 
577 
584 
591 
598 
605 
614 
623 
631 
638 
645 
652 
659 
666 
674 
688 
696 
705 
714 
721 
730 
738 
746 
754 
755 #ifndef U_HIDE_INTERNAL_API
756 
762 #endif /* U_HIDE_INTERNAL_API */
763 
764 #ifndef U_HIDE_DRAFT_API
765 
772 
773  /* FieldPosition selector for 'B' field alignment.
774  * Displays flexible day periods, such as "in the morning", if available.
775  * @draft ICU 57
776  */
777  UDAT_FLEXIBLE_DAY_PERIOD_FIELD = 36,
778 #endif /* U_HIDE_DRAFT_API */
779 
780 #ifndef U_HIDE_INTERNAL_API
781 
788 #endif /* U_HIDE_INTERNAL_API */
789 
799 
801 
802 
803 #ifndef U_HIDE_INTERNAL_API
804 
809 #define UDAT_HAS_PATTERN_CHAR_FOR_TIME_SEPARATOR 0
810 #endif /* U_HIDE_INTERNAL_API */
811 
812 
823 
824 
853 U_STABLE UDateFormat* U_EXPORT2
854 udat_open(UDateFormatStyle timeStyle,
855  UDateFormatStyle dateStyle,
856  const char *locale,
857  const UChar *tzID,
858  int32_t tzIDLength,
859  const UChar *pattern,
860  int32_t patternLength,
861  UErrorCode *status);
862 
863 
870 U_STABLE void U_EXPORT2
871 udat_close(UDateFormat* format);
872 
873 
891 #ifndef U_HIDE_DRAFT_API
892 
904 #endif /* U_HIDE_DRAFT_API */
905 
911 
922 U_STABLE UBool U_EXPORT2
924 
935 U_STABLE void U_EXPORT2
937 
938 
939 
940 #if U_SHOW_CPLUSPLUS_API
941 
943 
954 
956 
957 #endif
958 
967 U_STABLE UDateFormat* U_EXPORT2
968 udat_clone(const UDateFormat *fmt,
969  UErrorCode *status);
970 
989 U_STABLE int32_t U_EXPORT2
990 udat_format( const UDateFormat* format,
991  UDate dateToFormat,
992  UChar* result,
993  int32_t resultLength,
994  UFieldPosition* position,
995  UErrorCode* status);
996 
1019 U_STABLE int32_t U_EXPORT2
1020 udat_formatCalendar( const UDateFormat* format,
1021  UCalendar* calendar,
1022  UChar* result,
1023  int32_t capacity,
1024  UFieldPosition* position,
1025  UErrorCode* status);
1026 
1054 U_STABLE int32_t U_EXPORT2
1055 udat_formatForFields( const UDateFormat* format,
1056  UDate dateToFormat,
1057  UChar* result,
1058  int32_t resultLength,
1059  UFieldPositionIterator* fpositer,
1060  UErrorCode* status);
1061 
1092 U_STABLE int32_t U_EXPORT2
1094  UCalendar* calendar,
1095  UChar* result,
1096  int32_t capacity,
1097  UFieldPositionIterator* fpositer,
1098  UErrorCode* status);
1099 
1100 
1126 U_STABLE UDate U_EXPORT2
1127 udat_parse(const UDateFormat* format,
1128  const UChar* text,
1129  int32_t textLength,
1130  int32_t *parsePos,
1131  UErrorCode *status);
1132 
1154 U_STABLE void U_EXPORT2
1155 udat_parseCalendar(const UDateFormat* format,
1156  UCalendar* calendar,
1157  const UChar* text,
1158  int32_t textLength,
1159  int32_t *parsePos,
1160  UErrorCode *status);
1161 
1171 U_STABLE UBool U_EXPORT2
1172 udat_isLenient(const UDateFormat* fmt);
1173 
1183 U_STABLE void U_EXPORT2
1185  UBool isLenient);
1186 
1196 U_STABLE const UCalendar* U_EXPORT2
1197 udat_getCalendar(const UDateFormat* fmt);
1198 
1208 U_STABLE void U_EXPORT2
1210  const UCalendar* calendarToSet);
1211 
1221 U_STABLE const UNumberFormat* U_EXPORT2
1222 udat_getNumberFormat(const UDateFormat* fmt);
1223 
1233 U_STABLE const UNumberFormat* U_EXPORT2
1235 
1251 U_STABLE void U_EXPORT2
1253  const UChar* fields,
1254  UNumberFormat* numberFormatToSet,
1255  UErrorCode* status);
1268 U_STABLE void U_EXPORT2
1270  const UNumberFormat* numberFormatToSet);
1280 U_STABLE void U_EXPORT2
1282  UNumberFormat* numberFormatToAdopt);
1292 U_STABLE const char* U_EXPORT2
1293 udat_getAvailable(int32_t localeIndex);
1294 
1303 U_STABLE int32_t U_EXPORT2
1304 udat_countAvailable(void);
1305 
1316 U_STABLE UDate U_EXPORT2
1318  UErrorCode *status);
1319 
1330 U_STABLE void U_EXPORT2
1332  UDate d,
1333  UErrorCode *status);
1334 
1347 U_STABLE int32_t U_EXPORT2
1348 udat_toPattern( const UDateFormat *fmt,
1349  UBool localized,
1350  UChar *result,
1351  int32_t resultLength,
1352  UErrorCode *status);
1353 
1364 U_STABLE void U_EXPORT2
1366  UBool localized,
1367  const UChar *pattern,
1368  int32_t patternLength);
1369 
1400  UDAT_STANDALONE_SHORT_MONTHS,
1401  UDAT_STANDALONE_NARROW_MONTHS,
1417  UDAT_STANDALONE_SHORT_QUARTERS,
1466 
1467 struct UDateFormatSymbols;
1473 
1490 U_STABLE int32_t U_EXPORT2
1491 udat_getSymbols(const UDateFormat *fmt,
1492  UDateFormatSymbolType type,
1493  int32_t symbolIndex,
1494  UChar *result,
1495  int32_t resultLength,
1496  UErrorCode *status);
1497 
1510 U_STABLE int32_t U_EXPORT2
1511 udat_countSymbols( const UDateFormat *fmt,
1512  UDateFormatSymbolType type);
1513 
1529 U_STABLE void U_EXPORT2
1530 udat_setSymbols( UDateFormat *format,
1531  UDateFormatSymbolType type,
1532  int32_t symbolIndex,
1533  UChar *value,
1534  int32_t valueLength,
1535  UErrorCode *status);
1536 
1546 U_STABLE const char* U_EXPORT2
1548  ULocDataLocaleType type,
1549  UErrorCode* status);
1550 
1559 U_DRAFT void U_EXPORT2
1561 
1571 U_STABLE UDisplayContext U_EXPORT2
1572 udat_getContext(const UDateFormat* fmt, UDisplayContextType type, UErrorCode* status);
1573 
1574 #ifndef U_HIDE_INTERNAL_API
1575 
1586 U_INTERNAL int32_t U_EXPORT2
1588  UChar *result,
1589  int32_t resultLength,
1590  UErrorCode *status);
1591 
1603 U_INTERNAL int32_t U_EXPORT2
1605  UChar *result,
1606  int32_t resultLength,
1607  UErrorCode *status);
1608 
1621 U_INTERNAL void U_EXPORT2
1623  const UChar *datePattern,
1624  int32_t datePatternLength,
1625  const UChar *timePattern,
1626  int32_t timePatternLength,
1627  UErrorCode *status);
1628 
1633 typedef UDateFormat* (U_EXPORT2 *UDateFormatOpener) (UDateFormatStyle timeStyle,
1634  UDateFormatStyle dateStyle,
1635  const char *locale,
1636  const UChar *tzID,
1637  int32_t tzIDLength,
1638  const UChar *pattern,
1639  int32_t patternLength,
1640  UErrorCode *status);
1641 
1646 U_INTERNAL void U_EXPORT2
1648 
1653 U_INTERNAL UDateFormatOpener U_EXPORT2
1655 #endif /* U_HIDE_INTERNAL_API */
1656 
1657 
1658 #endif /* #if !UCONFIG_NO_FORMATTING */
1659 
1660 #endif