- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- Search for |

- File List
- Globals

# udat.h

Go to the documentation of this file.

    00001 /*
    00002  *******************************************************************************
    00003  * Copyright (C) 1996-2009, International Business Machines
    00004  * Corporation and others. All Rights Reserved.
    00005  *******************************************************************************
    00006 */
    00007
    00008 #ifndef UDAT_H
    00009 #define UDAT_H
    00010
    00011 #include "unicode/utypes.h"
    00012
    00013 #if !UCONFIG_NO_FORMATTING
    00014
    00015 #include "unicode/ucal.h"
    00016 #include "unicode/unum.h"
    00138 typedef void* UDateFormat;
    00139
    00143 typedef enum UDateFormatStyle {
    00145     UDAT_FULL,
    00147     UDAT_LONG,
    00149     UDAT_MEDIUM,
    00151     UDAT_SHORT,
    00153     UDAT_DEFAULT = UDAT_MEDIUM,
    00154
    00156     UDAT_RELATIVE = (1 << 7),
    00157
    00158     UDAT_FULL_RELATIVE = UDAT_FULL | UDAT_RELATIVE,
    00159
    00160     UDAT_LONG_RELATIVE = UDAT_LONG | UDAT_RELATIVE,
    00161
    00162     UDAT_MEDIUM_RELATIVE = UDAT_MEDIUM | UDAT_RELATIVE,
    00163
    00164     UDAT_SHORT_RELATIVE = UDAT_SHORT | UDAT_RELATIVE,
    00165
    00166
    00168     UDAT_NONE = -1,
    00170     UDAT_IGNORE = -2
    00171
    00172 } UDateFormatStyle;
    00173
    00174
    00206 #define UDAT_MINUTE_SECOND              "ms"
    00207 #define UDAT_HOUR24_MINUTE              "Hm"
    00208 #define UDAT_HOUR24_MINUTE_SECOND       "Hms"
    00209 #define UDAT_HOUR_MINUTE_SECOND         "hms"
    00210 #define UDAT_STANDALONE_MONTH           "LLLL"
    00211 #define UDAT_ABBR_STANDALONE_MONTH      "LLL"
    00212 #define UDAT_YEAR_QUARTER               "yQQQ"
    00213 #define UDAT_YEAR_ABBR_QUARTER          "yQ"
    00214
    00224 #define UDAT_HOUR_MINUTE                "hm"
    00225 #define UDAT_YEAR                       "y"
    00226 #define UDAT_DAY                        "d"
    00227 #define UDAT_NUM_MONTH_WEEKDAY_DAY      "MEd"
    00228 #define UDAT_YEAR_NUM_MONTH             "yM"
    00229 #define UDAT_NUM_MONTH_DAY              "Md"
    00230 #define UDAT_YEAR_NUM_MONTH_WEEKDAY_DAY "yMEd"
    00231 #define UDAT_ABBR_MONTH_WEEKDAY_DAY     "MMMEd"
    00232 #define UDAT_YEAR_MONTH                 "yMMMM"
    00233 #define UDAT_YEAR_ABBR_MONTH            "yMMM"
    00234 #define UDAT_MONTH_DAY                  "MMMMd"
    00235 #define UDAT_ABBR_MONTH_DAY             "MMMd"
    00236 #define UDAT_MONTH_WEEKDAY_DAY          "MMMMEEEEd"
    00237 #define UDAT_YEAR_ABBR_MONTH_WEEKDAY_DAY "yMMMEd"
    00238 #define UDAT_YEAR_MONTH_WEEKDAY_DAY     "yMMMMEEEEd"
    00239 #define UDAT_YEAR_MONTH_DAY             "yMMMMd"
    00240 #define UDAT_YEAR_ABBR_MONTH_DAY        "yMMMd"
    00241 #define UDAT_YEAR_NUM_MONTH_DAY         "yMd"
    00242 #define UDAT_NUM_MONTH                  "M"
    00243 #define UDAT_ABBR_MONTH                 "MMM"
    00244 #define UDAT_MONTH                      "MMMM"
    00245 #define UDAT_HOUR_MINUTE_GENERIC_TZ     "hmv"
    00246 #define UDAT_HOUR_MINUTE_TZ             "hmz"
    00247 #define UDAT_HOUR                       "h"
    00248 #define UDAT_HOUR_GENERIC_TZ            "hv"
    00249 #define UDAT_HOUR_TZ                    "hz"
    00250
    00259 typedef enum UDateFormatField {
    00265     UDAT_ERA_FIELD = 0,
    00266
    00272     UDAT_YEAR_FIELD = 1,
    00273
    00279     UDAT_MONTH_FIELD = 2,
    00280
    00286     UDAT_DATE_FIELD = 3,
    00287
    00295     UDAT_HOUR_OF_DAY1_FIELD = 4,
    00296
    00304     UDAT_HOUR_OF_DAY0_FIELD = 5,
    00305
    00311     UDAT_MINUTE_FIELD = 6,
    00312
    00318     UDAT_SECOND_FIELD = 7,
    00319
    00325     UDAT_FRACTIONAL_SECOND_FIELD = 8,
    00326
    00332     UDAT_DAY_OF_WEEK_FIELD = 9,
    00333
    00339     UDAT_DAY_OF_YEAR_FIELD = 10,
    00340
    00346     UDAT_DAY_OF_WEEK_IN_MONTH_FIELD = 11,
    00347
    00353     UDAT_WEEK_OF_YEAR_FIELD = 12,
    00354
    00360     UDAT_WEEK_OF_MONTH_FIELD = 13,
    00361
    00367     UDAT_AM_PM_FIELD = 14,
    00368
    00376     UDAT_HOUR1_FIELD = 15,
    00377
    00385     UDAT_HOUR0_FIELD = 16,
    00386
    00393     UDAT_TIMEZONE_FIELD = 17,
    00394
    00400     UDAT_YEAR_WOY_FIELD = 18,
    00401
    00407     UDAT_DOW_LOCAL_FIELD = 19,
    00408
    00414     UDAT_EXTENDED_YEAR_FIELD = 20,
    00415
    00421     UDAT_JULIAN_DAY_FIELD = 21,
    00422
    00428     UDAT_MILLISECONDS_IN_DAY_FIELD = 22,
    00429
    00436     UDAT_TIMEZONE_RFC_FIELD = 23,
    00437
    00443     UDAT_TIMEZONE_GENERIC_FIELD = 24,
    00450     UDAT_STANDALONE_DAY_FIELD = 25,
    00451
    00458     UDAT_STANDALONE_MONTH_FIELD = 26,
    00459
    00467     UDAT_QUARTER_FIELD = 27,
    00468
    00476     UDAT_STANDALONE_QUARTER_FIELD = 28,
    00477
    00483     UDAT_TIMEZONE_SPECIAL_FIELD = 29,
    00484
    00493     UDAT_FIELD_COUNT = 30
    00494
    00495 } UDateFormatField;
    00496
    00518 U_STABLE UDateFormat* U_EXPORT2
    00519 udat_open(UDateFormatStyle  timeStyle,
    00520           UDateFormatStyle  dateStyle,
    00521           const char        *locale,
    00522           const UChar       *tzID,
    00523           int32_t           tzIDLength,
    00524           const UChar       *pattern,
    00525           int32_t           patternLength,
    00526           UErrorCode        *status);
    00527
    00528
    00535 U_STABLE void U_EXPORT2
    00536 udat_close(UDateFormat* format);
    00537
    00546 U_STABLE UDateFormat* U_EXPORT2
    00547 udat_clone(const UDateFormat *fmt,
    00548        UErrorCode *status);
    00549
    00568 U_STABLE int32_t U_EXPORT2
    00569 udat_format(    const    UDateFormat*    format,
    00570                         UDate           dateToFormat,
    00571                         UChar*          result,
    00572                         int32_t         resultLength,
    00573                         UFieldPosition* position,
    00574                         UErrorCode*     status);
    00575
    00589 U_STABLE UDate U_EXPORT2
    00590 udat_parse(    const    UDateFormat*    format,
    00591             const    UChar*          text,
    00592                     int32_t         textLength,
    00593                     int32_t         *parsePos,
    00594                     UErrorCode      *status);
    00595
    00609 U_STABLE void U_EXPORT2
    00610 udat_parseCalendar(const    UDateFormat*    format,
    00611                             UCalendar*      calendar,
    00612                    const    UChar*          text,
    00613                             int32_t         textLength,
    00614                             int32_t         *parsePos,
    00615                             UErrorCode      *status);
    00616
    00626 U_STABLE UBool U_EXPORT2
    00627 udat_isLenient(const UDateFormat* fmt);
    00628
    00638 U_STABLE void U_EXPORT2
    00639 udat_setLenient(    UDateFormat*    fmt,
    00640                     UBool          isLenient);
    00641
    00651 U_STABLE const UCalendar* U_EXPORT2
    00652 udat_getCalendar(const UDateFormat* fmt);
    00653
    00663 U_STABLE void U_EXPORT2
    00664 udat_setCalendar(            UDateFormat*    fmt,
    00665                     const   UCalendar*      calendarToSet);
    00666
    00676 U_STABLE const UNumberFormat* U_EXPORT2
    00677 udat_getNumberFormat(const UDateFormat* fmt);
    00678
    00688 U_STABLE void U_EXPORT2
    00689 udat_setNumberFormat(            UDateFormat*    fmt,
    00690                         const   UNumberFormat*  numberFormatToSet);
    00691
    00701 U_STABLE const char* U_EXPORT2
    00702 udat_getAvailable(int32_t localeIndex);
    00703
    00712 U_STABLE int32_t U_EXPORT2
    00713 udat_countAvailable(void);
    00714
    00725 U_STABLE UDate U_EXPORT2
    00726 udat_get2DigitYearStart(    const   UDateFormat     *fmt,
    00727                                     UErrorCode      *status);
    00728
    00739 U_STABLE void U_EXPORT2
    00740 udat_set2DigitYearStart(    UDateFormat     *fmt,
    00741                             UDate           d,
    00742                             UErrorCode      *status);
    00743
    00756 U_STABLE int32_t U_EXPORT2
    00757 udat_toPattern(    const   UDateFormat     *fmt,
    00758                         UBool          localized,
    00759                         UChar           *result,
    00760                         int32_t         resultLength,
    00761                         UErrorCode      *status);
    00762
    00773 U_STABLE void U_EXPORT2
    00774 udat_applyPattern(            UDateFormat     *format,
    00775                             UBool          localized,
    00776                     const   UChar           *pattern,
    00777                             int32_t         patternLength);
    00778
    00783 typedef enum UDateFormatSymbolType {
    00785     UDAT_ERAS,
    00787     UDAT_MONTHS,
    00789     UDAT_SHORT_MONTHS,
    00791     UDAT_WEEKDAYS,
    00793     UDAT_SHORT_WEEKDAYS,
    00795     UDAT_AM_PMS,
    00797     UDAT_LOCALIZED_CHARS,
    00799     UDAT_ERA_NAMES,
    00801     UDAT_NARROW_MONTHS,
    00803     UDAT_NARROW_WEEKDAYS,
    00805     UDAT_STANDALONE_MONTHS,
    00806     UDAT_STANDALONE_SHORT_MONTHS,
    00807     UDAT_STANDALONE_NARROW_MONTHS,
    00809     UDAT_STANDALONE_WEEKDAYS,
    00810     UDAT_STANDALONE_SHORT_WEEKDAYS,
    00811     UDAT_STANDALONE_NARROW_WEEKDAYS,
    00813     UDAT_QUARTERS,
    00815     UDAT_SHORT_QUARTERS,
    00817     UDAT_STANDALONE_QUARTERS,
    00818     UDAT_STANDALONE_SHORT_QUARTERS
    00819
    00820 } UDateFormatSymbolType;
    00821
    00822 struct UDateFormatSymbols;
    00827 typedef struct UDateFormatSymbols UDateFormatSymbols;
    00828
    00845 U_STABLE int32_t U_EXPORT2
    00846 udat_getSymbols(const   UDateFormat             *fmt,
    00847                         UDateFormatSymbolType   type,
    00848                         int32_t                 symbolIndex,
    00849                         UChar                   *result,
    00850                         int32_t                 resultLength,
    00851                         UErrorCode              *status);
    00852
    00865 U_STABLE int32_t U_EXPORT2
    00866 udat_countSymbols(    const    UDateFormat                *fmt,
    00867                             UDateFormatSymbolType    type);
    00868
    00884 U_STABLE void U_EXPORT2
    00885 udat_setSymbols(    UDateFormat             *format,
    00886                     UDateFormatSymbolType   type,
    00887                     int32_t                 symbolIndex,
    00888                     UChar                   *value,
    00889                     int32_t                 valueLength,
    00890                     UErrorCode              *status);
    00891
    00901 U_STABLE const char* U_EXPORT2
    00902 udat_getLocaleByType(const UDateFormat *fmt,
    00903                      ULocDataLocaleType type,
    00904                      UErrorCode* status);
    00905
    00917 U_INTERNAL int32_t U_EXPORT2
    00918 udat_toPatternRelativeDate(const UDateFormat *fmt,
    00919                            UChar             *result,
    00920                            int32_t           resultLength,
    00921                            UErrorCode        *status);
    00922
    00934 U_INTERNAL int32_t U_EXPORT2
    00935 udat_toPatternRelativeTime(const UDateFormat *fmt,
    00936                            UChar             *result,
    00937                            int32_t           resultLength,
    00938                            UErrorCode        *status);
    00939
    00952 U_INTERNAL void U_EXPORT2
    00953 udat_applyPatternRelative(UDateFormat *format,
    00954                           const UChar *datePattern,
    00955                           int32_t     datePatternLength,
    00956                           const UChar *timePattern,
    00957                           int32_t     timePatternLength,
    00958                           UErrorCode  *status);
    00959
    00960 #endif /* #if !UCONFIG_NO_FORMATTING */
    00961
    00962 #endif