ICU 54.1  54.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-2014, 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 
189 #ifndef U_HIDE_INTERNAL_API
192 #endif /* U_HIDE_INTERNAL_API */
194 
195 /* Skeletons for dates. */
196 
201 #define UDAT_YEAR "y"
202 
206 #define UDAT_QUARTER "QQQQ"
207 
211 #define UDAT_ABBR_QUARTER "QQQ"
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 
279 #define UDAT_WEEKDAY "EEEE"
280 
284 #define UDAT_ABBR_WEEKDAY "E"
285 
290 #define UDAT_YEAR_MONTH_WEEKDAY_DAY "yMMMMEEEEd"
291 
296 #define UDAT_YEAR_ABBR_MONTH_WEEKDAY_DAY "yMMMEd"
297 
302 #define UDAT_YEAR_NUM_MONTH_WEEKDAY_DAY "yMEd"
303 
308 #define UDAT_MONTH_DAY "MMMMd"
309 
314 #define UDAT_ABBR_MONTH_DAY "MMMd"
315 
320 #define UDAT_NUM_MONTH_DAY "Md"
321 
326 #define UDAT_MONTH_WEEKDAY_DAY "MMMMEEEEd"
327 
332 #define UDAT_ABBR_MONTH_WEEKDAY_DAY "MMMEd"
333 
338 #define UDAT_NUM_MONTH_WEEKDAY_DAY "MEd"
339 
340 /* Skeletons for times. */
341 
346 #define UDAT_HOUR "j"
347 
351 #define UDAT_HOUR24 "H"
352 
356 #define UDAT_MINUTE "m"
357 
362 #define UDAT_HOUR_MINUTE "jm"
363 
368 #define UDAT_HOUR24_MINUTE "Hm"
369 
373 #define UDAT_SECOND "s"
374 
380 #define UDAT_HOUR_MINUTE_SECOND "jms"
381 
387 #define UDAT_HOUR24_MINUTE_SECOND "Hms"
388 
393 #define UDAT_MINUTE_SECOND "ms"
394 
395 /* Skeletons for time zones. */
396 
404 #define UDAT_LOCATION_TZ "VVVV"
405 
412 #define UDAT_GENERIC_TZ "vvvv"
413 
420 #define UDAT_ABBR_GENERIC_TZ "v"
421 
428 #define UDAT_SPECIFIC_TZ "zzzz"
429 
436 #define UDAT_ABBR_SPECIFIC_TZ "z"
437 
444 #define UDAT_ABBR_UTC_TZ "ZZZZ"
445 
446 /* deprecated skeleton constants */
447 
448 #ifndef U_HIDE_DEPRECATED_API
449 
453 #define UDAT_STANDALONE_MONTH "LLLL"
454 
458 #define UDAT_ABBR_STANDALONE_MONTH "LLL"
459 
464 #define UDAT_HOUR_MINUTE_GENERIC_TZ "jmv"
465 
469 #define UDAT_HOUR_MINUTE_TZ "jmz"
470 
474 #define UDAT_HOUR_GENERIC_TZ "jv"
475 
479 #define UDAT_HOUR_TZ "jz"
480 #endif /* U_HIDE_DEPRECATED_API */
481 
487 typedef enum UDateFormatField {
494 
501 
508 
515 
524 
533 
540 
547 
562 
569 
576 
583 
590 
597 
604 
613 
622 
630 
637 
644 
651 
658 
665 
673 
687 
695 
704 
713 
720 
729 
737 
745 
753 
754 #ifndef U_HIDE_INTERNAL_API
755 
761 #endif /* U_HIDE_INTERNAL_API */
762 
772 
774 
775 
786 
787 
816 U_STABLE UDateFormat* U_EXPORT2
817 udat_open(UDateFormatStyle timeStyle,
818  UDateFormatStyle dateStyle,
819  const char *locale,
820  const UChar *tzID,
821  int32_t tzIDLength,
822  const UChar *pattern,
823  int32_t patternLength,
824  UErrorCode *status);
825 
826 
833 U_STABLE void U_EXPORT2
834 udat_close(UDateFormat* format);
835 
836 
837 /* Dont hide UDateFormatBooleanAttribute type with #ifndef U_HIDE_DRAFT_API, needed by virtual methods */
838 /* Also don't hide UDAT_BOOLEAN_ATTRIBUTE_COUNT, needed by template class EnumSet<UDateFormatBooleanAttribute,...> */
845 #ifndef U_HIDE_DRAFT_API
846 
868 #endif /* U_HIDE_DRAFT_API */
869 
875 
876 #ifndef U_HIDE_DRAFT_API
877 
887 U_DRAFT UBool U_EXPORT2
889 
900 U_DRAFT void U_EXPORT2
902 
903 #endif /* U_HIDE_DRAFT_API */
904 
905 
906 
907 #if U_SHOW_CPLUSPLUS_API
908 
910 
921 
923 
924 #endif
925 
934 U_STABLE UDateFormat* U_EXPORT2
935 udat_clone(const UDateFormat *fmt,
936  UErrorCode *status);
937 
956 U_STABLE int32_t U_EXPORT2
957 udat_format( const UDateFormat* format,
958  UDate dateToFormat,
959  UChar* result,
960  int32_t resultLength,
961  UFieldPosition* position,
962  UErrorCode* status);
963 
989 U_STABLE UDate U_EXPORT2
990 udat_parse(const UDateFormat* format,
991  const UChar* text,
992  int32_t textLength,
993  int32_t *parsePos,
994  UErrorCode *status);
995 
1017 U_STABLE void U_EXPORT2
1018 udat_parseCalendar(const UDateFormat* format,
1019  UCalendar* calendar,
1020  const UChar* text,
1021  int32_t textLength,
1022  int32_t *parsePos,
1023  UErrorCode *status);
1024 
1034 U_STABLE UBool U_EXPORT2
1035 udat_isLenient(const UDateFormat* fmt);
1036 
1046 U_STABLE void U_EXPORT2
1048  UBool isLenient);
1049 
1059 U_STABLE const UCalendar* U_EXPORT2
1060 udat_getCalendar(const UDateFormat* fmt);
1061 
1071 U_STABLE void U_EXPORT2
1073  const UCalendar* calendarToSet);
1074 
1084 U_STABLE const UNumberFormat* U_EXPORT2
1085 udat_getNumberFormat(const UDateFormat* fmt);
1086 
1087 #ifndef U_HIDE_DRAFT_API
1088 
1097 U_DRAFT const UNumberFormat* U_EXPORT2
1099 
1115 U_DRAFT void U_EXPORT2
1117  const UChar* fields,
1118  UNumberFormat* numberFormatToSet,
1119  UErrorCode* status);
1120 #endif /* U_HIDE_DRAFT_API */
1121 
1134 U_STABLE void U_EXPORT2
1136  const UNumberFormat* numberFormatToSet);
1137 
1138 #ifndef U_HIDE_DRAFT_API
1139 
1148 U_DRAFT void U_EXPORT2
1150  UNumberFormat* numberFormatToAdopt);
1151 #endif /* U_HIDE_DRAFT_API */
1152 
1162 U_STABLE const char* U_EXPORT2
1163 udat_getAvailable(int32_t localeIndex);
1164 
1173 U_STABLE int32_t U_EXPORT2
1174 udat_countAvailable(void);
1175 
1186 U_STABLE UDate U_EXPORT2
1188  UErrorCode *status);
1189 
1200 U_STABLE void U_EXPORT2
1202  UDate d,
1203  UErrorCode *status);
1204 
1217 U_STABLE int32_t U_EXPORT2
1218 udat_toPattern( const UDateFormat *fmt,
1219  UBool localized,
1220  UChar *result,
1221  int32_t resultLength,
1222  UErrorCode *status);
1223 
1234 U_STABLE void U_EXPORT2
1236  UBool localized,
1237  const UChar *pattern,
1238  int32_t patternLength);
1239 
1270  UDAT_STANDALONE_SHORT_MONTHS,
1271  UDAT_STANDALONE_NARROW_MONTHS,
1287  UDAT_STANDALONE_SHORT_QUARTERS,
1301 #ifndef U_HIDE_DRAFT_API
1302  ,
1337 #endif /* U_HIDE_DRAFT_API */
1339 
1340 struct UDateFormatSymbols;
1346 
1363 U_STABLE int32_t U_EXPORT2
1364 udat_getSymbols(const UDateFormat *fmt,
1365  UDateFormatSymbolType type,
1366  int32_t symbolIndex,
1367  UChar *result,
1368  int32_t resultLength,
1369  UErrorCode *status);
1370 
1383 U_STABLE int32_t U_EXPORT2
1384 udat_countSymbols( const UDateFormat *fmt,
1385  UDateFormatSymbolType type);
1386 
1402 U_STABLE void U_EXPORT2
1403 udat_setSymbols( UDateFormat *format,
1404  UDateFormatSymbolType type,
1405  int32_t symbolIndex,
1406  UChar *value,
1407  int32_t valueLength,
1408  UErrorCode *status);
1409 
1419 U_STABLE const char* U_EXPORT2
1421  ULocDataLocaleType type,
1422  UErrorCode* status);
1423 
1432 U_DRAFT void U_EXPORT2
1434 
1435 #ifndef U_HIDE_DRAFT_API
1436 
1445 U_DRAFT UDisplayContext U_EXPORT2
1446 udat_getContext(const UDateFormat* fmt, UDisplayContextType type, UErrorCode* status);
1447 
1448 #endif /* U_HIDE_DRAFT_API */
1449 
1450 #ifndef U_HIDE_INTERNAL_API
1451 
1462 U_INTERNAL int32_t U_EXPORT2
1464  UChar *result,
1465  int32_t resultLength,
1466  UErrorCode *status);
1467 
1479 U_INTERNAL int32_t U_EXPORT2
1481  UChar *result,
1482  int32_t resultLength,
1483  UErrorCode *status);
1484 
1497 U_INTERNAL void U_EXPORT2
1499  const UChar *datePattern,
1500  int32_t datePatternLength,
1501  const UChar *timePattern,
1502  int32_t timePatternLength,
1503  UErrorCode *status);
1504 
1509 typedef UDateFormat* (U_EXPORT2 *UDateFormatOpener) (UDateFormatStyle timeStyle,
1510  UDateFormatStyle dateStyle,
1511  const char *locale,
1512  const UChar *tzID,
1513  int32_t tzIDLength,
1514  const UChar *pattern,
1515  int32_t patternLength,
1516  UErrorCode *status);
1517 
1522 U_INTERNAL void U_EXPORT2
1524 
1529 U_INTERNAL UDateFormatOpener U_EXPORT2
1531 #endif /* U_HIDE_INTERNAL_API */
1532 
1533 
1534 #endif /* #if !UCONFIG_NO_FORMATTING */
1535 
1536 #endif