ICU 49.1.1  49.1.1
udat.h
Go to the documentation of this file.
1 /*
2  *******************************************************************************
3  * Copyright (C) 1996-2012, 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"
139 typedef void* UDateFormat;
140 
144 typedef enum UDateFormatStyle {
155 
157  UDAT_RELATIVE = (1 << 7),
158 
159  UDAT_FULL_RELATIVE = UDAT_FULL | UDAT_RELATIVE,
160 
161  UDAT_LONG_RELATIVE = UDAT_LONG | UDAT_RELATIVE,
162 
163  UDAT_MEDIUM_RELATIVE = UDAT_MEDIUM | UDAT_RELATIVE,
164 
165  UDAT_SHORT_RELATIVE = UDAT_SHORT | UDAT_RELATIVE,
166 
167 
169  UDAT_NONE = -1,
172 
174 
175 /* Cannot use #ifndef U_HIDE_DRAFT_API for UDateFormatContextType and UDateFormatContextValue
176  * since a SimpleDateFormat virtual method & data member depends on them */
188 
202 #if !UCONFIG_NO_BREAK_ITERATION
203 
229 #endif
231 
263 #define UDAT_MINUTE_SECOND "ms"
264 #define UDAT_HOUR24_MINUTE "Hm"
265 #define UDAT_HOUR24_MINUTE_SECOND "Hms"
266 #define UDAT_HOUR_MINUTE_SECOND "hms"
267 #define UDAT_STANDALONE_MONTH "LLLL"
268 #define UDAT_ABBR_STANDALONE_MONTH "LLL"
269 #define UDAT_YEAR_QUARTER "yQQQ"
270 #define UDAT_YEAR_ABBR_QUARTER "yQ"
271 
282 #define UDAT_HOUR_MINUTE "hm"
283 #define UDAT_YEAR "y"
284 #define UDAT_DAY "d"
285 #define UDAT_NUM_MONTH_WEEKDAY_DAY "MEd"
286 #define UDAT_YEAR_NUM_MONTH "yM"
287 #define UDAT_NUM_MONTH_DAY "Md"
288 #define UDAT_YEAR_NUM_MONTH_WEEKDAY_DAY "yMEd"
289 #define UDAT_ABBR_MONTH_WEEKDAY_DAY "MMMEd"
290 #define UDAT_YEAR_MONTH "yMMMM"
291 #define UDAT_YEAR_ABBR_MONTH "yMMM"
292 #define UDAT_MONTH_DAY "MMMMd"
293 #define UDAT_ABBR_MONTH_DAY "MMMd"
294 #define UDAT_MONTH_WEEKDAY_DAY "MMMMEEEEd"
295 #define UDAT_YEAR_ABBR_MONTH_WEEKDAY_DAY "yMMMEd"
296 #define UDAT_YEAR_MONTH_WEEKDAY_DAY "yMMMMEEEEd"
297 #define UDAT_YEAR_MONTH_DAY "yMMMMd"
298 #define UDAT_YEAR_ABBR_MONTH_DAY "yMMMd"
299 #define UDAT_YEAR_NUM_MONTH_DAY "yMd"
300 #define UDAT_NUM_MONTH "M"
301 #define UDAT_ABBR_MONTH "MMM"
302 #define UDAT_MONTH "MMMM"
303 #define UDAT_HOUR_MINUTE_GENERIC_TZ "hmv"
304 #define UDAT_HOUR_MINUTE_TZ "hmz"
305 #define UDAT_HOUR "h"
306 #define UDAT_HOUR_GENERIC_TZ "hv"
307 #define UDAT_HOUR_TZ "hz"
308 
317 typedef enum UDateFormatField {
324 
331 
338 
345 
354 
363 
370 
377 
384 
391 
398 
405 
412 
419 
426 
435 
444 
452 
459 
466 
473 
480 
487 
495 
509 
517 
526 
535 
542 
551 
561 
563 
564 
575 
576 
602 U_STABLE UDateFormat* U_EXPORT2
603 udat_open(UDateFormatStyle timeStyle,
604  UDateFormatStyle dateStyle,
605  const char *locale,
606  const UChar *tzID,
607  int32_t tzIDLength,
608  const UChar *pattern,
609  int32_t patternLength,
610  UErrorCode *status);
611 
612 
619 U_STABLE void U_EXPORT2
620 udat_close(UDateFormat* format);
621 
622 #if U_SHOW_CPLUSPLUS_API
623 
625 
635 U_DEFINE_LOCAL_OPEN_POINTER(LocalUDateFormatPointer, UDateFormat, udat_close);
636 
638 
639 #endif
640 
649 U_STABLE UDateFormat* U_EXPORT2
650 udat_clone(const UDateFormat *fmt,
651  UErrorCode *status);
652 
671 U_STABLE int32_t U_EXPORT2
672 udat_format( const UDateFormat* format,
673  UDate dateToFormat,
674  UChar* result,
675  int32_t resultLength,
676  UFieldPosition* position,
677  UErrorCode* status);
678 
704 U_STABLE UDate U_EXPORT2
705 udat_parse(const UDateFormat* format,
706  const UChar* text,
707  int32_t textLength,
708  int32_t *parsePos,
709  UErrorCode *status);
710 
732 U_STABLE void U_EXPORT2
733 udat_parseCalendar(const UDateFormat* format,
734  UCalendar* calendar,
735  const UChar* text,
736  int32_t textLength,
737  int32_t *parsePos,
738  UErrorCode *status);
739 
749 U_STABLE UBool U_EXPORT2
750 udat_isLenient(const UDateFormat* fmt);
751 
761 U_STABLE void U_EXPORT2
763  UBool isLenient);
764 
774 U_STABLE const UCalendar* U_EXPORT2
775 udat_getCalendar(const UDateFormat* fmt);
776 
786 U_STABLE void U_EXPORT2
788  const UCalendar* calendarToSet);
789 
799 U_STABLE const UNumberFormat* U_EXPORT2
801 
811 U_STABLE void U_EXPORT2
813  const UNumberFormat* numberFormatToSet);
814 
824 U_STABLE const char* U_EXPORT2
825 udat_getAvailable(int32_t localeIndex);
826 
835 U_STABLE int32_t U_EXPORT2
836 udat_countAvailable(void);
837 
848 U_STABLE UDate U_EXPORT2
850  UErrorCode *status);
851 
862 U_STABLE void U_EXPORT2
864  UDate d,
865  UErrorCode *status);
866 
879 U_STABLE int32_t U_EXPORT2
880 udat_toPattern( const UDateFormat *fmt,
881  UBool localized,
882  UChar *result,
883  int32_t resultLength,
884  UErrorCode *status);
885 
896 U_STABLE void U_EXPORT2
898  UBool localized,
899  const UChar *pattern,
900  int32_t patternLength);
901 
906 typedef enum UDateFormatSymbolType {
929  UDAT_STANDALONE_SHORT_MONTHS,
930  UDAT_STANDALONE_NARROW_MONTHS,
933  UDAT_STANDALONE_SHORT_WEEKDAYS,
934  UDAT_STANDALONE_NARROW_WEEKDAYS,
941  UDAT_STANDALONE_SHORT_QUARTERS
942 
944 
945 struct UDateFormatSymbols;
951 
968 U_STABLE int32_t U_EXPORT2
969 udat_getSymbols(const UDateFormat *fmt,
971  int32_t symbolIndex,
972  UChar *result,
973  int32_t resultLength,
974  UErrorCode *status);
975 
988 U_STABLE int32_t U_EXPORT2
989 udat_countSymbols( const UDateFormat *fmt,
990  UDateFormatSymbolType type);
991 
1007 U_STABLE void U_EXPORT2
1008 udat_setSymbols( UDateFormat *format,
1009  UDateFormatSymbolType type,
1010  int32_t symbolIndex,
1011  UChar *value,
1012  int32_t valueLength,
1013  UErrorCode *status);
1014 
1024 U_STABLE const char* U_EXPORT2
1026  ULocDataLocaleType type,
1027  UErrorCode* status);
1028 
1029 #ifndef U_HIDE_DRAFT_API
1030 
1039 U_DRAFT void U_EXPORT2
1042  UErrorCode* status);
1043 
1053 U_DRAFT int32_t U_EXPORT2
1056  UErrorCode* status);
1057 #endif /* U_HIDE_DRAFT_API */
1058 
1059 #ifndef U_HIDE_INTERNAL_API
1060 
1071 U_INTERNAL int32_t U_EXPORT2
1073  UChar *result,
1074  int32_t resultLength,
1075  UErrorCode *status);
1076 
1088 U_INTERNAL int32_t U_EXPORT2
1090  UChar *result,
1091  int32_t resultLength,
1092  UErrorCode *status);
1093 
1106 U_INTERNAL void U_EXPORT2
1108  const UChar *datePattern,
1109  int32_t datePatternLength,
1110  const UChar *timePattern,
1111  int32_t timePatternLength,
1112  UErrorCode *status);
1113 #endif /* U_HIDE_INTERNAL_API */
1114 
1119 typedef UDateFormat* (U_EXPORT2 *UDateFormatOpener) (UDateFormatStyle timeStyle,
1120  UDateFormatStyle dateStyle,
1121  const char *locale,
1122  const UChar *tzID,
1123  int32_t tzIDLength,
1124  const UChar *pattern,
1125  int32_t patternLength,
1126  UErrorCode *status);
1127 
1132 U_INTERNAL void U_EXPORT2
1134 
1139 U_INTERNAL UDateFormatOpener U_EXPORT2
1141 
1142 
1143 #endif /* #if !UCONFIG_NO_FORMATTING */
1144 
1145 #endif