ICU 51.2  51.2
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"
18 #include "unicode/udisplaycontext.h"
140 typedef void* UDateFormat;
141 
145 typedef enum UDateFormatStyle {
156 
158  UDAT_RELATIVE = (1 << 7),
159 
160  UDAT_FULL_RELATIVE = UDAT_FULL | UDAT_RELATIVE,
161 
162  UDAT_LONG_RELATIVE = UDAT_LONG | UDAT_RELATIVE,
163 
164  UDAT_MEDIUM_RELATIVE = UDAT_MEDIUM | UDAT_RELATIVE,
165 
166  UDAT_SHORT_RELATIVE = UDAT_SHORT | UDAT_RELATIVE,
167 
168 
170  UDAT_NONE = -1,
171 
172 #ifndef U_HIDE_DRAFT_API
179 
182 #endif /* U_HIDE_DRAFT_API */
184 
185 // Skeletons for dates.
186 
191 #define UDAT_YEAR "y"
192 #ifndef U_HIDE_DRAFT_API
193 
197 #define UDAT_QUARTER "QQQQ"
198 
202 #define UDAT_ABBR_QUARTER "QQQ"
203 #endif /* U_HIDE_DRAFT_API */
204 
208 #define UDAT_YEAR_QUARTER "yQQQQ"
209 
213 #define UDAT_YEAR_ABBR_QUARTER "yQQQ"
214 
218 #define UDAT_MONTH "MMMM"
219 
223 #define UDAT_ABBR_MONTH "MMM"
224 
228 #define UDAT_NUM_MONTH "M"
229 
233 #define UDAT_YEAR_MONTH "yMMMM"
234 
238 #define UDAT_YEAR_ABBR_MONTH "yMMM"
239 
243 #define UDAT_YEAR_NUM_MONTH "yM"
244 
248 #define UDAT_DAY "d"
249 
254 #define UDAT_YEAR_MONTH_DAY "yMMMMd"
255 
260 #define UDAT_YEAR_ABBR_MONTH_DAY "yMMMd"
261 
266 #define UDAT_YEAR_NUM_MONTH_DAY "yMd"
267 #ifndef U_HIDE_DRAFT_API
268 
272 #define UDAT_WEEKDAY "EEEE"
273 
277 #define UDAT_ABBR_WEEKDAY "E"
278 #endif /* U_HIDE_DRAFT_API */
279 
284 #define UDAT_YEAR_MONTH_WEEKDAY_DAY "yMMMMEEEEd"
285 
290 #define UDAT_YEAR_ABBR_MONTH_WEEKDAY_DAY "yMMMEd"
291 
296 #define UDAT_YEAR_NUM_MONTH_WEEKDAY_DAY "yMEd"
297 
302 #define UDAT_MONTH_DAY "MMMMd"
303 
308 #define UDAT_ABBR_MONTH_DAY "MMMd"
309 
314 #define UDAT_NUM_MONTH_DAY "Md"
315 
320 #define UDAT_MONTH_WEEKDAY_DAY "MMMMEEEEd"
321 
326 #define UDAT_ABBR_MONTH_WEEKDAY_DAY "MMMEd"
327 
332 #define UDAT_NUM_MONTH_WEEKDAY_DAY "MEd"
333 
334 // Skeletons for times.
335 
340 #define UDAT_HOUR "j"
341 #ifndef U_HIDE_DRAFT_API
342 
346 #define UDAT_HOUR24 "H"
347 
351 #define UDAT_MINUTE "m"
352 #endif /* U_HIDE_DRAFT_API */
353 
358 #define UDAT_HOUR_MINUTE "jm"
359 
364 #define UDAT_HOUR24_MINUTE "Hm"
365 #ifndef U_HIDE_DRAFT_API
366 
370 #define UDAT_SECOND "s"
371 #endif /* U_HIDE_DRAFT_API */
372 
378 #define UDAT_HOUR_MINUTE_SECOND "jms"
379 
385 #define UDAT_HOUR24_MINUTE_SECOND "Hms"
386 
391 #define UDAT_MINUTE_SECOND "ms"
392 
393 // Skeletons for time zones.
394 
395 #ifndef U_HIDE_DRAFT_API
396 
403 #define UDAT_LOCATION_TZ "VVVV"
404 
411 #define UDAT_GENERIC_TZ "vvvv"
412 
419 #define UDAT_ABBR_GENERIC_TZ "v"
420 
427 #define UDAT_SPECIFIC_TZ "zzzz"
428 
435 #define UDAT_ABBR_SPECIFIC_TZ "z"
436 
443 #define UDAT_ABBR_UTC_TZ "ZZZZ"
444 #endif /* U_HIDE_DRAFT_API */
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 
730 #ifndef U_HIDE_DRAFT_API
731 
738 
746 
754 #endif /* U_HIDE_DRAFT_API */
755 
765 
767 
768 
779 
780 
809 U_STABLE UDateFormat* U_EXPORT2
810 udat_open(UDateFormatStyle timeStyle,
811  UDateFormatStyle dateStyle,
812  const char *locale,
813  const UChar *tzID,
814  int32_t tzIDLength,
815  const UChar *pattern,
816  int32_t patternLength,
817  UErrorCode *status);
818 
819 
826 U_STABLE void U_EXPORT2
827 udat_close(UDateFormat* format);
828 
829 #if U_SHOW_CPLUSPLUS_API
830 
832 
843 
845 
846 #endif
847 
856 U_STABLE UDateFormat* U_EXPORT2
857 udat_clone(const UDateFormat *fmt,
858  UErrorCode *status);
859 
878 U_STABLE int32_t U_EXPORT2
879 udat_format( const UDateFormat* format,
880  UDate dateToFormat,
881  UChar* result,
882  int32_t resultLength,
883  UFieldPosition* position,
884  UErrorCode* status);
885 
911 U_STABLE UDate U_EXPORT2
912 udat_parse(const UDateFormat* format,
913  const UChar* text,
914  int32_t textLength,
915  int32_t *parsePos,
916  UErrorCode *status);
917 
939 U_STABLE void U_EXPORT2
940 udat_parseCalendar(const UDateFormat* format,
941  UCalendar* calendar,
942  const UChar* text,
943  int32_t textLength,
944  int32_t *parsePos,
945  UErrorCode *status);
946 
956 U_STABLE UBool U_EXPORT2
957 udat_isLenient(const UDateFormat* fmt);
958 
968 U_STABLE void U_EXPORT2
970  UBool isLenient);
971 
981 U_STABLE const UCalendar* U_EXPORT2
982 udat_getCalendar(const UDateFormat* fmt);
983 
993 U_STABLE void U_EXPORT2
995  const UCalendar* calendarToSet);
996 
1006 U_STABLE const UNumberFormat* U_EXPORT2
1007 udat_getNumberFormat(const UDateFormat* fmt);
1008 
1018 U_STABLE void U_EXPORT2
1020  const UNumberFormat* numberFormatToSet);
1021 
1031 U_STABLE const char* U_EXPORT2
1032 udat_getAvailable(int32_t localeIndex);
1033 
1042 U_STABLE int32_t U_EXPORT2
1043 udat_countAvailable(void);
1044 
1055 U_STABLE UDate U_EXPORT2
1057  UErrorCode *status);
1058 
1069 U_STABLE void U_EXPORT2
1071  UDate d,
1072  UErrorCode *status);
1073 
1086 U_STABLE int32_t U_EXPORT2
1087 udat_toPattern( const UDateFormat *fmt,
1088  UBool localized,
1089  UChar *result,
1090  int32_t resultLength,
1091  UErrorCode *status);
1092 
1103 U_STABLE void U_EXPORT2
1105  UBool localized,
1106  const UChar *pattern,
1107  int32_t patternLength);
1108 
1139  UDAT_STANDALONE_SHORT_MONTHS,
1140  UDAT_STANDALONE_NARROW_MONTHS,
1156  UDAT_STANDALONE_SHORT_QUARTERS,
1157 #ifndef U_HIDE_DRAFT_API
1158 
1171 #endif /* U_HIDE_DRAFT_API */
1173 
1174 struct UDateFormatSymbols;
1180 
1197 U_STABLE int32_t U_EXPORT2
1198 udat_getSymbols(const UDateFormat *fmt,
1199  UDateFormatSymbolType type,
1200  int32_t symbolIndex,
1201  UChar *result,
1202  int32_t resultLength,
1203  UErrorCode *status);
1204 
1217 U_STABLE int32_t U_EXPORT2
1218 udat_countSymbols( const UDateFormat *fmt,
1219  UDateFormatSymbolType type);
1220 
1236 U_STABLE void U_EXPORT2
1237 udat_setSymbols( UDateFormat *format,
1238  UDateFormatSymbolType type,
1239  int32_t symbolIndex,
1240  UChar *value,
1241  int32_t valueLength,
1242  UErrorCode *status);
1243 
1253 U_STABLE const char* U_EXPORT2
1255  ULocDataLocaleType type,
1256  UErrorCode* status);
1257 
1258 #ifndef U_HIDE_DRAFT_API
1259 
1267 U_DRAFT void U_EXPORT2
1268 udat_setContext(UDateFormat* fmt, UDisplayContext value, UErrorCode* status);
1269 
1279 U_DRAFT UDisplayContext U_EXPORT2
1280 udat_getContext(UDateFormat* fmt, UDisplayContextType type, UErrorCode* status);
1281 
1282 #endif /* U_HIDE_DRAFT_API */
1283 
1284 #ifndef U_HIDE_INTERNAL_API
1285 
1296 U_INTERNAL int32_t U_EXPORT2
1298  UChar *result,
1299  int32_t resultLength,
1300  UErrorCode *status);
1301 
1313 U_INTERNAL int32_t U_EXPORT2
1315  UChar *result,
1316  int32_t resultLength,
1317  UErrorCode *status);
1318 
1331 U_INTERNAL void U_EXPORT2
1333  const UChar *datePattern,
1334  int32_t datePatternLength,
1335  const UChar *timePattern,
1336  int32_t timePatternLength,
1337  UErrorCode *status);
1338 
1343 typedef UDateFormat* (U_EXPORT2 *UDateFormatOpener) (UDateFormatStyle timeStyle,
1344  UDateFormatStyle dateStyle,
1345  const char *locale,
1346  const UChar *tzID,
1347  int32_t tzIDLength,
1348  const UChar *pattern,
1349  int32_t patternLength,
1350  UErrorCode *status);
1351 
1356 U_INTERNAL void U_EXPORT2
1358 
1363 U_INTERNAL UDateFormatOpener U_EXPORT2
1365 #endif /* U_HIDE_INTERNAL_API */
1366 
1367 
1368 #endif /* #if !UCONFIG_NO_FORMATTING */
1369 
1370 #endif