intl/icu/source/i18n/unicode/udat.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/intl/icu/source/i18n/unicode/udat.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,1433 @@
     1.4 +/*
     1.5 + *******************************************************************************
     1.6 + * Copyright (C) 1996-2013, International Business Machines
     1.7 + * Corporation and others. All Rights Reserved.
     1.8 + *******************************************************************************
     1.9 +*/
    1.10 +
    1.11 +#ifndef UDAT_H
    1.12 +#define UDAT_H
    1.13 +
    1.14 +#include "unicode/utypes.h"
    1.15 +
    1.16 +#if !UCONFIG_NO_FORMATTING
    1.17 +
    1.18 +#include "unicode/localpointer.h"
    1.19 +#include "unicode/ucal.h"
    1.20 +#include "unicode/unum.h"
    1.21 +#include "unicode/udisplaycontext.h"
    1.22 +/**
    1.23 + * \file
    1.24 + * \brief C API: DateFormat
    1.25 + *
    1.26 + * <h2> Date Format C API</h2>
    1.27 + *
    1.28 + * Date Format C API  consists of functions that convert dates and
    1.29 + * times from their internal representations to textual form and back again in a
    1.30 + * language-independent manner. Converting from the internal representation (milliseconds
    1.31 + * since midnight, January 1, 1970) to text is known as "formatting," and converting
    1.32 + * from text to millis is known as "parsing."  We currently define only one concrete
    1.33 + * structure UDateFormat, which can handle pretty much all normal
    1.34 + * date formatting and parsing actions.
    1.35 + * <P>
    1.36 + * Date Format helps you to format and parse dates for any locale. Your code can
    1.37 + * be completely independent of the locale conventions for months, days of the
    1.38 + * week, or even the calendar format: lunar vs. solar.
    1.39 + * <P>
    1.40 + * To format a date for the current Locale with default time and date style,
    1.41 + * use one of the static factory methods:
    1.42 + * <pre>
    1.43 + * \code
    1.44 + *  UErrorCode status = U_ZERO_ERROR;
    1.45 + *  UChar *myString;
    1.46 + *  int32_t myStrlen = 0;
    1.47 + *  UDateFormat* dfmt = udat_open(UDAT_DEFAULT, UDAT_DEFAULT, NULL, NULL, -1, NULL, -1, &status);
    1.48 + *  myStrlen = udat_format(dfmt, myDate, NULL, myStrlen, NULL, &status);
    1.49 + *  if (status==U_BUFFER_OVERFLOW_ERROR){
    1.50 + *      status=U_ZERO_ERROR;
    1.51 + *      myString=(UChar*)malloc(sizeof(UChar) * (myStrlen+1) );
    1.52 + *      udat_format(dfmt, myDate, myString, myStrlen+1, NULL, &status);
    1.53 + *  }
    1.54 + * \endcode
    1.55 + * </pre>
    1.56 + * If you are formatting multiple numbers, it is more efficient to get the
    1.57 + * format and use it multiple times so that the system doesn't have to fetch the
    1.58 + * information about the local language and country conventions multiple times.
    1.59 + * <pre>
    1.60 + * \code
    1.61 + *  UErrorCode status = U_ZERO_ERROR;
    1.62 + *  int32_t i, myStrlen = 0;
    1.63 + *  UChar* myString;
    1.64 + *  char buffer[1024];
    1.65 + *  UDate myDateArr[] = { 0.0, 100000000.0, 2000000000.0 }; // test values
    1.66 + *  UDateFormat* df = udat_open(UDAT_DEFAULT, UDAT_DEFAULT, NULL, NULL, -1, NULL, 0, &status);
    1.67 + *  for (i = 0; i < 3; i++) {
    1.68 + *      myStrlen = udat_format(df, myDateArr[i], NULL, myStrlen, NULL, &status);
    1.69 + *      if(status == U_BUFFER_OVERFLOW_ERROR){
    1.70 + *          status = U_ZERO_ERROR;
    1.71 + *          myString = (UChar*)malloc(sizeof(UChar) * (myStrlen+1) );
    1.72 + *          udat_format(df, myDateArr[i], myString, myStrlen+1, NULL, &status);
    1.73 + *          printf("%s\n", u_austrcpy(buffer, myString) );
    1.74 + *          free(myString);
    1.75 + *      }
    1.76 + *  }
    1.77 + * \endcode
    1.78 + * </pre>
    1.79 + * To get specific fields of a date, you can use UFieldPosition to
    1.80 + * get specific fields.
    1.81 + * <pre>
    1.82 + * \code
    1.83 + *  UErrorCode status = U_ZERO_ERROR;
    1.84 + *  UFieldPosition pos;
    1.85 + *  UChar *myString;
    1.86 + *  int32_t myStrlen = 0;
    1.87 + *  char buffer[1024];
    1.88 + *
    1.89 + *  pos.field = 1;  // Same as the DateFormat::EField enum
    1.90 + *  UDateFormat* dfmt = udat_open(UDAT_DEFAULT, UDAT_DEFAULT, NULL, -1, NULL, 0, &status);
    1.91 + *  myStrlen = udat_format(dfmt, myDate, NULL, myStrlen, &pos, &status);
    1.92 + *  if (status==U_BUFFER_OVERFLOW_ERROR){
    1.93 + *      status=U_ZERO_ERROR;
    1.94 + *      myString=(UChar*)malloc(sizeof(UChar) * (myStrlen+1) );
    1.95 + *      udat_format(dfmt, myDate, myString, myStrlen+1, &pos, &status);
    1.96 + *  }
    1.97 + *  printf("date format: %s\n", u_austrcpy(buffer, myString));
    1.98 + *  buffer[pos.endIndex] = 0;   // NULL terminate the string.
    1.99 + *  printf("UFieldPosition position equals %s\n", &buffer[pos.beginIndex]);
   1.100 + * \endcode
   1.101 + * </pre>
   1.102 + * To format a date for a different Locale, specify it in the call to
   1.103 + * udat_open()
   1.104 + * <pre>
   1.105 + * \code
   1.106 + *        UDateFormat* df = udat_open(UDAT_SHORT, UDAT_SHORT, "fr_FR", NULL, -1, NULL, 0, &status);
   1.107 + * \endcode
   1.108 + * </pre>
   1.109 + * You can use a DateFormat API udat_parse() to parse.
   1.110 + * <pre>
   1.111 + * \code
   1.112 + *  UErrorCode status = U_ZERO_ERROR;
   1.113 + *  int32_t parsepos=0;
   1.114 + *  UDate myDate = udat_parse(df, myString, u_strlen(myString), &parsepos, &status);
   1.115 + * \endcode
   1.116 + * </pre>
   1.117 + *  You can pass in different options for the arguments for date and time style
   1.118 + *  to control the length of the result; from SHORT to MEDIUM to LONG to FULL.
   1.119 + *  The exact result depends on the locale, but generally:
   1.120 + *  see UDateFormatStyle for more details
   1.121 + * <ul type=round>
   1.122 + *   <li>   UDAT_SHORT is completely numeric, such as 12/13/52 or 3:30pm
   1.123 + *   <li>   UDAT_MEDIUM is longer, such as Jan 12, 1952
   1.124 + *   <li>   UDAT_LONG is longer, such as January 12, 1952 or 3:30:32pm
   1.125 + *   <li>   UDAT_FULL is pretty completely specified, such as
   1.126 + *          Tuesday, April 12, 1952 AD or 3:30:42pm PST.
   1.127 + * </ul>
   1.128 + * You can also set the time zone on the format if you wish.
   1.129 + * <P>
   1.130 + * You can also use forms of the parse and format methods with Parse Position and
   1.131 + * UFieldPosition to allow you to
   1.132 + * <ul type=round>
   1.133 + *   <li>   Progressively parse through pieces of a string.
   1.134 + *   <li>   Align any particular field, or find out where it is for selection
   1.135 + *          on the screen.
   1.136 + * </ul>
   1.137 + * <p><strong>Date and Time Patterns:</strong></p>
   1.138 + *
   1.139 + * <p>Date and time formats are specified by <em>date and time pattern</em> strings.
   1.140 + * Within date and time pattern strings, all unquoted ASCII letters [A-Za-z] are reserved
   1.141 + * as pattern letters representing calendar fields. <code>UDateFormat</code> supports
   1.142 + * the date and time formatting algorithm and pattern letters defined by
   1.143 + * <a href="http://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table">UTS#35
   1.144 + * Unicode Locale Data Markup Language (LDML)</a> and further documented for ICU in the
   1.145 + * <a href="https://sites.google.com/site/icuprojectuserguide/formatparse/datetime?pli=1#TOC-Date-Field-Symbol-Table">ICU
   1.146 + * User Guide</a>.</p>
   1.147 + */
   1.148 +
   1.149 +/** A date formatter.
   1.150 + *  For usage in C programs.
   1.151 + *  @stable ICU 2.6
   1.152 + */
   1.153 +typedef void* UDateFormat;
   1.154 +
   1.155 +/** The possible date/time format styles 
   1.156 + *  @stable ICU 2.6
   1.157 + */
   1.158 +typedef enum UDateFormatStyle {
   1.159 +    /** Full style */
   1.160 +    UDAT_FULL,
   1.161 +    /** Long style */
   1.162 +    UDAT_LONG,
   1.163 +    /** Medium style */
   1.164 +    UDAT_MEDIUM,
   1.165 +    /** Short style */
   1.166 +    UDAT_SHORT,
   1.167 +    /** Default style */
   1.168 +    UDAT_DEFAULT = UDAT_MEDIUM,
   1.169 +
   1.170 +    /** Bitfield for relative date */
   1.171 +    UDAT_RELATIVE = (1 << 7),
   1.172 +    
   1.173 +    UDAT_FULL_RELATIVE = UDAT_FULL | UDAT_RELATIVE,
   1.174 +        
   1.175 +    UDAT_LONG_RELATIVE = UDAT_LONG | UDAT_RELATIVE,
   1.176 +    
   1.177 +    UDAT_MEDIUM_RELATIVE = UDAT_MEDIUM | UDAT_RELATIVE,
   1.178 +    
   1.179 +    UDAT_SHORT_RELATIVE = UDAT_SHORT | UDAT_RELATIVE,
   1.180 +    
   1.181 +    
   1.182 +    /** No style */
   1.183 +    UDAT_NONE = -1,
   1.184 +
   1.185 +    /**
   1.186 +     * Use the pattern given in the parameter to udat_open
   1.187 +     * @see udat_open
   1.188 +     * @stable ICU 50
   1.189 +     */
   1.190 +    UDAT_PATTERN = -2,
   1.191 +
   1.192 +    /** @internal alias to UDAT_PATTERN */
   1.193 +    UDAT_IGNORE = UDAT_PATTERN
   1.194 +} UDateFormatStyle;
   1.195 +
   1.196 +/* Skeletons for dates. */
   1.197 +
   1.198 +/**
   1.199 + * Constant for date skeleton with year.
   1.200 + * @stable ICU 4.0
   1.201 + */
   1.202 +#define UDAT_YEAR                       "y"
   1.203 +#ifndef U_HIDE_DRAFT_API
   1.204 +/**
   1.205 + * Constant for date skeleton with quarter.
   1.206 + * @draft ICU 51
   1.207 + */
   1.208 +#define UDAT_QUARTER                    "QQQQ"
   1.209 +/**
   1.210 + * Constant for date skeleton with abbreviated quarter.
   1.211 + * @draft ICU 51
   1.212 + */
   1.213 +#define UDAT_ABBR_QUARTER               "QQQ"
   1.214 +#endif  /* U_HIDE_DRAFT_API */
   1.215 +/**
   1.216 + * Constant for date skeleton with year and quarter.
   1.217 + * @stable ICU 4.0
   1.218 + */
   1.219 +#define UDAT_YEAR_QUARTER               "yQQQQ"
   1.220 +/**
   1.221 + * Constant for date skeleton with year and abbreviated quarter.
   1.222 + * @stable ICU 4.0
   1.223 + */
   1.224 +#define UDAT_YEAR_ABBR_QUARTER          "yQQQ"
   1.225 +/**
   1.226 + * Constant for date skeleton with month.
   1.227 + * @stable ICU 4.0
   1.228 + */
   1.229 +#define UDAT_MONTH                      "MMMM"
   1.230 +/**
   1.231 + * Constant for date skeleton with abbreviated month.
   1.232 + * @stable ICU 4.0
   1.233 + */
   1.234 +#define UDAT_ABBR_MONTH                 "MMM"
   1.235 +/**
   1.236 + * Constant for date skeleton with numeric month.
   1.237 + * @stable ICU 4.0
   1.238 + */
   1.239 +#define UDAT_NUM_MONTH                  "M"
   1.240 +/**
   1.241 + * Constant for date skeleton with year and month.
   1.242 + * @stable ICU 4.0
   1.243 + */
   1.244 +#define UDAT_YEAR_MONTH                 "yMMMM"
   1.245 +/**
   1.246 + * Constant for date skeleton with year and abbreviated month.
   1.247 + * @stable ICU 4.0
   1.248 + */
   1.249 +#define UDAT_YEAR_ABBR_MONTH            "yMMM"
   1.250 +/**
   1.251 + * Constant for date skeleton with year and numeric month.
   1.252 + * @stable ICU 4.0
   1.253 + */
   1.254 +#define UDAT_YEAR_NUM_MONTH             "yM"
   1.255 +/**
   1.256 + * Constant for date skeleton with day.
   1.257 + * @stable ICU 4.0
   1.258 + */
   1.259 +#define UDAT_DAY                        "d"
   1.260 +/**
   1.261 + * Constant for date skeleton with year, month, and day.
   1.262 + * Used in combinations date + time, date + time + zone, or time + zone.
   1.263 + * @stable ICU 4.0
   1.264 + */
   1.265 +#define UDAT_YEAR_MONTH_DAY             "yMMMMd"
   1.266 +/**
   1.267 + * Constant for date skeleton with year, abbreviated month, and day.
   1.268 + * Used in combinations date + time, date + time + zone, or time + zone.
   1.269 + * @stable ICU 4.0
   1.270 + */
   1.271 +#define UDAT_YEAR_ABBR_MONTH_DAY        "yMMMd"
   1.272 +/**
   1.273 + * Constant for date skeleton with year, numeric month, and day.
   1.274 + * Used in combinations date + time, date + time + zone, or time + zone.
   1.275 + * @stable ICU 4.0
   1.276 + */
   1.277 +#define UDAT_YEAR_NUM_MONTH_DAY         "yMd"
   1.278 +#ifndef U_HIDE_DRAFT_API
   1.279 +/**
   1.280 + * Constant for date skeleton with weekday.
   1.281 + * @draft ICU 51
   1.282 + */
   1.283 +#define UDAT_WEEKDAY                    "EEEE"
   1.284 +/**
   1.285 + * Constant for date skeleton with abbreviated weekday.
   1.286 + * @draft ICU 51
   1.287 + */
   1.288 +#define UDAT_ABBR_WEEKDAY               "E"
   1.289 +#endif  /* U_HIDE_DRAFT_API */
   1.290 +/**
   1.291 + * Constant for date skeleton with year, month, weekday, and day.
   1.292 + * Used in combinations date + time, date + time + zone, or time + zone.
   1.293 + * @stable ICU 4.0
   1.294 + */
   1.295 +#define UDAT_YEAR_MONTH_WEEKDAY_DAY     "yMMMMEEEEd"
   1.296 +/**
   1.297 + * Constant for date skeleton with year, abbreviated month, weekday, and day.
   1.298 + * Used in combinations date + time, date + time + zone, or time + zone.
   1.299 + * @stable ICU 4.0
   1.300 + */
   1.301 +#define UDAT_YEAR_ABBR_MONTH_WEEKDAY_DAY "yMMMEd" 
   1.302 +/**
   1.303 + * Constant for date skeleton with year, numeric month, weekday, and day.
   1.304 + * Used in combinations date + time, date + time + zone, or time + zone.
   1.305 + * @stable ICU 4.0
   1.306 + */
   1.307 +#define UDAT_YEAR_NUM_MONTH_WEEKDAY_DAY "yMEd"
   1.308 +/**
   1.309 + * Constant for date skeleton with long month and day.
   1.310 + * Used in combinations date + time, date + time + zone, or time + zone.
   1.311 + * @stable ICU 4.0
   1.312 + */
   1.313 +#define UDAT_MONTH_DAY                  "MMMMd"
   1.314 +/**
   1.315 + * Constant for date skeleton with abbreviated month and day.
   1.316 + * Used in combinations date + time, date + time + zone, or time + zone.
   1.317 + * @stable ICU 4.0
   1.318 + */
   1.319 +#define UDAT_ABBR_MONTH_DAY             "MMMd"
   1.320 +/**
   1.321 + * Constant for date skeleton with numeric month and day.
   1.322 + * Used in combinations date + time, date + time + zone, or time + zone.
   1.323 + * @stable ICU 4.0
   1.324 + */
   1.325 +#define UDAT_NUM_MONTH_DAY              "Md"
   1.326 +/**
   1.327 + * Constant for date skeleton with month, weekday, and day.
   1.328 + * Used in combinations date + time, date + time + zone, or time + zone.
   1.329 + * @stable ICU 4.0
   1.330 + */
   1.331 +#define UDAT_MONTH_WEEKDAY_DAY          "MMMMEEEEd"
   1.332 +/**
   1.333 + * Constant for date skeleton with abbreviated month, weekday, and day.
   1.334 + * Used in combinations date + time, date + time + zone, or time + zone.
   1.335 + * @stable ICU 4.0
   1.336 + */
   1.337 +#define UDAT_ABBR_MONTH_WEEKDAY_DAY     "MMMEd"
   1.338 +/**
   1.339 + * Constant for date skeleton with numeric month, weekday, and day.
   1.340 + * Used in combinations date + time, date + time + zone, or time + zone.
   1.341 + * @stable ICU 4.0
   1.342 + */
   1.343 +#define UDAT_NUM_MONTH_WEEKDAY_DAY      "MEd"
   1.344 +
   1.345 +/* Skeletons for times. */
   1.346 +
   1.347 +/**
   1.348 + * Constant for date skeleton with hour, with the locale's preferred hour format (12 or 24).
   1.349 + * @stable ICU 4.0
   1.350 + */
   1.351 +#define UDAT_HOUR                       "j"
   1.352 +#ifndef U_HIDE_DRAFT_API
   1.353 +/**
   1.354 + * Constant for date skeleton with hour in 24-hour presentation.
   1.355 + * @draft ICU 51
   1.356 + */
   1.357 +#define UDAT_HOUR24                     "H"
   1.358 +/**
   1.359 + * Constant for date skeleton with minute.
   1.360 + * @draft ICU 51
   1.361 + */
   1.362 +#define UDAT_MINUTE                     "m"
   1.363 +#endif  /* U_HIDE_DRAFT_API */
   1.364 +/**
   1.365 + * Constant for date skeleton with hour and minute, with the locale's preferred hour format (12 or 24).
   1.366 + * Used in combinations date + time, date + time + zone, or time + zone.
   1.367 + * @stable ICU 4.0
   1.368 + */
   1.369 +#define UDAT_HOUR_MINUTE                "jm"
   1.370 +/**
   1.371 + * Constant for date skeleton with hour and minute in 24-hour presentation.
   1.372 + * Used in combinations date + time, date + time + zone, or time + zone.
   1.373 + * @stable ICU 4.0
   1.374 + */
   1.375 +#define UDAT_HOUR24_MINUTE              "Hm"
   1.376 +#ifndef U_HIDE_DRAFT_API
   1.377 +/**
   1.378 + * Constant for date skeleton with second.
   1.379 + * @draft ICU 51
   1.380 + */
   1.381 +#define UDAT_SECOND                     "s"
   1.382 +#endif  /* U_HIDE_DRAFT_API */
   1.383 +/**
   1.384 + * Constant for date skeleton with hour, minute, and second,
   1.385 + * with the locale's preferred hour format (12 or 24).
   1.386 + * Used in combinations date + time, date + time + zone, or time + zone.
   1.387 + * @stable ICU 4.0
   1.388 + */
   1.389 +#define UDAT_HOUR_MINUTE_SECOND         "jms"
   1.390 +/**
   1.391 + * Constant for date skeleton with hour, minute, and second in
   1.392 + * 24-hour presentation.
   1.393 + * Used in combinations date + time, date + time + zone, or time + zone.
   1.394 + * @stable ICU 4.0
   1.395 + */
   1.396 +#define UDAT_HOUR24_MINUTE_SECOND       "Hms"
   1.397 +/**
   1.398 + * Constant for date skeleton with minute and second.
   1.399 + * Used in combinations date + time, date + time + zone, or time + zone.
   1.400 + * @stable ICU 4.0
   1.401 + */
   1.402 +#define UDAT_MINUTE_SECOND              "ms"
   1.403 +
   1.404 +/* Skeletons for time zones. */
   1.405 +
   1.406 +#ifndef U_HIDE_DRAFT_API
   1.407 +/**
   1.408 + * Constant for <i>generic location format</i>, such as Los Angeles Time;
   1.409 + * used in combinations date + time + zone, or time + zone.
   1.410 + * @see <a href="http://unicode.org/reports/tr35/#Date_Format_Patterns">LDML Date Format Patterns</a>
   1.411 + * @see <a href="http://unicode.org/reports/tr35/#Time_Zone_Fallback">LDML Time Zone Fallback</a>
   1.412 + * @draft ICU 51
   1.413 + */
   1.414 +#define UDAT_LOCATION_TZ "VVVV"
   1.415 +/**
   1.416 + * Constant for <i>generic non-location format</i>, such as Pacific Time;
   1.417 + * used in combinations date + time + zone, or time + zone.
   1.418 + * @see <a href="http://unicode.org/reports/tr35/#Date_Format_Patterns">LDML Date Format Patterns</a>
   1.419 + * @see <a href="http://unicode.org/reports/tr35/#Time_Zone_Fallback">LDML Time Zone Fallback</a>
   1.420 + * @draft ICU 51
   1.421 + */
   1.422 +#define UDAT_GENERIC_TZ "vvvv"
   1.423 +/**
   1.424 + * Constant for <i>generic non-location format</i>, abbreviated if possible, such as PT;
   1.425 + * used in combinations date + time + zone, or time + zone.
   1.426 + * @see <a href="http://unicode.org/reports/tr35/#Date_Format_Patterns">LDML Date Format Patterns</a>
   1.427 + * @see <a href="http://unicode.org/reports/tr35/#Time_Zone_Fallback">LDML Time Zone Fallback</a>
   1.428 + * @draft ICU 51
   1.429 + */
   1.430 +#define UDAT_ABBR_GENERIC_TZ "v"
   1.431 +/**
   1.432 + * Constant for <i>specific non-location format</i>, such as Pacific Daylight Time;
   1.433 + * used in combinations date + time + zone, or time + zone.
   1.434 + * @see <a href="http://unicode.org/reports/tr35/#Date_Format_Patterns">LDML Date Format Patterns</a>
   1.435 + * @see <a href="http://unicode.org/reports/tr35/#Time_Zone_Fallback">LDML Time Zone Fallback</a>
   1.436 + * @draft ICU 51
   1.437 + */
   1.438 +#define UDAT_SPECIFIC_TZ "zzzz"
   1.439 +/**
   1.440 + * Constant for <i>specific non-location format</i>, abbreviated if possible, such as PDT;
   1.441 + * used in combinations date + time + zone, or time + zone.
   1.442 + * @see <a href="http://unicode.org/reports/tr35/#Date_Format_Patterns">LDML Date Format Patterns</a>
   1.443 + * @see <a href="http://unicode.org/reports/tr35/#Time_Zone_Fallback">LDML Time Zone Fallback</a>
   1.444 + * @draft ICU 51
   1.445 + */
   1.446 +#define UDAT_ABBR_SPECIFIC_TZ "z"
   1.447 +/**
   1.448 + * Constant for <i>localized GMT/UTC format</i>, such as GMT+8:00 or HPG-8:00;
   1.449 + * used in combinations date + time + zone, or time + zone.
   1.450 + * @see <a href="http://unicode.org/reports/tr35/#Date_Format_Patterns">LDML Date Format Patterns</a>
   1.451 + * @see <a href="http://unicode.org/reports/tr35/#Time_Zone_Fallback">LDML Time Zone Fallback</a>
   1.452 + * @draft ICU 51
   1.453 + */
   1.454 +#define UDAT_ABBR_UTC_TZ "ZZZZ"
   1.455 +#endif  /* U_HIDE_DRAFT_API */
   1.456 +
   1.457 +/* deprecated skeleton constants */
   1.458 +
   1.459 +#ifndef U_HIDE_DEPRECATED_API 
   1.460 +/**
   1.461 + * Constant for date skeleton with standalone month.
   1.462 + * @deprecated ICU 50 Use UDAT_MONTH instead.
   1.463 + */
   1.464 +#define UDAT_STANDALONE_MONTH           "LLLL"
   1.465 +/**
   1.466 + * Constant for date skeleton with standalone abbreviated month.
   1.467 + * @deprecated ICU 50 Use UDAT_ABBR_MONTH instead.
   1.468 + */
   1.469 +#define UDAT_ABBR_STANDALONE_MONTH      "LLL"
   1.470 +
   1.471 +/**
   1.472 + * Constant for date skeleton with hour, minute, and generic timezone.
   1.473 + * @deprecated ICU 50 Use instead UDAT_HOUR_MINUTE UDAT_ABBR_GENERIC_TZ or some other timezone presentation.
   1.474 + */
   1.475 +#define UDAT_HOUR_MINUTE_GENERIC_TZ     "jmv"
   1.476 +/**
   1.477 + * Constant for date skeleton with hour, minute, and timezone.
   1.478 + * @deprecated ICU 50 Use instead UDAT_HOUR_MINUTE UDAT_ABBR_SPECIFIC_TZ or some other timezone presentation.
   1.479 + */
   1.480 +#define UDAT_HOUR_MINUTE_TZ             "jmz"
   1.481 +/**
   1.482 + * Constant for date skeleton with hour and generic timezone.
   1.483 + * @deprecated ICU 50 Use instead UDAT_HOUR UDAT_ABBR_GENERIC_TZ or some other timezone presentation.
   1.484 + */
   1.485 +#define UDAT_HOUR_GENERIC_TZ            "jv"
   1.486 +/**
   1.487 + * Constant for date skeleton with hour and timezone.
   1.488 + * @deprecated ICU 50 Use instead UDAT_HOUR UDAT_ABBR_SPECIFIC_TZ or some other timezone presentation.
   1.489 + */
   1.490 +#define UDAT_HOUR_TZ                    "jz"
   1.491 +#endif  /* U_HIDE_DEPRECATED_API */
   1.492 +
   1.493 +/**
   1.494 + * FieldPosition and UFieldPosition selectors for format fields
   1.495 + * defined by DateFormat and UDateFormat.
   1.496 + * @stable ICU 3.0
   1.497 + */
   1.498 +typedef enum UDateFormatField {
   1.499 +    /**
   1.500 +     * FieldPosition and UFieldPosition selector for 'G' field alignment,
   1.501 +     * corresponding to the UCAL_ERA field.
   1.502 +     * @stable ICU 3.0
   1.503 +     */
   1.504 +    UDAT_ERA_FIELD = 0,
   1.505 +
   1.506 +    /**
   1.507 +     * FieldPosition and UFieldPosition selector for 'y' field alignment,
   1.508 +     * corresponding to the UCAL_YEAR field.
   1.509 +     * @stable ICU 3.0
   1.510 +     */
   1.511 +    UDAT_YEAR_FIELD = 1,
   1.512 +
   1.513 +    /**
   1.514 +     * FieldPosition and UFieldPosition selector for 'M' field alignment,
   1.515 +     * corresponding to the UCAL_MONTH field.
   1.516 +     * @stable ICU 3.0
   1.517 +     */
   1.518 +    UDAT_MONTH_FIELD = 2,
   1.519 +
   1.520 +    /**
   1.521 +     * FieldPosition and UFieldPosition selector for 'd' field alignment,
   1.522 +     * corresponding to the UCAL_DATE field.
   1.523 +     * @stable ICU 3.0
   1.524 +     */
   1.525 +    UDAT_DATE_FIELD = 3,
   1.526 +
   1.527 +    /**
   1.528 +     * FieldPosition and UFieldPosition selector for 'k' field alignment,
   1.529 +     * corresponding to the UCAL_HOUR_OF_DAY field.
   1.530 +     * UDAT_HOUR_OF_DAY1_FIELD is used for the one-based 24-hour clock.
   1.531 +     * For example, 23:59 + 01:00 results in 24:59.
   1.532 +     * @stable ICU 3.0
   1.533 +     */
   1.534 +    UDAT_HOUR_OF_DAY1_FIELD = 4,
   1.535 +
   1.536 +    /**
   1.537 +     * FieldPosition and UFieldPosition selector for 'H' field alignment,
   1.538 +     * corresponding to the UCAL_HOUR_OF_DAY field.
   1.539 +     * UDAT_HOUR_OF_DAY0_FIELD is used for the zero-based 24-hour clock.
   1.540 +     * For example, 23:59 + 01:00 results in 00:59.
   1.541 +     * @stable ICU 3.0
   1.542 +     */
   1.543 +    UDAT_HOUR_OF_DAY0_FIELD = 5,
   1.544 +
   1.545 +    /**
   1.546 +     * FieldPosition and UFieldPosition selector for 'm' field alignment,
   1.547 +     * corresponding to the UCAL_MINUTE field.
   1.548 +     * @stable ICU 3.0
   1.549 +     */
   1.550 +    UDAT_MINUTE_FIELD = 6,
   1.551 +
   1.552 +    /**
   1.553 +     * FieldPosition and UFieldPosition selector for 's' field alignment,
   1.554 +     * corresponding to the UCAL_SECOND field.
   1.555 +     * @stable ICU 3.0
   1.556 +     */
   1.557 +    UDAT_SECOND_FIELD = 7,
   1.558 +
   1.559 +    /**
   1.560 +     * FieldPosition and UFieldPosition selector for 'S' field alignment,
   1.561 +     * corresponding to the UCAL_MILLISECOND field.
   1.562 +     *
   1.563 +     * Note: Time formats that use 'S' can display a maximum of three
   1.564 +     * significant digits for fractional seconds, corresponding to millisecond
   1.565 +     * resolution and a fractional seconds sub-pattern of SSS. If the
   1.566 +     * sub-pattern is S or SS, the fractional seconds value will be truncated
   1.567 +     * (not rounded) to the number of display places specified. If the
   1.568 +     * fractional seconds sub-pattern is longer than SSS, the additional
   1.569 +     * display places will be filled with zeros.
   1.570 +     * @stable ICU 3.0
   1.571 +     */
   1.572 +    UDAT_FRACTIONAL_SECOND_FIELD = 8,
   1.573 +
   1.574 +    /**
   1.575 +     * FieldPosition and UFieldPosition selector for 'E' field alignment,
   1.576 +     * corresponding to the UCAL_DAY_OF_WEEK field.
   1.577 +     * @stable ICU 3.0
   1.578 +     */
   1.579 +    UDAT_DAY_OF_WEEK_FIELD = 9,
   1.580 +
   1.581 +    /**
   1.582 +     * FieldPosition and UFieldPosition selector for 'D' field alignment,
   1.583 +     * corresponding to the UCAL_DAY_OF_YEAR field.
   1.584 +     * @stable ICU 3.0
   1.585 +     */
   1.586 +    UDAT_DAY_OF_YEAR_FIELD = 10,
   1.587 +
   1.588 +    /**
   1.589 +     * FieldPosition and UFieldPosition selector for 'F' field alignment,
   1.590 +     * corresponding to the UCAL_DAY_OF_WEEK_IN_MONTH field.
   1.591 +     * @stable ICU 3.0
   1.592 +     */
   1.593 +    UDAT_DAY_OF_WEEK_IN_MONTH_FIELD = 11,
   1.594 +
   1.595 +    /**
   1.596 +     * FieldPosition and UFieldPosition selector for 'w' field alignment,
   1.597 +     * corresponding to the UCAL_WEEK_OF_YEAR field.
   1.598 +     * @stable ICU 3.0
   1.599 +     */
   1.600 +    UDAT_WEEK_OF_YEAR_FIELD = 12,
   1.601 +
   1.602 +    /**
   1.603 +     * FieldPosition and UFieldPosition selector for 'W' field alignment,
   1.604 +     * corresponding to the UCAL_WEEK_OF_MONTH field.
   1.605 +     * @stable ICU 3.0
   1.606 +     */
   1.607 +    UDAT_WEEK_OF_MONTH_FIELD = 13,
   1.608 +
   1.609 +    /**
   1.610 +     * FieldPosition and UFieldPosition selector for 'a' field alignment,
   1.611 +     * corresponding to the UCAL_AM_PM field.
   1.612 +     * @stable ICU 3.0
   1.613 +     */
   1.614 +    UDAT_AM_PM_FIELD = 14,
   1.615 +
   1.616 +    /**
   1.617 +     * FieldPosition and UFieldPosition selector for 'h' field alignment,
   1.618 +     * corresponding to the UCAL_HOUR field.
   1.619 +     * UDAT_HOUR1_FIELD is used for the one-based 12-hour clock.
   1.620 +     * For example, 11:30 PM + 1 hour results in 12:30 AM.
   1.621 +     * @stable ICU 3.0
   1.622 +     */
   1.623 +    UDAT_HOUR1_FIELD = 15,
   1.624 +
   1.625 +    /**
   1.626 +     * FieldPosition and UFieldPosition selector for 'K' field alignment,
   1.627 +     * corresponding to the UCAL_HOUR field.
   1.628 +     * UDAT_HOUR0_FIELD is used for the zero-based 12-hour clock.
   1.629 +     * For example, 11:30 PM + 1 hour results in 00:30 AM.
   1.630 +     * @stable ICU 3.0
   1.631 +     */
   1.632 +    UDAT_HOUR0_FIELD = 16,
   1.633 +
   1.634 +    /**
   1.635 +     * FieldPosition and UFieldPosition selector for 'z' field alignment,
   1.636 +     * corresponding to the UCAL_ZONE_OFFSET and
   1.637 +     * UCAL_DST_OFFSET fields.
   1.638 +     * @stable ICU 3.0
   1.639 +     */
   1.640 +    UDAT_TIMEZONE_FIELD = 17,
   1.641 +
   1.642 +    /**
   1.643 +     * FieldPosition and UFieldPosition selector for 'Y' field alignment,
   1.644 +     * corresponding to the UCAL_YEAR_WOY field.
   1.645 +     * @stable ICU 3.0
   1.646 +     */
   1.647 +    UDAT_YEAR_WOY_FIELD = 18,
   1.648 +
   1.649 +    /**
   1.650 +     * FieldPosition and UFieldPosition selector for 'e' field alignment,
   1.651 +     * corresponding to the UCAL_DOW_LOCAL field.
   1.652 +     * @stable ICU 3.0
   1.653 +     */
   1.654 +    UDAT_DOW_LOCAL_FIELD = 19,
   1.655 +
   1.656 +    /**
   1.657 +     * FieldPosition and UFieldPosition selector for 'u' field alignment,
   1.658 +     * corresponding to the UCAL_EXTENDED_YEAR field.
   1.659 +     * @stable ICU 3.0
   1.660 +     */
   1.661 +    UDAT_EXTENDED_YEAR_FIELD = 20,
   1.662 +
   1.663 +    /**
   1.664 +     * FieldPosition and UFieldPosition selector for 'g' field alignment,
   1.665 +     * corresponding to the UCAL_JULIAN_DAY field.
   1.666 +     * @stable ICU 3.0
   1.667 +     */
   1.668 +    UDAT_JULIAN_DAY_FIELD = 21,
   1.669 +
   1.670 +    /**
   1.671 +     * FieldPosition and UFieldPosition selector for 'A' field alignment,
   1.672 +     * corresponding to the UCAL_MILLISECONDS_IN_DAY field.
   1.673 +     * @stable ICU 3.0
   1.674 +     */
   1.675 +    UDAT_MILLISECONDS_IN_DAY_FIELD = 22,
   1.676 +
   1.677 +    /**
   1.678 +     * FieldPosition and UFieldPosition selector for 'Z' field alignment,
   1.679 +     * corresponding to the UCAL_ZONE_OFFSET and
   1.680 +     * UCAL_DST_OFFSET fields.
   1.681 +     * @stable ICU 3.0
   1.682 +     */
   1.683 +    UDAT_TIMEZONE_RFC_FIELD = 23,
   1.684 +
   1.685 +    /**
   1.686 +     * FieldPosition and UFieldPosition selector for 'v' field alignment,
   1.687 +     * corresponding to the UCAL_ZONE_OFFSET field.
   1.688 +     * @stable ICU 3.4
   1.689 +     */
   1.690 +    UDAT_TIMEZONE_GENERIC_FIELD = 24,
   1.691 +    /**
   1.692 +     * FieldPosition selector for 'c' field alignment,
   1.693 +     * corresponding to the {@link #UCAL_DOW_LOCAL} field.
   1.694 +     * This displays the stand alone day name, if available.
   1.695 +     * @stable ICU 3.4
   1.696 +     */
   1.697 +    UDAT_STANDALONE_DAY_FIELD = 25,
   1.698 +
   1.699 +    /**
   1.700 +     * FieldPosition selector for 'L' field alignment,
   1.701 +     * corresponding to the {@link #UCAL_MONTH} field.
   1.702 +     * This displays the stand alone month name, if available.
   1.703 +     * @stable ICU 3.4
   1.704 +     */
   1.705 +    UDAT_STANDALONE_MONTH_FIELD = 26,
   1.706 +
   1.707 +    /**
   1.708 +     * FieldPosition selector for "Q" field alignment,
   1.709 +     * corresponding to quarters. This is implemented
   1.710 +     * using the {@link #UCAL_MONTH} field. This
   1.711 +     * displays the quarter.
   1.712 +     * @stable ICU 3.6
   1.713 +     */
   1.714 +    UDAT_QUARTER_FIELD = 27,
   1.715 +
   1.716 +    /**
   1.717 +     * FieldPosition selector for the "q" field alignment,
   1.718 +     * corresponding to stand-alone quarters. This is
   1.719 +     * implemented using the {@link #UCAL_MONTH} field.
   1.720 +     * This displays the stand-alone quarter.
   1.721 +     * @stable ICU 3.6
   1.722 +     */
   1.723 +    UDAT_STANDALONE_QUARTER_FIELD = 28,
   1.724 +
   1.725 +    /**
   1.726 +     * FieldPosition and UFieldPosition selector for 'V' field alignment,
   1.727 +     * corresponding to the UCAL_ZONE_OFFSET field.
   1.728 +     * @stable ICU 3.8
   1.729 +     */
   1.730 +    UDAT_TIMEZONE_SPECIAL_FIELD = 29,
   1.731 +
   1.732 +    /**
   1.733 +     * FieldPosition selector for "U" field alignment,
   1.734 +     * corresponding to cyclic year names. This is implemented
   1.735 +     * using the {@link #UCAL_YEAR} field. This displays
   1.736 +     * the cyclic year name, if available.
   1.737 +     * @stable ICU 49
   1.738 +     */
   1.739 +    UDAT_YEAR_NAME_FIELD = 30,
   1.740 +
   1.741 +#ifndef U_HIDE_DRAFT_API
   1.742 +    /**
   1.743 +     * FieldPosition selector for 'O' field alignment,
   1.744 +     * corresponding to the UCAL_ZONE_OFFSET and UCAL_DST_OFFSETfields.
   1.745 +     * This displays the localized GMT format.
   1.746 +     * @draft ICU 51
   1.747 +     */
   1.748 +    UDAT_TIMEZONE_LOCALIZED_GMT_OFFSET_FIELD = 31,
   1.749 +
   1.750 +    /**
   1.751 +     * FieldPosition selector for 'X' field alignment,
   1.752 +     * corresponding to the UCAL_ZONE_OFFSET and UCAL_DST_OFFSETfields.
   1.753 +     * This displays the ISO 8601 local time offset format or UTC indicator ("Z").
   1.754 +     * @draft ICU 51
   1.755 +     */
   1.756 +    UDAT_TIMEZONE_ISO_FIELD = 32,
   1.757 +
   1.758 +    /**
   1.759 +     * FieldPosition selector for 'x' field alignment,
   1.760 +     * corresponding to the UCAL_ZONE_OFFSET and UCAL_DST_OFFSETfields.
   1.761 +     * This displays the ISO 8601 local time offset format.
   1.762 +     * @draft ICU 51
   1.763 +     */
   1.764 +    UDAT_TIMEZONE_ISO_LOCAL_FIELD = 33,
   1.765 +#endif  /* U_HIDE_DRAFT_API */
   1.766 +
   1.767 +    /**
   1.768 +     * Number of FieldPosition and UFieldPosition selectors for
   1.769 +     * DateFormat and UDateFormat.
   1.770 +     * Valid selectors range from 0 to UDAT_FIELD_COUNT-1.
   1.771 +     * This value is subject to change if new fields are defined
   1.772 +     * in the future.
   1.773 +     * @stable ICU 3.0
   1.774 +     */
   1.775 +    UDAT_FIELD_COUNT = 34
   1.776 +
   1.777 +} UDateFormatField;
   1.778 +
   1.779 +
   1.780 +/**
   1.781 + * Maps from a UDateFormatField to the corresponding UCalendarDateFields.
   1.782 + * Note: since the mapping is many-to-one, there is no inverse mapping.
   1.783 + * @param field the UDateFormatField.
   1.784 + * @return the UCalendarDateField.  This will be UCAL_FIELD_COUNT in case
   1.785 + * of error (e.g., the input field is UDAT_FIELD_COUNT).
   1.786 + * @stable ICU 4.4
   1.787 + */
   1.788 +U_STABLE UCalendarDateFields U_EXPORT2
   1.789 +udat_toCalendarDateField(UDateFormatField field);
   1.790 +
   1.791 +
   1.792 +/**
   1.793 + * Open a new UDateFormat for formatting and parsing dates and times.
   1.794 + * A UDateFormat may be used to format dates in calls to {@link #udat_format },
   1.795 + * and to parse dates in calls to {@link #udat_parse }.
   1.796 + * @param timeStyle The style used to format times; one of UDAT_FULL, UDAT_LONG,
   1.797 + * UDAT_MEDIUM, UDAT_SHORT, UDAT_DEFAULT, or UDAT_NONE (relative time styles
   1.798 + * are not currently supported).
   1.799 + * When the pattern parameter is used, pass in UDAT_PATTERN for both timeStyle and dateStyle.
   1.800 + * @param dateStyle The style used to format dates; one of UDAT_FULL, UDAT_LONG,
   1.801 + * UDAT_MEDIUM, UDAT_SHORT, UDAT_DEFAULT, UDAT_FULL_RELATIVE, UDAT_LONG_RELATIVE,
   1.802 + * UDAT_MEDIUM_RELATIVE, UDAT_SHORT_RELATIVE, or UDAT_NONE.
   1.803 + * When the pattern parameter is used, pass in UDAT_PATTERN for both timeStyle and dateStyle.
   1.804 + * As currently implemented,
   1.805 + * relative date formatting only affects a limited range of calendar days before or
   1.806 + * after the current date, based on the CLDR &lt;field type="day"&gt;/&lt;relative&gt; data: For
   1.807 + * example, in English, "Yesterday", "Today", and "Tomorrow". Outside of this range,
   1.808 + * dates are formatted using the corresponding non-relative style.
   1.809 + * @param locale The locale specifying the formatting conventions
   1.810 + * @param tzID A timezone ID specifying the timezone to use.  If 0, use
   1.811 + * the default timezone.
   1.812 + * @param tzIDLength The length of tzID, or -1 if null-terminated.
   1.813 + * @param pattern A pattern specifying the format to use.
   1.814 + * @param patternLength The number of characters in the pattern, or -1 if null-terminated.
   1.815 + * @param status A pointer to an UErrorCode to receive any errors
   1.816 + * @return A pointer to a UDateFormat to use for formatting dates and times, or 0 if
   1.817 + * an error occurred.
   1.818 + * @stable ICU 2.0
   1.819 + */
   1.820 +U_STABLE UDateFormat* U_EXPORT2 
   1.821 +udat_open(UDateFormatStyle  timeStyle,
   1.822 +          UDateFormatStyle  dateStyle,
   1.823 +          const char        *locale,
   1.824 +          const UChar       *tzID,
   1.825 +          int32_t           tzIDLength,
   1.826 +          const UChar       *pattern,
   1.827 +          int32_t           patternLength,
   1.828 +          UErrorCode        *status);
   1.829 +
   1.830 +
   1.831 +/**
   1.832 +* Close a UDateFormat.
   1.833 +* Once closed, a UDateFormat may no longer be used.
   1.834 +* @param format The formatter to close.
   1.835 +* @stable ICU 2.0
   1.836 +*/
   1.837 +U_STABLE void U_EXPORT2 
   1.838 +udat_close(UDateFormat* format);
   1.839 +
   1.840 +
   1.841 +/**
   1.842 + * DateFormat boolean attributes
   1.843 + * @internal ICU technology preview
   1.844 + */
   1.845 +typedef enum UDateFormatBooleanAttribute {
   1.846 +    /**
   1.847 +     * indicates whether whitespace is allowed. Includes trailing dot tolerance.
   1.848 +     * @internal ICU technology preview
   1.849 +     */
   1.850 +    UDAT_PARSE_ALLOW_WHITESPACE,
   1.851 +    /**
   1.852 +     * indicates tolerance of numeric data when String data may be assumed. eg: UDAT_YEAR_NAME_FIELD,
   1.853 +     * 		UDAT_STANDALONE_MONTH_FIELD, UDAT_DAY_OF_WEEK_FIELD
   1.854 +     * @internal ICU technology preview
   1.855 +     */
   1.856 +    UDAT_PARSE_ALLOW_NUMERIC,
   1.857 +    /**
   1.858 +     * count boolean date format constants
   1.859 +     * @internal ICU technology preview
   1.860 +     */
   1.861 +    UDAT_BOOLEAN_ATTRIBUTE_COUNT
   1.862 +} UDateFormatBooleanAttribute;
   1.863 +
   1.864 +#ifndef U_HIDE_INTERNAL_API
   1.865 +/**
   1.866 + * Get a boolean attribute associated with a UDateFormat.
   1.867 + * An example would be a true value for a key of UDAT_PARSE_ALLOW_WHITESPACE indicating allowing whitespace leniency.
   1.868 + * If the formatter does not understand the attribute, -1 is returned.
   1.869 + * @param fmt The formatter to query.
   1.870 + * @param attr The attribute to query; e.g. UDAT_PARSE_ALLOW_WHITESPACE.
   1.871 + * @param status A pointer to an UErrorCode to receive any errors
   1.872 + * @return The value of attr.
   1.873 + * @internal technology preview
   1.874 + */
   1.875 +U_INTERNAL UBool U_EXPORT2
   1.876 +udat_getBooleanAttribute(const UDateFormat* fmt, UDateFormatBooleanAttribute attr, UErrorCode* status);
   1.877 +
   1.878 +/**
   1.879 + * Set a boolean attribute associated with a UDateFormat.
   1.880 + * An example of a boolean attribute is parse leniency control.  If the formatter does not understand
   1.881 + * the attribute, the call is ignored.
   1.882 + * @param fmt The formatter to set.
   1.883 + * @param attr The attribute to set; one of UDAT_PARSE_ALLOW_WHITESPACE or UDAT_PARSE_ALLOW_NUMERIC
   1.884 + * @param newValue The new value of attr.
   1.885 + * @param status A pointer to an UErrorCode to receive any errors
   1.886 + * @internal ICU technology preview
   1.887 + */
   1.888 +U_INTERNAL void U_EXPORT2
   1.889 +udat_setBooleanAttribute(UDateFormat *fmt, UDateFormatBooleanAttribute attr, UBool, UErrorCode* status);
   1.890 +
   1.891 +#endif  /* U_HIDE_INTERNAL_API */
   1.892 +
   1.893 +
   1.894 +
   1.895 +#if U_SHOW_CPLUSPLUS_API
   1.896 +
   1.897 +U_NAMESPACE_BEGIN
   1.898 +
   1.899 +/**
   1.900 + * \class LocalUDateFormatPointer
   1.901 + * "Smart pointer" class, closes a UDateFormat via udat_close().
   1.902 + * For most methods see the LocalPointerBase base class.
   1.903 + *
   1.904 + * @see LocalPointerBase
   1.905 + * @see LocalPointer
   1.906 + * @stable ICU 4.4
   1.907 + */
   1.908 +U_DEFINE_LOCAL_OPEN_POINTER(LocalUDateFormatPointer, UDateFormat, udat_close);
   1.909 +
   1.910 +U_NAMESPACE_END
   1.911 +
   1.912 +#endif
   1.913 +
   1.914 +/**
   1.915 + * Open a copy of a UDateFormat.
   1.916 + * This function performs a deep copy.
   1.917 + * @param fmt The format to copy
   1.918 + * @param status A pointer to an UErrorCode to receive any errors.
   1.919 + * @return A pointer to a UDateFormat identical to fmt.
   1.920 + * @stable ICU 2.0
   1.921 + */
   1.922 +U_STABLE UDateFormat* U_EXPORT2 
   1.923 +udat_clone(const UDateFormat *fmt,
   1.924 +       UErrorCode *status);
   1.925 +
   1.926 +/**
   1.927 +* Format a date using an UDateFormat.
   1.928 +* The date will be formatted using the conventions specified in {@link #udat_open }
   1.929 +* @param format The formatter to use
   1.930 +* @param dateToFormat The date to format
   1.931 +* @param result A pointer to a buffer to receive the formatted number.
   1.932 +* @param resultLength The maximum size of result.
   1.933 +* @param position A pointer to a UFieldPosition.  On input, position->field
   1.934 +* is read.  On output, position->beginIndex and position->endIndex indicate
   1.935 +* the beginning and ending indices of field number position->field, if such
   1.936 +* a field exists.  This parameter may be NULL, in which case no field
   1.937 +* position data is returned.
   1.938 +* @param status A pointer to an UErrorCode to receive any errors
   1.939 +* @return The total buffer size needed; if greater than resultLength, the output was truncated.
   1.940 +* @see udat_parse
   1.941 +* @see UFieldPosition
   1.942 +* @stable ICU 2.0
   1.943 +*/
   1.944 +U_STABLE int32_t U_EXPORT2 
   1.945 +udat_format(    const    UDateFormat*    format,
   1.946 +                        UDate           dateToFormat,
   1.947 +                        UChar*          result,
   1.948 +                        int32_t         resultLength,
   1.949 +                        UFieldPosition* position,
   1.950 +                        UErrorCode*     status);
   1.951 +
   1.952 +/**
   1.953 +* Parse a string into an date/time using a UDateFormat.
   1.954 +* The date will be parsed using the conventions specified in {@link #udat_open }.
   1.955 +* <P>
   1.956 +* Note that the normal date formats associated with some calendars - such
   1.957 +* as the Chinese lunar calendar - do not specify enough fields to enable
   1.958 +* dates to be parsed unambiguously. In the case of the Chinese lunar
   1.959 +* calendar, while the year within the current 60-year cycle is specified,
   1.960 +* the number of such cycles since the start date of the calendar (in the
   1.961 +* UCAL_ERA field of the UCalendar object) is not normally part of the format,
   1.962 +* and parsing may assume the wrong era. For cases such as this it is
   1.963 +* recommended that clients parse using udat_parseCalendar with the UCalendar
   1.964 +* passed in set to the current date, or to a date within the era/cycle that
   1.965 +* should be assumed if absent in the format.
   1.966 +*
   1.967 +* @param format The formatter to use.
   1.968 +* @param text The text to parse.
   1.969 +* @param textLength The length of text, or -1 if null-terminated.
   1.970 +* @param parsePos If not 0, on input a pointer to an integer specifying the offset at which
   1.971 +* to begin parsing.  If not 0, on output the offset at which parsing ended.
   1.972 +* @param status A pointer to an UErrorCode to receive any errors
   1.973 +* @return The value of the parsed date/time
   1.974 +* @see udat_format
   1.975 +* @stable ICU 2.0
   1.976 +*/
   1.977 +U_STABLE UDate U_EXPORT2 
   1.978 +udat_parse(const    UDateFormat*    format,
   1.979 +           const    UChar*          text,
   1.980 +                    int32_t         textLength,
   1.981 +                    int32_t         *parsePos,
   1.982 +                    UErrorCode      *status);
   1.983 +
   1.984 +/**
   1.985 +* Parse a string into an date/time using a UDateFormat.
   1.986 +* The date will be parsed using the conventions specified in {@link #udat_open }.
   1.987 +* @param format The formatter to use.
   1.988 +* @param calendar A calendar set on input to the date and time to be used for
   1.989 +*                 missing values in the date/time string being parsed, and set
   1.990 +*                 on output to the parsed date/time. When the calendar type is
   1.991 +*                 different from the internal calendar held by the UDateFormat
   1.992 +*                 instance, the internal calendar will be cloned to a work
   1.993 +*                 calendar set to the same milliseconds and time zone as this
   1.994 +*                 calendar parameter, field values will be parsed based on the
   1.995 +*                 work calendar, then the result (milliseconds and time zone)
   1.996 +*                 will be set in this calendar.
   1.997 +* @param text The text to parse.
   1.998 +* @param textLength The length of text, or -1 if null-terminated.
   1.999 +* @param parsePos If not 0, on input a pointer to an integer specifying the offset at which
  1.1000 +* to begin parsing.  If not 0, on output the offset at which parsing ended.
  1.1001 +* @param status A pointer to an UErrorCode to receive any errors
  1.1002 +* @see udat_format
  1.1003 +* @stable ICU 2.0
  1.1004 +*/
  1.1005 +U_STABLE void U_EXPORT2 
  1.1006 +udat_parseCalendar(const    UDateFormat*    format,
  1.1007 +                            UCalendar*      calendar,
  1.1008 +                   const    UChar*          text,
  1.1009 +                            int32_t         textLength,
  1.1010 +                            int32_t         *parsePos,
  1.1011 +                            UErrorCode      *status);
  1.1012 +
  1.1013 +/**
  1.1014 +* Determine if an UDateFormat will perform lenient parsing.
  1.1015 +* With lenient parsing, the parser may use heuristics to interpret inputs that do not
  1.1016 +* precisely match the pattern. With strict parsing, inputs must match the pattern.
  1.1017 +* @param fmt The formatter to query
  1.1018 +* @return TRUE if fmt is set to perform lenient parsing, FALSE otherwise.
  1.1019 +* @see udat_setLenient
  1.1020 +* @stable ICU 2.0
  1.1021 +*/
  1.1022 +U_STABLE UBool U_EXPORT2 
  1.1023 +udat_isLenient(const UDateFormat* fmt);
  1.1024 +
  1.1025 +/**
  1.1026 +* Specify whether an UDateFormat will perform lenient parsing.
  1.1027 +* With lenient parsing, the parser may use heuristics to interpret inputs that do not
  1.1028 +* precisely match the pattern. With strict parsing, inputs must match the pattern.
  1.1029 +* @param fmt The formatter to set
  1.1030 +* @param isLenient TRUE if fmt should perform lenient parsing, FALSE otherwise.
  1.1031 +* @see dat_isLenient
  1.1032 +* @stable ICU 2.0
  1.1033 +*/
  1.1034 +U_STABLE void U_EXPORT2 
  1.1035 +udat_setLenient(    UDateFormat*    fmt,
  1.1036 +                    UBool          isLenient);
  1.1037 +
  1.1038 +/**
  1.1039 +* Get the UCalendar associated with an UDateFormat.
  1.1040 +* A UDateFormat uses a UCalendar to convert a raw value to, for example,
  1.1041 +* the day of the week.
  1.1042 +* @param fmt The formatter to query.
  1.1043 +* @return A pointer to the UCalendar used by fmt.
  1.1044 +* @see udat_setCalendar
  1.1045 +* @stable ICU 2.0
  1.1046 +*/
  1.1047 +U_STABLE const UCalendar* U_EXPORT2 
  1.1048 +udat_getCalendar(const UDateFormat* fmt);
  1.1049 +
  1.1050 +/**
  1.1051 +* Set the UCalendar associated with an UDateFormat.
  1.1052 +* A UDateFormat uses a UCalendar to convert a raw value to, for example,
  1.1053 +* the day of the week.
  1.1054 +* @param fmt The formatter to set.
  1.1055 +* @param calendarToSet A pointer to an UCalendar to be used by fmt.
  1.1056 +* @see udat_setCalendar
  1.1057 +* @stable ICU 2.0
  1.1058 +*/
  1.1059 +U_STABLE void U_EXPORT2 
  1.1060 +udat_setCalendar(            UDateFormat*    fmt,
  1.1061 +                    const   UCalendar*      calendarToSet);
  1.1062 +
  1.1063 +/**
  1.1064 +* Get the UNumberFormat associated with an UDateFormat.
  1.1065 +* A UDateFormat uses a UNumberFormat to format numbers within a date,
  1.1066 +* for example the day number.
  1.1067 +* @param fmt The formatter to query.
  1.1068 +* @return A pointer to the UNumberFormat used by fmt to format numbers.
  1.1069 +* @see udat_setNumberFormat
  1.1070 +* @stable ICU 2.0
  1.1071 +*/
  1.1072 +U_STABLE const UNumberFormat* U_EXPORT2 
  1.1073 +udat_getNumberFormat(const UDateFormat* fmt);
  1.1074 +
  1.1075 +/**
  1.1076 +* Set the UNumberFormat associated with an UDateFormat.
  1.1077 +* A UDateFormat uses a UNumberFormat to format numbers within a date,
  1.1078 +* for example the day number.
  1.1079 +* @param fmt The formatter to set.
  1.1080 +* @param numberFormatToSet A pointer to the UNumberFormat to be used by fmt to format numbers.
  1.1081 +* @see udat_getNumberFormat
  1.1082 +* @stable ICU 2.0
  1.1083 +*/
  1.1084 +U_STABLE void U_EXPORT2 
  1.1085 +udat_setNumberFormat(            UDateFormat*    fmt,
  1.1086 +                        const   UNumberFormat*  numberFormatToSet);
  1.1087 +
  1.1088 +/**
  1.1089 +* Get a locale for which date/time formatting patterns are available.
  1.1090 +* A UDateFormat in a locale returned by this function will perform the correct
  1.1091 +* formatting and parsing for the locale.
  1.1092 +* @param localeIndex The index of the desired locale.
  1.1093 +* @return A locale for which date/time formatting patterns are available, or 0 if none.
  1.1094 +* @see udat_countAvailable
  1.1095 +* @stable ICU 2.0
  1.1096 +*/
  1.1097 +U_STABLE const char* U_EXPORT2 
  1.1098 +udat_getAvailable(int32_t localeIndex);
  1.1099 +
  1.1100 +/**
  1.1101 +* Determine how many locales have date/time  formatting patterns available.
  1.1102 +* This function is most useful as determining the loop ending condition for
  1.1103 +* calls to {@link #udat_getAvailable }.
  1.1104 +* @return The number of locales for which date/time formatting patterns are available.
  1.1105 +* @see udat_getAvailable
  1.1106 +* @stable ICU 2.0
  1.1107 +*/
  1.1108 +U_STABLE int32_t U_EXPORT2 
  1.1109 +udat_countAvailable(void);
  1.1110 +
  1.1111 +/**
  1.1112 +* Get the year relative to which all 2-digit years are interpreted.
  1.1113 +* For example, if the 2-digit start year is 2100, the year 99 will be
  1.1114 +* interpreted as 2199.
  1.1115 +* @param fmt The formatter to query.
  1.1116 +* @param status A pointer to an UErrorCode to receive any errors
  1.1117 +* @return The year relative to which all 2-digit years are interpreted.
  1.1118 +* @see udat_Set2DigitYearStart
  1.1119 +* @stable ICU 2.0
  1.1120 +*/
  1.1121 +U_STABLE UDate U_EXPORT2 
  1.1122 +udat_get2DigitYearStart(    const   UDateFormat     *fmt,
  1.1123 +                                    UErrorCode      *status);
  1.1124 +
  1.1125 +/**
  1.1126 +* Set the year relative to which all 2-digit years will be interpreted.
  1.1127 +* For example, if the 2-digit start year is 2100, the year 99 will be
  1.1128 +* interpreted as 2199.
  1.1129 +* @param fmt The formatter to set.
  1.1130 +* @param d The year relative to which all 2-digit years will be interpreted.
  1.1131 +* @param status A pointer to an UErrorCode to receive any errors
  1.1132 +* @see udat_Set2DigitYearStart
  1.1133 +* @stable ICU 2.0
  1.1134 +*/
  1.1135 +U_STABLE void U_EXPORT2 
  1.1136 +udat_set2DigitYearStart(    UDateFormat     *fmt,
  1.1137 +                            UDate           d,
  1.1138 +                            UErrorCode      *status);
  1.1139 +
  1.1140 +/**
  1.1141 +* Extract the pattern from a UDateFormat.
  1.1142 +* The pattern will follow the pattern syntax rules.
  1.1143 +* @param fmt The formatter to query.
  1.1144 +* @param localized TRUE if the pattern should be localized, FALSE otherwise.
  1.1145 +* @param result A pointer to a buffer to receive the pattern.
  1.1146 +* @param resultLength The maximum size of result.
  1.1147 +* @param status A pointer to an UErrorCode to receive any errors
  1.1148 +* @return The total buffer size needed; if greater than resultLength, the output was truncated.
  1.1149 +* @see udat_applyPattern
  1.1150 +* @stable ICU 2.0
  1.1151 +*/
  1.1152 +U_STABLE int32_t U_EXPORT2 
  1.1153 +udat_toPattern(    const   UDateFormat     *fmt,
  1.1154 +                        UBool          localized,
  1.1155 +                        UChar           *result,
  1.1156 +                        int32_t         resultLength,
  1.1157 +                        UErrorCode      *status);
  1.1158 +
  1.1159 +/**
  1.1160 +* Set the pattern used by an UDateFormat.
  1.1161 +* The pattern should follow the pattern syntax rules.
  1.1162 +* @param format The formatter to set.
  1.1163 +* @param localized TRUE if the pattern is localized, FALSE otherwise.
  1.1164 +* @param pattern The new pattern
  1.1165 +* @param patternLength The length of pattern, or -1 if null-terminated.
  1.1166 +* @see udat_toPattern
  1.1167 +* @stable ICU 2.0
  1.1168 +*/
  1.1169 +U_STABLE void U_EXPORT2 
  1.1170 +udat_applyPattern(            UDateFormat     *format,
  1.1171 +                            UBool          localized,
  1.1172 +                    const   UChar           *pattern,
  1.1173 +                            int32_t         patternLength);
  1.1174 +
  1.1175 +/** 
  1.1176 + * The possible types of date format symbols 
  1.1177 + * @stable ICU 2.6
  1.1178 + */
  1.1179 +typedef enum UDateFormatSymbolType {
  1.1180 +    /** The era names, for example AD */
  1.1181 +    UDAT_ERAS,
  1.1182 +    /** The month names, for example February */
  1.1183 +    UDAT_MONTHS,
  1.1184 +    /** The short month names, for example Feb. */
  1.1185 +    UDAT_SHORT_MONTHS,
  1.1186 +    /** The CLDR-style format "wide" weekday names, for example Monday */
  1.1187 +    UDAT_WEEKDAYS,
  1.1188 +    /**
  1.1189 +     * The CLDR-style format "abbreviated" (not "short") weekday names, for example "Mon."
  1.1190 +     * For the CLDR-style format "short" weekday names, use UDAT_SHORTER_WEEKDAYS.
  1.1191 +     */
  1.1192 +    UDAT_SHORT_WEEKDAYS,
  1.1193 +    /** The AM/PM names, for example AM */
  1.1194 +    UDAT_AM_PMS,
  1.1195 +    /** The localized characters */
  1.1196 +    UDAT_LOCALIZED_CHARS,
  1.1197 +    /** The long era names, for example Anno Domini */
  1.1198 +    UDAT_ERA_NAMES,
  1.1199 +    /** The narrow month names, for example F */
  1.1200 +    UDAT_NARROW_MONTHS,
  1.1201 +    /** The CLDR-style format "narrow" weekday names, for example "M" */
  1.1202 +    UDAT_NARROW_WEEKDAYS,
  1.1203 +    /** Standalone context versions of months */
  1.1204 +    UDAT_STANDALONE_MONTHS,
  1.1205 +    UDAT_STANDALONE_SHORT_MONTHS,
  1.1206 +    UDAT_STANDALONE_NARROW_MONTHS,
  1.1207 +    /** The CLDR-style stand-alone "wide" weekday names */
  1.1208 +    UDAT_STANDALONE_WEEKDAYS,
  1.1209 +    /**
  1.1210 +     * The CLDR-style stand-alone "abbreviated" (not "short") weekday names.
  1.1211 +     * For the CLDR-style stand-alone "short" weekday names, use UDAT_STANDALONE_SHORTER_WEEKDAYS.
  1.1212 +     */
  1.1213 +    UDAT_STANDALONE_SHORT_WEEKDAYS,
  1.1214 +    /** The CLDR-style stand-alone "narrow" weekday names */
  1.1215 +    UDAT_STANDALONE_NARROW_WEEKDAYS,
  1.1216 +    /** The quarters, for example 1st Quarter */
  1.1217 +    UDAT_QUARTERS,
  1.1218 +    /** The short quarter names, for example Q1 */
  1.1219 +    UDAT_SHORT_QUARTERS,
  1.1220 +    /** Standalone context versions of quarters */
  1.1221 +    UDAT_STANDALONE_QUARTERS,
  1.1222 +    UDAT_STANDALONE_SHORT_QUARTERS,
  1.1223 +#ifndef U_HIDE_DRAFT_API
  1.1224 +    /**
  1.1225 +     * The CLDR-style short weekday names, e.g. "Su", Mo", etc.
  1.1226 +     * These are named "SHORTER" to contrast with the constants using _SHORT_
  1.1227 +     * above, which actually get the CLDR-style *abbreviated* versions of the
  1.1228 +     * corresponding names.
  1.1229 +     * @draft ICU 51
  1.1230 +     */
  1.1231 +    UDAT_SHORTER_WEEKDAYS,
  1.1232 +    /**
  1.1233 +     * Standalone version of UDAT_SHORTER_WEEKDAYS.
  1.1234 +     * @draft ICU 51
  1.1235 +     */
  1.1236 +    UDAT_STANDALONE_SHORTER_WEEKDAYS
  1.1237 +#endif  /* U_HIDE_DRAFT_API */
  1.1238 +} UDateFormatSymbolType;
  1.1239 +
  1.1240 +struct UDateFormatSymbols;
  1.1241 +/** Date format symbols.
  1.1242 + *  For usage in C programs.
  1.1243 + *  @stable ICU 2.6
  1.1244 + */
  1.1245 +typedef struct UDateFormatSymbols UDateFormatSymbols;
  1.1246 +
  1.1247 +/**
  1.1248 +* Get the symbols associated with an UDateFormat.
  1.1249 +* The symbols are what a UDateFormat uses to represent locale-specific data,
  1.1250 +* for example month or day names.
  1.1251 +* @param fmt The formatter to query.
  1.1252 +* @param type The type of symbols to get.  One of UDAT_ERAS, UDAT_MONTHS, UDAT_SHORT_MONTHS,
  1.1253 +* UDAT_WEEKDAYS, UDAT_SHORT_WEEKDAYS, UDAT_AM_PMS, or UDAT_LOCALIZED_CHARS
  1.1254 +* @param symbolIndex The desired symbol of type type.
  1.1255 +* @param result A pointer to a buffer to receive the pattern.
  1.1256 +* @param resultLength The maximum size of result.
  1.1257 +* @param status A pointer to an UErrorCode to receive any errors
  1.1258 +* @return The total buffer size needed; if greater than resultLength, the output was truncated.
  1.1259 +* @see udat_countSymbols
  1.1260 +* @see udat_setSymbols
  1.1261 +* @stable ICU 2.0
  1.1262 +*/
  1.1263 +U_STABLE int32_t U_EXPORT2 
  1.1264 +udat_getSymbols(const   UDateFormat             *fmt,
  1.1265 +                        UDateFormatSymbolType   type,
  1.1266 +                        int32_t                 symbolIndex,
  1.1267 +                        UChar                   *result,
  1.1268 +                        int32_t                 resultLength,
  1.1269 +                        UErrorCode              *status);
  1.1270 +
  1.1271 +/**
  1.1272 +* Count the number of particular symbols for an UDateFormat.
  1.1273 +* This function is most useful as for detemining the loop termination condition
  1.1274 +* for calls to {@link #udat_getSymbols }.
  1.1275 +* @param fmt The formatter to query.
  1.1276 +* @param type The type of symbols to count.  One of UDAT_ERAS, UDAT_MONTHS, UDAT_SHORT_MONTHS,
  1.1277 +* UDAT_WEEKDAYS, UDAT_SHORT_WEEKDAYS, UDAT_AM_PMS, or UDAT_LOCALIZED_CHARS
  1.1278 +* @return The number of symbols of type type.
  1.1279 +* @see udat_getSymbols
  1.1280 +* @see udat_setSymbols
  1.1281 +* @stable ICU 2.0
  1.1282 +*/
  1.1283 +U_STABLE int32_t U_EXPORT2 
  1.1284 +udat_countSymbols(    const    UDateFormat                *fmt,
  1.1285 +                            UDateFormatSymbolType    type);
  1.1286 +
  1.1287 +/**
  1.1288 +* Set the symbols associated with an UDateFormat.
  1.1289 +* The symbols are what a UDateFormat uses to represent locale-specific data,
  1.1290 +* for example month or day names.
  1.1291 +* @param format The formatter to set
  1.1292 +* @param type The type of symbols to set.  One of UDAT_ERAS, UDAT_MONTHS, UDAT_SHORT_MONTHS,
  1.1293 +* UDAT_WEEKDAYS, UDAT_SHORT_WEEKDAYS, UDAT_AM_PMS, or UDAT_LOCALIZED_CHARS
  1.1294 +* @param symbolIndex The index of the symbol to set of type type.
  1.1295 +* @param value The new value
  1.1296 +* @param valueLength The length of value, or -1 if null-terminated
  1.1297 +* @param status A pointer to an UErrorCode to receive any errors
  1.1298 +* @see udat_getSymbols
  1.1299 +* @see udat_countSymbols
  1.1300 +* @stable ICU 2.0
  1.1301 +*/
  1.1302 +U_STABLE void U_EXPORT2 
  1.1303 +udat_setSymbols(    UDateFormat             *format,
  1.1304 +                    UDateFormatSymbolType   type,
  1.1305 +                    int32_t                 symbolIndex,
  1.1306 +                    UChar                   *value,
  1.1307 +                    int32_t                 valueLength,
  1.1308 +                    UErrorCode              *status);
  1.1309 +
  1.1310 +/**
  1.1311 + * Get the locale for this date format object.
  1.1312 + * You can choose between valid and actual locale.
  1.1313 + * @param fmt The formatter to get the locale from
  1.1314 + * @param type type of the locale we're looking for (valid or actual) 
  1.1315 + * @param status error code for the operation
  1.1316 + * @return the locale name
  1.1317 + * @stable ICU 2.8
  1.1318 + */
  1.1319 +U_STABLE const char* U_EXPORT2
  1.1320 +udat_getLocaleByType(const UDateFormat *fmt,
  1.1321 +                     ULocDataLocaleType type,
  1.1322 +                     UErrorCode* status); 
  1.1323 +
  1.1324 +#ifndef U_HIDE_DRAFT_API
  1.1325 +/**
  1.1326 + * Set a particular UDisplayContext value in the formatter, such as
  1.1327 + * UDISPCTX_CAPITALIZATION_FOR_STANDALONE.
  1.1328 + * @param fmt The formatter for which to set a UDisplayContext value.
  1.1329 + * @param value The UDisplayContext value to set.
  1.1330 + * @param status A pointer to an UErrorCode to receive any errors
  1.1331 + * @draft ICU 51
  1.1332 + */
  1.1333 +U_DRAFT void U_EXPORT2
  1.1334 +udat_setContext(UDateFormat* fmt, UDisplayContext value, UErrorCode* status);
  1.1335 +
  1.1336 +/**
  1.1337 + * Get the formatter's UDisplayContext value for the specified UDisplayContextType,
  1.1338 + * such as UDISPCTX_TYPE_CAPITALIZATION.
  1.1339 + * @param fmt The formatter to query.
  1.1340 + * @param type The UDisplayContextType whose value to return
  1.1341 + * @param status A pointer to an UErrorCode to receive any errors
  1.1342 + * @return The UDisplayContextValue for the specified type.
  1.1343 + * @draft ICU 51
  1.1344 + */
  1.1345 +U_DRAFT UDisplayContext U_EXPORT2
  1.1346 +udat_getContext(UDateFormat* fmt, UDisplayContextType type, UErrorCode* status);
  1.1347 +
  1.1348 +#endif  /* U_HIDE_DRAFT_API */
  1.1349 +
  1.1350 +#ifndef U_HIDE_INTERNAL_API
  1.1351 +/**
  1.1352 +* Extract the date pattern from a UDateFormat set for relative date formatting.
  1.1353 +* The pattern will follow the pattern syntax rules.
  1.1354 +* @param fmt The formatter to query.
  1.1355 +* @param result A pointer to a buffer to receive the pattern.
  1.1356 +* @param resultLength The maximum size of result.
  1.1357 +* @param status A pointer to a UErrorCode to receive any errors
  1.1358 +* @return The total buffer size needed; if greater than resultLength, the output was truncated.
  1.1359 +* @see udat_applyPatternRelative
  1.1360 +* @internal ICU 4.2 technology preview
  1.1361 +*/
  1.1362 +U_INTERNAL int32_t U_EXPORT2 
  1.1363 +udat_toPatternRelativeDate(const UDateFormat *fmt,
  1.1364 +                           UChar             *result,
  1.1365 +                           int32_t           resultLength,
  1.1366 +                           UErrorCode        *status);
  1.1367 +
  1.1368 +/**
  1.1369 +* Extract the time pattern from a UDateFormat set for relative date formatting.
  1.1370 +* The pattern will follow the pattern syntax rules.
  1.1371 +* @param fmt The formatter to query.
  1.1372 +* @param result A pointer to a buffer to receive the pattern.
  1.1373 +* @param resultLength The maximum size of result.
  1.1374 +* @param status A pointer to a UErrorCode to receive any errors
  1.1375 +* @return The total buffer size needed; if greater than resultLength, the output was truncated.
  1.1376 +* @see udat_applyPatternRelative
  1.1377 +* @internal ICU 4.2 technology preview
  1.1378 +*/
  1.1379 +U_INTERNAL int32_t U_EXPORT2 
  1.1380 +udat_toPatternRelativeTime(const UDateFormat *fmt,
  1.1381 +                           UChar             *result,
  1.1382 +                           int32_t           resultLength,
  1.1383 +                           UErrorCode        *status);
  1.1384 +
  1.1385 +/**
  1.1386 +* Set the date & time patterns used by a UDateFormat set for relative date formatting.
  1.1387 +* The patterns should follow the pattern syntax rules.
  1.1388 +* @param format The formatter to set.
  1.1389 +* @param datePattern The new date pattern
  1.1390 +* @param datePatternLength The length of datePattern, or -1 if null-terminated.
  1.1391 +* @param timePattern The new time pattern
  1.1392 +* @param timePatternLength The length of timePattern, or -1 if null-terminated.
  1.1393 +* @param status A pointer to a UErrorCode to receive any errors
  1.1394 +* @see udat_toPatternRelativeDate, udat_toPatternRelativeTime
  1.1395 +* @internal ICU 4.2 technology preview
  1.1396 +*/
  1.1397 +U_INTERNAL void U_EXPORT2 
  1.1398 +udat_applyPatternRelative(UDateFormat *format,
  1.1399 +                          const UChar *datePattern,
  1.1400 +                          int32_t     datePatternLength,
  1.1401 +                          const UChar *timePattern,
  1.1402 +                          int32_t     timePatternLength,
  1.1403 +                          UErrorCode  *status);
  1.1404 +
  1.1405 +/**
  1.1406 + * @internal
  1.1407 + * @see udat_open
  1.1408 + */
  1.1409 +typedef UDateFormat* (U_EXPORT2 *UDateFormatOpener) (UDateFormatStyle  timeStyle,
  1.1410 +                                                    UDateFormatStyle  dateStyle,
  1.1411 +                                                    const char        *locale,
  1.1412 +                                                    const UChar       *tzID,
  1.1413 +                                                    int32_t           tzIDLength,
  1.1414 +                                                    const UChar       *pattern,
  1.1415 +                                                    int32_t           patternLength,
  1.1416 +                                                    UErrorCode        *status);
  1.1417 +
  1.1418 +/**
  1.1419 + * Register a provider factory
  1.1420 + * @internal ICU 49
  1.1421 + */
  1.1422 +U_INTERNAL void U_EXPORT2
  1.1423 +udat_registerOpener(UDateFormatOpener opener, UErrorCode *status);
  1.1424 +
  1.1425 +/**
  1.1426 + * Un-Register a provider factory
  1.1427 + * @internal ICU 49
  1.1428 + */
  1.1429 +U_INTERNAL UDateFormatOpener U_EXPORT2
  1.1430 +udat_unregisterOpener(UDateFormatOpener opener, UErrorCode *status);
  1.1431 +#endif  /* U_HIDE_INTERNAL_API */
  1.1432 +
  1.1433 +
  1.1434 +#endif /* #if !UCONFIG_NO_FORMATTING */
  1.1435 +
  1.1436 +#endif

mercurial