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

- File List
- Globals

# udat.h

Go to the documentation of this file.

    00001 /*
    00002  *******************************************************************************
    00003  * Copyright (C) 1996-2010, 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/localpointer.h"
    00016 #include "unicode/ucal.h"
    00017 #include "unicode/unum.h"
    00139 typedef void* UDateFormat;
    00140
    00144 typedef enum UDateFormatStyle {
    00146     UDAT_FULL,
    00148     UDAT_LONG,
    00150     UDAT_MEDIUM,
    00152     UDAT_SHORT,
    00154     UDAT_DEFAULT = UDAT_MEDIUM,
    00155
    00157     UDAT_RELATIVE = (1 << 7),
    00158
    00159     UDAT_FULL_RELATIVE = UDAT_FULL | UDAT_RELATIVE,
    00160
    00161     UDAT_LONG_RELATIVE = UDAT_LONG | UDAT_RELATIVE,
    00162
    00163     UDAT_MEDIUM_RELATIVE = UDAT_MEDIUM | UDAT_RELATIVE,
    00164
    00165     UDAT_SHORT_RELATIVE = UDAT_SHORT | UDAT_RELATIVE,
    00166
    00167
    00169     UDAT_NONE = -1,
    00171     UDAT_IGNORE = -2
    00172
    00173 } UDateFormatStyle;
    00174
    00175
    00207 #define UDAT_MINUTE_SECOND              "ms"
    00208 #define UDAT_HOUR24_MINUTE              "Hm"
    00209 #define UDAT_HOUR24_MINUTE_SECOND       "Hms"
    00210 #define UDAT_HOUR_MINUTE_SECOND         "hms"
    00211 #define UDAT_STANDALONE_MONTH           "LLLL"
    00212 #define UDAT_ABBR_STANDALONE_MONTH      "LLL"
    00213 #define UDAT_YEAR_QUARTER               "yQQQ"
    00214 #define UDAT_YEAR_ABBR_QUARTER          "yQ"
    00215
    00226 #define UDAT_HOUR_MINUTE                "hm"
    00227 #define UDAT_YEAR                       "y"
    00228 #define UDAT_DAY                        "d"
    00229 #define UDAT_NUM_MONTH_WEEKDAY_DAY      "MEd"
    00230 #define UDAT_YEAR_NUM_MONTH             "yM"
    00231 #define UDAT_NUM_MONTH_DAY              "Md"
    00232 #define UDAT_YEAR_NUM_MONTH_WEEKDAY_DAY "yMEd"
    00233 #define UDAT_ABBR_MONTH_WEEKDAY_DAY     "MMMEd"
    00234 #define UDAT_YEAR_MONTH                 "yMMMM"
    00235 #define UDAT_YEAR_ABBR_MONTH            "yMMM"
    00236 #define UDAT_MONTH_DAY                  "MMMMd"
    00237 #define UDAT_ABBR_MONTH_DAY             "MMMd"
    00238 #define UDAT_MONTH_WEEKDAY_DAY          "MMMMEEEEd"
    00239 #define UDAT_YEAR_ABBR_MONTH_WEEKDAY_DAY "yMMMEd"
    00240 #define UDAT_YEAR_MONTH_WEEKDAY_DAY     "yMMMMEEEEd"
    00241 #define UDAT_YEAR_MONTH_DAY             "yMMMMd"
    00242 #define UDAT_YEAR_ABBR_MONTH_DAY        "yMMMd"
    00243 #define UDAT_YEAR_NUM_MONTH_DAY         "yMd"
    00244 #define UDAT_NUM_MONTH                  "M"
    00245 #define UDAT_ABBR_MONTH                 "MMM"
    00246 #define UDAT_MONTH                      "MMMM"
    00247 #define UDAT_HOUR_MINUTE_GENERIC_TZ     "hmv"
    00248 #define UDAT_HOUR_MINUTE_TZ             "hmz"
    00249 #define UDAT_HOUR                       "h"
    00250 #define UDAT_HOUR_GENERIC_TZ            "hv"
    00251 #define UDAT_HOUR_TZ                    "hz"
    00252
    00261 typedef enum UDateFormatField {
    00267     UDAT_ERA_FIELD = 0,
    00268
    00274     UDAT_YEAR_FIELD = 1,
    00275
    00281     UDAT_MONTH_FIELD = 2,
    00282
    00288     UDAT_DATE_FIELD = 3,
    00289
    00297     UDAT_HOUR_OF_DAY1_FIELD = 4,
    00298
    00306     UDAT_HOUR_OF_DAY0_FIELD = 5,
    00307
    00313     UDAT_MINUTE_FIELD = 6,
    00314
    00320     UDAT_SECOND_FIELD = 7,
    00321
    00327     UDAT_FRACTIONAL_SECOND_FIELD = 8,
    00328
    00334     UDAT_DAY_OF_WEEK_FIELD = 9,
    00335
    00341     UDAT_DAY_OF_YEAR_FIELD = 10,
    00342
    00348     UDAT_DAY_OF_WEEK_IN_MONTH_FIELD = 11,
    00349
    00355     UDAT_WEEK_OF_YEAR_FIELD = 12,
    00356
    00362     UDAT_WEEK_OF_MONTH_FIELD = 13,
    00363
    00369     UDAT_AM_PM_FIELD = 14,
    00370
    00378     UDAT_HOUR1_FIELD = 15,
    00379
    00387     UDAT_HOUR0_FIELD = 16,
    00388
    00395     UDAT_TIMEZONE_FIELD = 17,
    00396
    00402     UDAT_YEAR_WOY_FIELD = 18,
    00403
    00409     UDAT_DOW_LOCAL_FIELD = 19,
    00410
    00416     UDAT_EXTENDED_YEAR_FIELD = 20,
    00417
    00423     UDAT_JULIAN_DAY_FIELD = 21,
    00424
    00430     UDAT_MILLISECONDS_IN_DAY_FIELD = 22,
    00431
    00438     UDAT_TIMEZONE_RFC_FIELD = 23,
    00439
    00445     UDAT_TIMEZONE_GENERIC_FIELD = 24,
    00452     UDAT_STANDALONE_DAY_FIELD = 25,
    00453
    00460     UDAT_STANDALONE_MONTH_FIELD = 26,
    00461
    00469     UDAT_QUARTER_FIELD = 27,
    00470
    00478     UDAT_STANDALONE_QUARTER_FIELD = 28,
    00479
    00485     UDAT_TIMEZONE_SPECIAL_FIELD = 29,
    00486
    00495     UDAT_FIELD_COUNT = 30
    00496
    00497 } UDateFormatField;
    00498
    00499
    00508 U_DRAFT UCalendarDateFields U_EXPORT2
    00509 udat_toCalendarDateField(UDateFormatField field);
    00510
    00511
    00533 U_STABLE UDateFormat* U_EXPORT2
    00534 udat_open(UDateFormatStyle  timeStyle,
    00535           UDateFormatStyle  dateStyle,
    00536           const char        *locale,
    00537           const UChar       *tzID,
    00538           int32_t           tzIDLength,
    00539           const UChar       *pattern,
    00540           int32_t           patternLength,
    00541           UErrorCode        *status);
    00542
    00543
    00550 U_STABLE void U_EXPORT2
    00551 udat_close(UDateFormat* format);
    00552
    00553 #if U_SHOW_CPLUSPLUS_API
    00554
    00555 U_NAMESPACE_BEGIN
    00556
    00566 U_DEFINE_LOCAL_OPEN_POINTER(LocalUDateFormatPointer, UDateFormat, udat_close);
    00567
    00568 U_NAMESPACE_END
    00569
    00570 #endif
    00571
    00580 U_STABLE UDateFormat* U_EXPORT2
    00581 udat_clone(const UDateFormat *fmt,
    00582        UErrorCode *status);
    00583
    00602 U_STABLE int32_t U_EXPORT2
    00603 udat_format(    const    UDateFormat*    format,
    00604                         UDate           dateToFormat,
    00605                         UChar*          result,
    00606                         int32_t         resultLength,
    00607                         UFieldPosition* position,
    00608                         UErrorCode*     status);
    00609
    00623 U_STABLE UDate U_EXPORT2
    00624 udat_parse(    const    UDateFormat*    format,
    00625             const    UChar*          text,
    00626                     int32_t         textLength,
    00627                     int32_t         *parsePos,
    00628                     UErrorCode      *status);
    00629
    00643 U_STABLE void U_EXPORT2
    00644 udat_parseCalendar(const    UDateFormat*    format,
    00645                             UCalendar*      calendar,
    00646                    const    UChar*          text,
    00647                             int32_t         textLength,
    00648                             int32_t         *parsePos,
    00649                             UErrorCode      *status);
    00650
    00660 U_STABLE UBool U_EXPORT2
    00661 udat_isLenient(const UDateFormat* fmt);
    00662
    00672 U_STABLE void U_EXPORT2
    00673 udat_setLenient(    UDateFormat*    fmt,
    00674                     UBool          isLenient);
    00675
    00685 U_STABLE const UCalendar* U_EXPORT2
    00686 udat_getCalendar(const UDateFormat* fmt);
    00687
    00697 U_STABLE void U_EXPORT2
    00698 udat_setCalendar(            UDateFormat*    fmt,
    00699                     const   UCalendar*      calendarToSet);
    00700
    00710 U_STABLE const UNumberFormat* U_EXPORT2
    00711 udat_getNumberFormat(const UDateFormat* fmt);
    00712
    00722 U_STABLE void U_EXPORT2
    00723 udat_setNumberFormat(            UDateFormat*    fmt,
    00724                         const   UNumberFormat*  numberFormatToSet);
    00725
    00735 U_STABLE const char* U_EXPORT2
    00736 udat_getAvailable(int32_t localeIndex);
    00737
    00746 U_STABLE int32_t U_EXPORT2
    00747 udat_countAvailable(void);
    00748
    00759 U_STABLE UDate U_EXPORT2
    00760 udat_get2DigitYearStart(    const   UDateFormat     *fmt,
    00761                                     UErrorCode      *status);
    00762
    00773 U_STABLE void U_EXPORT2
    00774 udat_set2DigitYearStart(    UDateFormat     *fmt,
    00775                             UDate           d,
    00776                             UErrorCode      *status);
    00777
    00790 U_STABLE int32_t U_EXPORT2
    00791 udat_toPattern(    const   UDateFormat     *fmt,
    00792                         UBool          localized,
    00793                         UChar           *result,
    00794                         int32_t         resultLength,
    00795                         UErrorCode      *status);
    00796
    00807 U_STABLE void U_EXPORT2
    00808 udat_applyPattern(            UDateFormat     *format,
    00809                             UBool          localized,
    00810                     const   UChar           *pattern,
    00811                             int32_t         patternLength);
    00812
    00817 typedef enum UDateFormatSymbolType {
    00819     UDAT_ERAS,
    00821     UDAT_MONTHS,
    00823     UDAT_SHORT_MONTHS,
    00825     UDAT_WEEKDAYS,
    00827     UDAT_SHORT_WEEKDAYS,
    00829     UDAT_AM_PMS,
    00831     UDAT_LOCALIZED_CHARS,
    00833     UDAT_ERA_NAMES,
    00835     UDAT_NARROW_MONTHS,
    00837     UDAT_NARROW_WEEKDAYS,
    00839     UDAT_STANDALONE_MONTHS,
    00840     UDAT_STANDALONE_SHORT_MONTHS,
    00841     UDAT_STANDALONE_NARROW_MONTHS,
    00843     UDAT_STANDALONE_WEEKDAYS,
    00844     UDAT_STANDALONE_SHORT_WEEKDAYS,
    00845     UDAT_STANDALONE_NARROW_WEEKDAYS,
    00847     UDAT_QUARTERS,
    00849     UDAT_SHORT_QUARTERS,
    00851     UDAT_STANDALONE_QUARTERS,
    00852     UDAT_STANDALONE_SHORT_QUARTERS
    00853
    00854 } UDateFormatSymbolType;
    00855
    00856 struct UDateFormatSymbols;
    00861 typedef struct UDateFormatSymbols UDateFormatSymbols;
    00862
    00879 U_STABLE int32_t U_EXPORT2
    00880 udat_getSymbols(const   UDateFormat             *fmt,
    00881                         UDateFormatSymbolType   type,
    00882                         int32_t                 symbolIndex,
    00883                         UChar                   *result,
    00884                         int32_t                 resultLength,
    00885                         UErrorCode              *status);
    00886
    00899 U_STABLE int32_t U_EXPORT2
    00900 udat_countSymbols(    const    UDateFormat                *fmt,
    00901                             UDateFormatSymbolType    type);
    00902
    00918 U_STABLE void U_EXPORT2
    00919 udat_setSymbols(    UDateFormat             *format,
    00920                     UDateFormatSymbolType   type,
    00921                     int32_t                 symbolIndex,
    00922                     UChar                   *value,
    00923                     int32_t                 valueLength,
    00924                     UErrorCode              *status);
    00925
    00935 U_STABLE const char* U_EXPORT2
    00936 udat_getLocaleByType(const UDateFormat *fmt,
    00937                      ULocDataLocaleType type,
    00938                      UErrorCode* status);
    00939
    00951 U_INTERNAL int32_t U_EXPORT2
    00952 udat_toPatternRelativeDate(const UDateFormat *fmt,
    00953                            UChar             *result,
    00954                            int32_t           resultLength,
    00955                            UErrorCode        *status);
    00956
    00968 U_INTERNAL int32_t U_EXPORT2
    00969 udat_toPatternRelativeTime(const UDateFormat *fmt,
    00970                            UChar             *result,
    00971                            int32_t           resultLength,
    00972                            UErrorCode        *status);
    00973
    00986 U_INTERNAL void U_EXPORT2
    00987 udat_applyPatternRelative(UDateFormat *format,
    00988                           const UChar *datePattern,
    00989                           int32_t     datePatternLength,
    00990                           const UChar *timePattern,
    00991                           int32_t     timePatternLength,
    00992                           UErrorCode  *status);
    00993
    00994
    00995 #endif /* #if !UCONFIG_NO_FORMATTING */
    00996
    00997 #endif

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines