00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef URELDATEFMT_H
00011 #define URELDATEFMT_H
00012
00013 #include "unicode/utypes.h"
00014
00015 #if !UCONFIG_NO_FORMATTING && !UCONFIG_NO_BREAK_ITERATION
00016
00017 #include "unicode/unum.h"
00018 #include "unicode/udisplaycontext.h"
00019 #include "unicode/localpointer.h"
00020 #include "unicode/uformattedvalue.h"
00021
00045 typedef enum UDateRelativeDateTimeFormatterStyle {
00050 UDAT_STYLE_LONG,
00051
00056 UDAT_STYLE_SHORT,
00057
00062 UDAT_STYLE_NARROW,
00063
00064 #ifndef U_HIDE_DEPRECATED_API
00065
00069 UDAT_STYLE_COUNT
00070 #endif
00071 } UDateRelativeDateTimeFormatterStyle;
00072
00078 typedef enum URelativeDateTimeUnit {
00084 UDAT_REL_UNIT_YEAR,
00090 UDAT_REL_UNIT_QUARTER,
00096 UDAT_REL_UNIT_MONTH,
00102 UDAT_REL_UNIT_WEEK,
00108 UDAT_REL_UNIT_DAY,
00114 UDAT_REL_UNIT_HOUR,
00120 UDAT_REL_UNIT_MINUTE,
00126 UDAT_REL_UNIT_SECOND,
00132 UDAT_REL_UNIT_SUNDAY,
00138 UDAT_REL_UNIT_MONDAY,
00144 UDAT_REL_UNIT_TUESDAY,
00150 UDAT_REL_UNIT_WEDNESDAY,
00156 UDAT_REL_UNIT_THURSDAY,
00162 UDAT_REL_UNIT_FRIDAY,
00168 UDAT_REL_UNIT_SATURDAY,
00169 #ifndef U_HIDE_DEPRECATED_API
00170
00174 UDAT_REL_UNIT_COUNT
00175 #endif
00176 } URelativeDateTimeUnit;
00177
00178 #ifndef U_HIDE_DRAFT_API
00179
00184 typedef enum URelativeDateTimeFormatterField {
00189 UDAT_REL_LITERAL_FIELD,
00194 UDAT_REL_NUMERIC_FIELD,
00195 } URelativeDateTimeFormatterField;
00196 #endif // U_HIDE_DRAFT_API
00197
00198
00203 struct URelativeDateTimeFormatter;
00204 typedef struct URelativeDateTimeFormatter URelativeDateTimeFormatter;
00239 U_STABLE URelativeDateTimeFormatter* U_EXPORT2
00240 ureldatefmt_open( const char* locale,
00241 UNumberFormat* nfToAdopt,
00242 UDateRelativeDateTimeFormatterStyle width,
00243 UDisplayContext capitalizationContext,
00244 UErrorCode* status );
00245
00252 U_STABLE void U_EXPORT2
00253 ureldatefmt_close(URelativeDateTimeFormatter *reldatefmt);
00254
00255 #ifndef U_HIDE_DRAFT_API
00256 struct UFormattedRelativeDateTime;
00261 typedef struct UFormattedRelativeDateTime UFormattedRelativeDateTime;
00262
00272 U_DRAFT UFormattedRelativeDateTime* U_EXPORT2
00273 ureldatefmt_openResult(UErrorCode* ec);
00274
00289 U_DRAFT const UFormattedValue* U_EXPORT2
00290 ureldatefmt_resultAsValue(const UFormattedRelativeDateTime* ufrdt, UErrorCode* ec);
00291
00298 U_DRAFT void U_EXPORT2
00299 ureldatefmt_closeResult(UFormattedRelativeDateTime* ufrdt);
00300 #endif
00301
00302
00303 #if U_SHOW_CPLUSPLUS_API
00304
00305 U_NAMESPACE_BEGIN
00306
00316 U_DEFINE_LOCAL_OPEN_POINTER(LocalURelativeDateTimeFormatterPointer, URelativeDateTimeFormatter, ureldatefmt_close);
00317
00318 #ifndef U_HIDE_DRAFT_API
00319
00328 U_DEFINE_LOCAL_OPEN_POINTER(LocalUFormattedRelativeDateTimePointer, UFormattedRelativeDateTime, ureldatefmt_closeResult);
00329 #endif
00330
00331 U_NAMESPACE_END
00332
00333 #endif
00334
00363 U_STABLE int32_t U_EXPORT2
00364 ureldatefmt_formatNumeric( const URelativeDateTimeFormatter* reldatefmt,
00365 double offset,
00366 URelativeDateTimeUnit unit,
00367 UChar* result,
00368 int32_t resultCapacity,
00369 UErrorCode* status);
00370
00371 #ifndef U_HIDE_DRAFT_API
00372
00395 U_DRAFT void U_EXPORT2
00396 ureldatefmt_formatNumericToResult(
00397 const URelativeDateTimeFormatter* reldatefmt,
00398 double offset,
00399 URelativeDateTimeUnit unit,
00400 UFormattedRelativeDateTime* result,
00401 UErrorCode* status);
00402 #endif
00403
00432 U_STABLE int32_t U_EXPORT2
00433 ureldatefmt_format( const URelativeDateTimeFormatter* reldatefmt,
00434 double offset,
00435 URelativeDateTimeUnit unit,
00436 UChar* result,
00437 int32_t resultCapacity,
00438 UErrorCode* status);
00439
00440 #ifndef U_HIDE_DRAFT_API
00441
00467 U_DRAFT void U_EXPORT2
00468 ureldatefmt_formatToResult(
00469 const URelativeDateTimeFormatter* reldatefmt,
00470 double offset,
00471 URelativeDateTimeUnit unit,
00472 UFormattedRelativeDateTime* result,
00473 UErrorCode* status);
00474 #endif
00475
00505 U_STABLE int32_t U_EXPORT2
00506 ureldatefmt_combineDateAndTime( const URelativeDateTimeFormatter* reldatefmt,
00507 const UChar * relativeDateString,
00508 int32_t relativeDateStringLen,
00509 const UChar * timeString,
00510 int32_t timeStringLen,
00511 UChar* result,
00512 int32_t resultCapacity,
00513 UErrorCode* status );
00514
00515 #endif
00516
00517 #endif