ICU 56.1  56.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-2015, 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 #endif /* U_HIDE_DRAFT_API */
773 
783 
785 
786 
787 #ifndef U_HIDE_INTERNAL_API
788 
793 #define UDAT_HAS_PATTERN_CHAR_FOR_TIME_SEPARATOR 0
794 #endif /* U_HIDE_INTERNAL_API */
795 
796 
807 
808 
837 U_STABLE UDateFormat* U_EXPORT2
838 udat_open(UDateFormatStyle timeStyle,
839  UDateFormatStyle dateStyle,
840  const char *locale,
841  const UChar *tzID,
842  int32_t tzIDLength,
843  const UChar *pattern,
844  int32_t patternLength,
845  UErrorCode *status);
846 
847 
854 U_STABLE void U_EXPORT2
855 udat_close(UDateFormat* format);
856 
857 
875 #ifndef U_HIDE_DRAFT_API
876 
888 #endif /* U_HIDE_DRAFT_API */
889 
895 
906 U_STABLE UBool U_EXPORT2
908 
919 U_STABLE void U_EXPORT2
921 
922 
923 
924 #if U_SHOW_CPLUSPLUS_API
925 
927 
938 
940 
941 #endif
942 
951 U_STABLE UDateFormat* U_EXPORT2
952 udat_clone(const UDateFormat *fmt,
953  UErrorCode *status);
954 
973 U_STABLE int32_t U_EXPORT2
974 udat_format( const UDateFormat* format,
975  UDate dateToFormat,
976  UChar* result,
977  int32_t resultLength,
978  UFieldPosition* position,
979  UErrorCode* status);
980 
981 #ifndef U_HIDE_DRAFT_API
982 
1004 U_DRAFT int32_t U_EXPORT2
1005 udat_formatCalendar( const UDateFormat* format,
1006  UCalendar* calendar,
1007  UChar* result,
1008  int32_t capacity,
1009  UFieldPosition* position,
1010  UErrorCode* status);
1011 
1039 U_DRAFT int32_t U_EXPORT2
1040 udat_formatForFields( const UDateFormat* format,
1041  UDate dateToFormat,
1042  UChar* result,
1043  int32_t resultLength,
1044  UFieldPositionIterator* fpositer,
1045  UErrorCode* status);
1046 
1077 U_DRAFT int32_t U_EXPORT2
1079  UCalendar* calendar,
1080  UChar* result,
1081  int32_t capacity,
1082  UFieldPositionIterator* fpositer,
1083  UErrorCode* status);
1084 
1085 #endif /* U_HIDE_DRAFT_API */
1086 
1112 U_STABLE UDate U_EXPORT2
1113 udat_parse(const UDateFormat* format,
1114  const UChar* text,
1115  int32_t textLength,
1116  int32_t *parsePos,
1117  UErrorCode *status);
1118 
1140 U_STABLE void U_EXPORT2
1141 udat_parseCalendar(const UDateFormat* format,
1142  UCalendar* calendar,
1143  const UChar* text,
1144  int32_t textLength,
1145  int32_t *parsePos,
1146  UErrorCode *status);
1147 
1157 U_STABLE UBool U_EXPORT2
1158 udat_isLenient(const UDateFormat* fmt);
1159 
1169 U_STABLE void U_EXPORT2
1171  UBool isLenient);
1172 
1182 U_STABLE const UCalendar* U_EXPORT2
1183 udat_getCalendar(const UDateFormat* fmt);
1184 
1194 U_STABLE void U_EXPORT2
1196  const UCalendar* calendarToSet);
1197 
1207 U_STABLE const UNumberFormat* U_EXPORT2
1208 udat_getNumberFormat(const UDateFormat* fmt);
1209 
1219 U_STABLE const UNumberFormat* U_EXPORT2
1221 
1237 U_STABLE void U_EXPORT2
1239  const UChar* fields,
1240  UNumberFormat* numberFormatToSet,
1241  UErrorCode* status);
1254 U_STABLE void U_EXPORT2
1256  const UNumberFormat* numberFormatToSet);
1266 U_STABLE void U_EXPORT2
1268  UNumberFormat* numberFormatToAdopt);
1278 U_STABLE const char* U_EXPORT2
1279 udat_getAvailable(int32_t localeIndex);
1280 
1289 U_STABLE int32_t U_EXPORT2
1290 udat_countAvailable(void);
1291 
1302 U_STABLE UDate U_EXPORT2
1304  UErrorCode *status);
1305 
1316 U_STABLE void U_EXPORT2
1318  UDate d,
1319  UErrorCode *status);
1320 
1333 U_STABLE int32_t U_EXPORT2
1334 udat_toPattern( const UDateFormat *fmt,
1335  UBool localized,
1336  UChar *result,
1337  int32_t resultLength,
1338  UErrorCode *status);
1339 
1350 U_STABLE void U_EXPORT2
1352  UBool localized,
1353  const UChar *pattern,
1354  int32_t patternLength);
1355 
1386  UDAT_STANDALONE_SHORT_MONTHS,
1387  UDAT_STANDALONE_NARROW_MONTHS,
1403  UDAT_STANDALONE_SHORT_QUARTERS,
1452 
1453 struct UDateFormatSymbols;
1459 
1476 U_STABLE int32_t U_EXPORT2
1477 udat_getSymbols(const UDateFormat *fmt,
1478  UDateFormatSymbolType type,
1479  int32_t symbolIndex,
1480  UChar *result,
1481  int32_t resultLength,
1482  UErrorCode *status);
1483 
1496 U_STABLE int32_t U_EXPORT2
1497 udat_countSymbols( const UDateFormat *fmt,
1498  UDateFormatSymbolType type);
1499 
1515 U_STABLE void U_EXPORT2
1516 udat_setSymbols( UDateFormat *format,
1517  UDateFormatSymbolType type,
1518  int32_t symbolIndex,
1519  UChar *value,
1520  int32_t valueLength,
1521  UErrorCode *status);
1522 
1532 U_STABLE const char* U_EXPORT2
1534  ULocDataLocaleType type,
1535  UErrorCode* status);
1536 
1545 U_DRAFT void U_EXPORT2
1547 
1557 U_STABLE UDisplayContext U_EXPORT2
1558 udat_getContext(const UDateFormat* fmt, UDisplayContextType type, UErrorCode* status);
1559 
1560 #ifndef U_HIDE_INTERNAL_API
1561 
1572 U_INTERNAL int32_t U_EXPORT2
1574  UChar *result,
1575  int32_t resultLength,
1576  UErrorCode *status);
1577 
1589 U_INTERNAL int32_t U_EXPORT2
1591  UChar *result,
1592  int32_t resultLength,
1593  UErrorCode *status);
1594 
1607 U_INTERNAL void U_EXPORT2
1609  const UChar *datePattern,
1610  int32_t datePatternLength,
1611  const UChar *timePattern,
1612  int32_t timePatternLength,
1613  UErrorCode *status);
1614 
1619 typedef UDateFormat* (U_EXPORT2 *UDateFormatOpener) (UDateFormatStyle timeStyle,
1620  UDateFormatStyle dateStyle,
1621  const char *locale,
1622  const UChar *tzID,
1623  int32_t tzIDLength,
1624  const UChar *pattern,
1625  int32_t patternLength,
1626  UErrorCode *status);
1627 
1632 U_INTERNAL void U_EXPORT2
1634 
1639 U_INTERNAL UDateFormatOpener U_EXPORT2
1641 #endif /* U_HIDE_INTERNAL_API */
1642 
1643 
1644 #endif /* #if !UCONFIG_NO_FORMATTING */
1645 
1646 #endif