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/uformattedvalue.h"
00020
00021 #if U_SHOW_CPLUSPLUS_API
00022 #include "unicode/localpointer.h"
00023 #endif // U_SHOW_CPLUSPLUS_API
00024
00048 typedef enum UDateRelativeDateTimeFormatterStyle {
00053 UDAT_STYLE_LONG,
00054
00059 UDAT_STYLE_SHORT,
00060
00065 UDAT_STYLE_NARROW,
00066
00067 #ifndef U_HIDE_DEPRECATED_API
00068
00072 UDAT_STYLE_COUNT
00073 #endif
00074 } UDateRelativeDateTimeFormatterStyle;
00075
00081 typedef enum URelativeDateTimeUnit {
00087 UDAT_REL_UNIT_YEAR,
00093 UDAT_REL_UNIT_QUARTER,
00099 UDAT_REL_UNIT_MONTH,
00105 UDAT_REL_UNIT_WEEK,
00111 UDAT_REL_UNIT_DAY,
00117 UDAT_REL_UNIT_HOUR,
00123 UDAT_REL_UNIT_MINUTE,
00129 UDAT_REL_UNIT_SECOND,
00135 UDAT_REL_UNIT_SUNDAY,
00141 UDAT_REL_UNIT_MONDAY,
00147 UDAT_REL_UNIT_TUESDAY,
00153 UDAT_REL_UNIT_WEDNESDAY,
00159 UDAT_REL_UNIT_THURSDAY,
00165 UDAT_REL_UNIT_FRIDAY,
00171 UDAT_REL_UNIT_SATURDAY,
00172 #ifndef U_HIDE_DEPRECATED_API
00173
00177 UDAT_REL_UNIT_COUNT
00178 #endif
00179 } URelativeDateTimeUnit;
00180
00186 typedef enum URelativeDateTimeFormatterField {
00191 UDAT_REL_LITERAL_FIELD,
00196 UDAT_REL_NUMERIC_FIELD,
00197 } URelativeDateTimeFormatterField;
00198
00199
00204 struct URelativeDateTimeFormatter;
00205 typedef struct URelativeDateTimeFormatter URelativeDateTimeFormatter;
00240 U_CAPI URelativeDateTimeFormatter* U_EXPORT2
00241 ureldatefmt_open( const char* locale,
00242 UNumberFormat* nfToAdopt,
00243 UDateRelativeDateTimeFormatterStyle width,
00244 UDisplayContext capitalizationContext,
00245 UErrorCode* status );
00246
00253 U_CAPI void U_EXPORT2
00254 ureldatefmt_close(URelativeDateTimeFormatter *reldatefmt);
00255
00256 struct UFormattedRelativeDateTime;
00261 typedef struct UFormattedRelativeDateTime UFormattedRelativeDateTime;
00262
00272 U_CAPI UFormattedRelativeDateTime* U_EXPORT2
00273 ureldatefmt_openResult(UErrorCode* ec);
00274
00289 U_CAPI const UFormattedValue* U_EXPORT2
00290 ureldatefmt_resultAsValue(const UFormattedRelativeDateTime* ufrdt, UErrorCode* ec);
00291
00298 U_CAPI void U_EXPORT2
00299 ureldatefmt_closeResult(UFormattedRelativeDateTime* ufrdt);
00300
00301
00302 #if U_SHOW_CPLUSPLUS_API
00303
00304 U_NAMESPACE_BEGIN
00305
00315 U_DEFINE_LOCAL_OPEN_POINTER(LocalURelativeDateTimeFormatterPointer, URelativeDateTimeFormatter, ureldatefmt_close);
00316
00326 U_DEFINE_LOCAL_OPEN_POINTER(LocalUFormattedRelativeDateTimePointer, UFormattedRelativeDateTime, ureldatefmt_closeResult);
00327
00328 U_NAMESPACE_END
00329
00330 #endif
00331
00360 U_CAPI int32_t U_EXPORT2
00361 ureldatefmt_formatNumeric( const URelativeDateTimeFormatter* reldatefmt,
00362 double offset,
00363 URelativeDateTimeUnit unit,
00364 UChar* result,
00365 int32_t resultCapacity,
00366 UErrorCode* status);
00367
00391 U_CAPI void U_EXPORT2
00392 ureldatefmt_formatNumericToResult(
00393 const URelativeDateTimeFormatter* reldatefmt,
00394 double offset,
00395 URelativeDateTimeUnit unit,
00396 UFormattedRelativeDateTime* result,
00397 UErrorCode* status);
00398
00427 U_CAPI int32_t U_EXPORT2
00428 ureldatefmt_format( const URelativeDateTimeFormatter* reldatefmt,
00429 double offset,
00430 URelativeDateTimeUnit unit,
00431 UChar* result,
00432 int32_t resultCapacity,
00433 UErrorCode* status);
00434
00461 U_CAPI void U_EXPORT2
00462 ureldatefmt_formatToResult(
00463 const URelativeDateTimeFormatter* reldatefmt,
00464 double offset,
00465 URelativeDateTimeUnit unit,
00466 UFormattedRelativeDateTime* result,
00467 UErrorCode* status);
00468
00498 U_CAPI int32_t U_EXPORT2
00499 ureldatefmt_combineDateAndTime( const URelativeDateTimeFormatter* reldatefmt,
00500 const UChar * relativeDateString,
00501 int32_t relativeDateStringLen,
00502 const UChar * timeString,
00503 int32_t timeStringLen,
00504 UChar* result,
00505 int32_t resultCapacity,
00506 UErrorCode* status );
00507
00508 #endif
00509
00510 #endif