Logo Search packages:      
Sourcecode: icu version File versions  Download package

RelativeDateFormat Class Reference

#include <reldtfmt.h>

Inheritance diagram for RelativeDateFormat:

DateFormat Format UObject UMemory

List of all members.


Detailed Description

This class is normally accessed using the kRelative or k...Relative values of EStyle as parameters to DateFormat::createDateInstance.

Example: DateFormat *fullrelative = DateFormat::createDateInstance(DateFormat::kFullRelative, loc);

ICU 3.8

Definition at line 40 of file reldtfmt.h.


Public Types

enum  EField {
  kEraField = UDAT_ERA_FIELD, kYearField = UDAT_YEAR_FIELD, kMonthField = UDAT_MONTH_FIELD, kDateField = UDAT_DATE_FIELD,
  kHourOfDay1Field = UDAT_HOUR_OF_DAY1_FIELD, kHourOfDay0Field = UDAT_HOUR_OF_DAY0_FIELD, kMinuteField = UDAT_MINUTE_FIELD, kSecondField = UDAT_SECOND_FIELD,
  kMillisecondField = UDAT_FRACTIONAL_SECOND_FIELD, kDayOfWeekField = UDAT_DAY_OF_WEEK_FIELD, kDayOfYearField = UDAT_DAY_OF_YEAR_FIELD, kDayOfWeekInMonthField = UDAT_DAY_OF_WEEK_IN_MONTH_FIELD,
  kWeekOfYearField = UDAT_WEEK_OF_YEAR_FIELD, kWeekOfMonthField = UDAT_WEEK_OF_MONTH_FIELD, kAmPmField = UDAT_AM_PM_FIELD, kHour1Field = UDAT_HOUR1_FIELD,
  kHour0Field = UDAT_HOUR0_FIELD, kTimezoneField = UDAT_TIMEZONE_FIELD, kYearWOYField = UDAT_YEAR_WOY_FIELD, kDOWLocalField = UDAT_DOW_LOCAL_FIELD,
  kExtendedYearField = UDAT_EXTENDED_YEAR_FIELD, kJulianDayField = UDAT_JULIAN_DAY_FIELD, kMillisecondsInDayField = UDAT_MILLISECONDS_IN_DAY_FIELD, ERA_FIELD = UDAT_ERA_FIELD,
  YEAR_FIELD = UDAT_YEAR_FIELD, MONTH_FIELD = UDAT_MONTH_FIELD, DATE_FIELD = UDAT_DATE_FIELD, HOUR_OF_DAY1_FIELD = UDAT_HOUR_OF_DAY1_FIELD,
  HOUR_OF_DAY0_FIELD = UDAT_HOUR_OF_DAY0_FIELD, MINUTE_FIELD = UDAT_MINUTE_FIELD, SECOND_FIELD = UDAT_SECOND_FIELD, MILLISECOND_FIELD = UDAT_FRACTIONAL_SECOND_FIELD,
  DAY_OF_WEEK_FIELD = UDAT_DAY_OF_WEEK_FIELD, DAY_OF_YEAR_FIELD = UDAT_DAY_OF_YEAR_FIELD, DAY_OF_WEEK_IN_MONTH_FIELD = UDAT_DAY_OF_WEEK_IN_MONTH_FIELD, WEEK_OF_YEAR_FIELD = UDAT_WEEK_OF_YEAR_FIELD,
  WEEK_OF_MONTH_FIELD = UDAT_WEEK_OF_MONTH_FIELD, AM_PM_FIELD = UDAT_AM_PM_FIELD, HOUR1_FIELD = UDAT_HOUR1_FIELD, HOUR0_FIELD = UDAT_HOUR0_FIELD,
  TIMEZONE_FIELD = UDAT_TIMEZONE_FIELD
}
enum  EStyle {
  kNone = -1, kFull = 0, kLong = 1, kMedium = 2,
  kShort = 3, kDateOffset = kShort + 1, kDateTime = 8, kDateTimeOffset = kDateTime + 1,
  kRelative = (1 << 7), kFullRelative = (kFull | kRelative), kLongRelative = kLong | kRelative, kMediumRelative = kMedium | kRelative,
  kShortRelative = kShort | kRelative, kDefault = kMedium, FULL = kFull, LONG = kLong,
  MEDIUM = kMedium, SHORT = kShort, DEFAULT = kDefault, DATE_OFFSET = kDateOffset,
  NONE = kNone, DATE_TIME = kDateTime
}

Public Member Functions

virtual void adoptCalendar (Calendar *calendarToAdopt)
virtual void adoptNumberFormat (NumberFormat *formatToAdopt)
virtual void adoptTimeZone (TimeZone *zoneToAdopt)
virtual void applyPatterns (const UnicodeString &datePattern, const UnicodeString &timePattern, UErrorCode &status)
virtual Formatclone (void) const
UnicodeStringformat (const Formattable &obj, UnicodeString &appendTo, UErrorCode &status) const
UnicodeStringformat (UDate date, UnicodeString &appendTo) const
UnicodeStringformat (UDate date, UnicodeString &appendTo, FieldPositionIterator *posIter, UErrorCode &status) const
UnicodeStringformat (UDate date, UnicodeString &appendTo, FieldPosition &fieldPosition) const
virtual UnicodeStringformat (Calendar &cal, UnicodeString &appendTo, FieldPositionIterator *posIter, UErrorCode &status) const
virtual UnicodeStringformat (const Formattable &obj, UnicodeString &appendTo, FieldPositionIterator *posIter, UErrorCode &status) const
virtual UnicodeStringformat (const Formattable &obj, UnicodeString &appendTo, FieldPosition &pos, UErrorCode &status) const
virtual UnicodeStringformat (Calendar &cal, UnicodeString &appendTo, FieldPosition &pos) const
virtual const CalendargetCalendar (void) const
virtual UClassID getDynamicClassID (void) const
Locale getLocale (ULocDataLocaleType type, UErrorCode &status) const
const char * getLocaleID (ULocDataLocaleType type, UErrorCode &status) const
virtual const NumberFormatgetNumberFormat (void) const
virtual const TimeZonegetTimeZone (void) const
virtual UBool isLenient (void) const
UBool operator!= (const Format &other) const
RelativeDateFormatoperator= (const RelativeDateFormat &)
virtual UBool operator== (const Format &other) const
virtual UDate parse (const UnicodeString &text, UErrorCode &status) const
UDate parse (const UnicodeString &text, ParsePosition &pos) const
virtual void parse (const UnicodeString &text, Calendar &cal, ParsePosition &pos) const
void parseObject (const UnicodeString &source, Formattable &result, UErrorCode &status) const
virtual void parseObject (const UnicodeString &source, Formattable &result, ParsePosition &parse_pos) const
 RelativeDateFormat (const RelativeDateFormat &)
 RelativeDateFormat (UDateFormatStyle timeStyle, UDateFormatStyle dateStyle, const Locale &locale, UErrorCode &status)
virtual void setCalendar (const Calendar &newCalendar)
virtual void setLenient (UBool lenient)
virtual void setNumberFormat (const NumberFormat &newNumberFormat)
virtual void setTimeZone (const TimeZone &zone)
virtual UnicodeStringtoPattern (UnicodeString &result, UErrorCode &status) const
virtual UnicodeStringtoPatternDate (UnicodeString &result, UErrorCode &status) const
virtual UnicodeStringtoPatternTime (UnicodeString &result, UErrorCode &status) const
virtual ~RelativeDateFormat ()

Static Public Member Functions

static DateFormat *U_EXPORT2 createDateInstance (EStyle style=kDefault, const Locale &aLocale=Locale::getDefault())
static DateFormat *U_EXPORT2 createDateTimeInstance (EStyle dateStyle=kDefault, EStyle timeStyle=kDefault, const Locale &aLocale=Locale::getDefault())
static DateFormat *U_EXPORT2 createInstance (void)
static DateFormat *U_EXPORT2 createTimeInstance (EStyle style=kDefault, const Locale &aLocale=Locale::getDefault())
static const Locale *U_EXPORT2 getAvailableLocales (int32_t &count)
static U_I18N_API UClassID
U_EXPORT2 
getStaticClassID (void)
static void U_EXPORT2 operator delete (void *, void *) U_NO_THROW
static void U_EXPORT2 operator delete (void *p) U_NO_THROW
static void U_EXPORT2 operator delete[] (void *p) U_NO_THROW
static void *U_EXPORT2 operator new (size_t, void *ptr) U_NO_THROW
static void *U_EXPORT2 operator new (size_t size) U_NO_THROW
static void *U_EXPORT2 operator new[] (size_t size) U_NO_THROW

Protected Member Functions

void setLocaleIDs (const char *valid, const char *actual)

Static Protected Member Functions

static void syntaxError (const UnicodeString &pattern, int32_t pos, UParseError &parseError)

Protected Attributes

CalendarfCalendar
NumberFormatfNumberFormat

Private Member Functions

const UChar * getStringForDay (int32_t day, int32_t &len, UErrorCode &status) const
CalendarinitializeCalendar (TimeZone *adoptZone, const Locale &locale, UErrorCode &status)
void loadDates (UErrorCode &status)

Static Private Member Functions

static int32_t dayDifference (Calendar &until, UErrorCode &status)

Private Attributes

MessageFormatfCombinedFormat
DateFormatfDateFormat
URelativeStringfDates
int32_t fDatesLen
UDateFormatStyle fDateStyle
int32_t fDayMax
int32_t fDayMin
Locale fLocale
DateFormatfTimeFormat
UDateFormatStyle fTimeStyle

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index