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

DateFormatSymbols Class Reference

#include <dtfmtsym.h>

Inheritance diagram for DateFormatSymbols:

UObject UMemory

List of all members.


Detailed Description

DateFormatSymbols is a public class for encapsulating localizable date-time formatting data -- including timezone data. DateFormatSymbols is used by DateFormat and SimpleDateFormat.

Rather than first creating a DateFormatSymbols to get a date-time formatter by using a SimpleDateFormat constructor, clients are encouraged to create a date-time formatter using the getTimeInstance(), getDateInstance(), or getDateTimeInstance() method in DateFormat. Each of these methods can return a date/time formatter initialized with a default format pattern along with the date-time formatting data for a given or default locale. After a formatter is created, clients may modify the format pattern using the setPattern function as so desired. For more information on using these formatter factory functions, see DateFormat.

If clients decide to create a date-time formatter with a particular format pattern and locale, they can do so with new SimpleDateFormat(aPattern, new DateFormatSymbols(aLocale)). This will load the appropriate date-time formatting data from the locale.

DateFormatSymbols objects are clonable. When clients obtain a DateFormatSymbols object, they can feel free to modify the date-time formatting data as necessary. For instance, clients can replace the localized date-time format pattern characters with the ones that they feel easy to remember. Or they can change the representative cities originally picked by default to using their favorite ones.

DateFormatSymbols are not expected to be subclassed. Data for a calendar is loaded out of resource bundles. The 'type' parameter indicates the type of calendar, for example, "gregorian" or "japanese". If the type is not gregorian (or NULL, or an empty string) then the type is appended to the resource name, for example, 'Eras_japanese' instead of 'Eras'. If the resource 'Eras_japanese' did not exist (even in root), then this class will fall back to just 'Eras', that is, Gregorian data. Therefore, the calendar implementor MUST ensure that the root locale at least contains any resources that are to be particularized for the calendar type.

Definition at line 80 of file dtfmtsym.h.


Public Types

enum  DtContextType { FORMAT, STANDALONE, DT_CONTEXT_COUNT }
enum  DtWidthType { ABBREVIATED, WIDE, NARROW, DT_WIDTH_COUNT }

Public Member Functions

 DateFormatSymbols (const DateFormatSymbols &)
 DateFormatSymbols (const Locale &locale, const char *type, UErrorCode &status)
 DateFormatSymbols (const char *type, UErrorCode &status)
 DateFormatSymbols (const Locale &locale, UErrorCode &status)
 DateFormatSymbols (UErrorCode &status)
const UnicodeStringgetAmPmStrings (int32_t &count) const
virtual UClassID getDynamicClassID () const
const UnicodeStringgetEraNames (int32_t &count) const
const UnicodeStringgetEras (int32_t &count) const
Locale getLocale (ULocDataLocaleType type, UErrorCode &status) const
UnicodeStringgetLocalPatternChars (UnicodeString &result) const
const UnicodeStringgetMonths (int32_t &count, DtContextType context, DtWidthType width) const
const UnicodeStringgetMonths (int32_t &count) const
const UnicodeStringgetNarrowEras (int32_t &count) const
const UnicodeStringgetQuarters (int32_t &count, DtContextType context, DtWidthType width) const
const UnicodeStringgetShortMonths (int32_t &count) const
const UnicodeStringgetShortWeekdays (int32_t &count) const
const UnicodeStringgetWeekdays (int32_t &count, DtContextType context, DtWidthType width) const
const UnicodeStringgetWeekdays (int32_t &count) const
const UnicodeString ** getZoneStrings (int32_t &rowCount, int32_t &columnCount) const
UBool operator!= (const DateFormatSymbols &other) const
DateFormatSymbolsoperator= (const DateFormatSymbols &)
UBool operator== (const DateFormatSymbols &other) const
void setAmPmStrings (const UnicodeString *ampms, int32_t count)
void setEraNames (const UnicodeString *eraNames, int32_t count)
void setEras (const UnicodeString *eras, int32_t count)
void setLocalPatternChars (const UnicodeString &newLocalPatternChars)
void setMonths (const UnicodeString *months, int32_t count, DtContextType context, DtWidthType width)
void setMonths (const UnicodeString *months, int32_t count)
void setNarrowEras (const UnicodeString *narrowEras, int32_t count)
void setQuarters (const UnicodeString *quarters, int32_t count, DtContextType context, DtWidthType width)
void setShortMonths (const UnicodeString *shortMonths, int32_t count)
void setShortWeekdays (const UnicodeString *shortWeekdays, int32_t count)
void setWeekdays (const UnicodeString *weekdays, int32_t count, DtContextType context, DtWidthType width)
void setWeekdays (const UnicodeString *weekdays, int32_t count)
void setZoneStrings (const UnicodeString *const *strings, int32_t rowCount, int32_t columnCount)
virtual ~DateFormatSymbols ()

Static Public Member Functions

static const UChar *U_EXPORT2 getPatternUChars (void)
static UClassID U_EXPORT2 getStaticClassID ()
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

Private Types

enum  GMTHourType {
  GMT_NEGATIVE_HMS = 0, GMT_NEGATIVE_HM, GMT_POSITIVE_HMS, GMT_POSITIVE_HM,
  GMT_HOUR_COUNT
}

Private Member Functions

void copyData (const DateFormatSymbols &other)
void createZoneStrings (const UnicodeString *const *otherStrings)
void dispose (void)
void disposeZoneStrings (void)
const ZoneStringFormat * getZoneStringFormat (void) const
void initializeData (const Locale &, const char *type, UErrorCode &status, UBool useLastResortData=FALSE)
void initZoneStringFormat (void)
void initZoneStringsArray (void)

Static Private Member Functions

static UBool arrayCompare (const UnicodeString *array1, const UnicodeString *array2, int32_t count)
static void assignArray (UnicodeString *&dstArray, int32_t &dstCount, const UnicodeString *srcArray, int32_t srcCount)

Private Attributes

char actualLocale [ULOC_FULLNAME_CAPACITY]
UnicodeStringfAmPms
int32_t fAmPmsCount
UnicodeStringfEraNames
int32_t fEraNamesCount
UnicodeStringfEras
int32_t fErasCount
UnicodeString fGmtFormat
UnicodeStringfGmtHourFormats
int32_t fGmtHourFormatsCount
UnicodeString ** fLocaleZoneStrings
UnicodeString fLocalPatternChars
UnicodeStringfMonths
int32_t fMonthsCount
UnicodeStringfNarrowEras
int32_t fNarrowErasCount
UnicodeStringfNarrowMonths
int32_t fNarrowMonthsCount
UnicodeStringfNarrowWeekdays
int32_t fNarrowWeekdaysCount
UnicodeStringfQuarters
int32_t fQuartersCount
UnicodeStringfShortMonths
int32_t fShortMonthsCount
UnicodeStringfShortQuarters
int32_t fShortQuartersCount
UnicodeStringfShortWeekdays
int32_t fShortWeekdaysCount
UnicodeStringfStandaloneMonths
int32_t fStandaloneMonthsCount
UnicodeStringfStandaloneNarrowMonths
int32_t fStandaloneNarrowMonthsCount
UnicodeStringfStandaloneNarrowWeekdays
int32_t fStandaloneNarrowWeekdaysCount
UnicodeStringfStandaloneQuarters
int32_t fStandaloneQuartersCount
UnicodeStringfStandaloneShortMonths
int32_t fStandaloneShortMonthsCount
UnicodeStringfStandaloneShortQuarters
int32_t fStandaloneShortQuartersCount
UnicodeStringfStandaloneShortWeekdays
int32_t fStandaloneShortWeekdaysCount
UnicodeStringfStandaloneWeekdays
int32_t fStandaloneWeekdaysCount
UnicodeStringfWeekdays
int32_t fWeekdaysCount
const ZoneStringFormat * fZoneStringFormat
UnicodeString ** fZoneStrings
int32_t fZoneStringsColCount
int32_t fZoneStringsRowCount
SafeZoneStringFormatPtr * fZSFCachePtr
ZoneStringFormat * fZSFLocal
Locale fZSFLocale
char validLocale [ULOC_FULLNAME_CAPACITY]

Friends

class DateFormatSymbolsSingleSetter
class SimpleDateFormat

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

Generated by  Doxygen 1.6.0   Back to index