Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

DateFormatSymbols Class Reference

DateFormatSymbols is a public class for encapsulating localizable date-time formatting data -- including timezone data. More...

#include <dtfmtsym.h>


Public Member Functions

 DateFormatSymbols (UErrorCode &status)
 Construct a DateFormatSymbols object by loading format data from resources for the default locale.
 DateFormatSymbols (const Locale &locale, UErrorCode &status)
 Construct a DateFormatSymbols object by loading format data from resources for the given locale.
 DateFormatSymbols (const DateFormatSymbols &)
 Copy constructor.
DateFormatSymbols & operator= (const DateFormatSymbols &)
 Assignment operator.
 ~DateFormatSymbols ()
 Destructor.
UBool operator== (const DateFormatSymbols &other) const
 Return true if another object is semantically equal to this one.
UBool operator!= (const DateFormatSymbols &other) const
 Return true if another object is semantically unequal to this one.
const UnicodeString * getEras (int32_t &count) const
 Gets era strings.
void setEras (const UnicodeString *eras, int32_t count)
 Sets era strings.
const UnicodeString * getMonths (int32_t &count) const
 Gets month strings.
void setMonths (const UnicodeString *months, int32_t count)
 Sets month strings.
const UnicodeString * getShortMonths (int32_t &count) const
 Gets short month strings.
void setShortMonths (const UnicodeString *shortMonths, int32_t count)
 Sets short month strings.
const UnicodeString * getWeekdays (int32_t &count) const
 Gets weekday strings.
void setWeekdays (const UnicodeString *weekdays, int32_t count)
 Sets weekday strings.
const UnicodeString * getShortWeekdays (int32_t &count) const
 Gets short weekday strings.
void setShortWeekdays (const UnicodeString *shortWeekdays, int32_t count)
 Sets short weekday strings.
const UnicodeString * getAmPmStrings (int32_t &count) const
 Gets AM/PM strings.
void setAmPmStrings (const UnicodeString *ampms, int32_t count)
 Sets ampm strings.
const UnicodeString ** getZoneStrings (int32_t &rowCount, int32_t &columnCount) const
 Gets timezone strings.
void setZoneStrings (const UnicodeString *const *strings, int32_t rowCount, int32_t columnCount)
 Sets timezone strings.
UnicodeString & getLocalPatternChars (UnicodeString &result) const
 Gets localized date-time pattern characters.
void setLocalPatternChars (const UnicodeString &newLocalPatternChars)
 Sets localized date-time pattern characters.

Static Public Member Functions

static const UnicodeString & getPatternChars (void)
 Get the non-localized date-time pattern characters.
static const UChar * getPatternUChars (void)
 Get the non-localized date-time pattern characters.

Friends

class SimpleDateFormat


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.

New DateFormatSymbols sub-classes may be added to support SimpleDateFormat for date-time formatting for additional locales.


Constructor & Destructor Documentation

DateFormatSymbols::DateFormatSymbols (  UErrorCode &  status  ) 
 

Construct a DateFormatSymbols object by loading format data from resources for the default locale.

NOTE: This constructor will never fail; if it cannot get resource data for the default locale, it will return a last-resort object based on hard-coded strings.

Parameters:
status Output param set to success of failure. Failure results if the resources for the default cannot be found or cannot be loaded

DateFormatSymbols::DateFormatSymbols (  const Locale &  locale,
UErrorCode &  status
) 
 

Construct a DateFormatSymbols object by loading format data from resources for the given locale.

Parameters:
locale Locale to load format data from.
status Output param set to success of failure. Failure results if the resources for the locale cannot be found or cannot be loaded

DateFormatSymbols::DateFormatSymbols (  const DateFormatSymbols &   ) 
 

Copy constructor.

DateFormatSymbols::~DateFormatSymbols (   ) 
 

Destructor.

This is nonvirtual because this class is not designed to be subclassed.


Member Function Documentation

const UnicodeString* DateFormatSymbols::getAmPmStrings (  int32_t &  count  )  const
 

Gets AM/PM strings.

For example: "AM" and "PM".

Returns:
the weekday strings. (DateFormatSymbols retains ownership.)

const UnicodeString* DateFormatSymbols::getEras (  int32_t &  count  )  const
 

Gets era strings.

For example: "AD" and "BC".

Returns:
the era strings.

UnicodeString& DateFormatSymbols::getLocalPatternChars (  UnicodeString &  result  )  const
 

Gets localized date-time pattern characters.

For example: 'u', 't', etc.

Returns:
the localized date-time pattern characters.

const UnicodeString* DateFormatSymbols::getMonths (  int32_t &  count  )  const
 

Gets month strings.

For example: "January", "February", etc.

Parameters:
count Filled in with length of the array.
Returns:
the month strings. (DateFormatSymbols retains ownership.)

static const UnicodeString& DateFormatSymbols::getPatternChars (  void   )  [static]
 

Get the non-localized date-time pattern characters.

Deprecated:
remove after Aug 2002.
Use getPatternUChars instead.

static const UChar* DateFormatSymbols::getPatternUChars (  void   )  [static]
 

Get the non-localized date-time pattern characters.

const UnicodeString* DateFormatSymbols::getShortMonths (  int32_t &  count  )  const
 

Gets short month strings.

For example: "Jan", "Feb", etc.

Returns:
the short month strings. (DateFormatSymbols retains ownership.)

const UnicodeString* DateFormatSymbols::getShortWeekdays (  int32_t &  count  )  const
 

Gets short weekday strings.

For example: "Sun", "Mon", etc.

Returns:
the short weekday strings. (DateFormatSymbols retains ownership.)

const UnicodeString* DateFormatSymbols::getWeekdays (  int32_t &  count  )  const
 

Gets weekday strings.

For example: "Sunday", "Monday", etc.

Returns:
the weekday strings. (DateFormatSymbols retains ownership.)

const UnicodeString** DateFormatSymbols::getZoneStrings (  int32_t &  rowCount,
int32_t &  columnCount
)  const
 

Gets timezone strings.

These strings are stored in a 2-dimensional array.

Parameters:
rowCount Output param to receive number of rows.
columnCount Output param to receive number of columns.
Returns:
The timezone strings as a 2-d array. (DateFormatSymbols retains ownership.)

UBool DateFormatSymbols::operator!= (  const DateFormatSymbols &  other  )  const [inline]
 

Return true if another object is semantically unequal to this one.

DateFormatSymbols& DateFormatSymbols::operator= (  const DateFormatSymbols &   ) 
 

Assignment operator.

UBool DateFormatSymbols::operator== (  const DateFormatSymbols &  other  )  const
 

Return true if another object is semantically equal to this one.

void DateFormatSymbols::setAmPmStrings (  const UnicodeString *  ampms,
int32_t  count
) 
 

Sets ampm strings.

For example: "AM" and "PM".

Parameters:
newAmpms the new ampm strings. (not adopted; caller retains ownership)

void DateFormatSymbols::setEras (  const UnicodeString *  eras,
int32_t  count
) 
 

Sets era strings.

For example: "AD" and "BC".

Parameters:
eras Array of era strings (DateFormatSymbols retains ownership.)
count Filled in with length of the array.

void DateFormatSymbols::setLocalPatternChars (  const UnicodeString &  newLocalPatternChars  ) 
 

Sets localized date-time pattern characters.

For example: 'u', 't', etc.

Parameters:
newLocalPatternChars the new localized date-time pattern characters.

void DateFormatSymbols::setMonths (  const UnicodeString *  months,
int32_t  count
) 
 

Sets month strings.

For example: "January", "February", etc.

Parameters:
newMonths the new month strings. (not adopted; caller retains ownership)

void DateFormatSymbols::setShortMonths (  const UnicodeString *  shortMonths,
int32_t  count
) 
 

Sets short month strings.

For example: "Jan", "Feb", etc.

Parameters:
newShortMonths the new short month strings. (not adopted; caller retains ownership)

void DateFormatSymbols::setShortWeekdays (  const UnicodeString *  shortWeekdays,
int32_t  count
) 
 

Sets short weekday strings.

For example: "Sun", "Mon", etc.

Parameters:
newShortWeekdays the new short weekday strings. (not adopted; caller retains ownership)

void DateFormatSymbols::setWeekdays (  const UnicodeString *  weekdays,
int32_t  count
) 
 

Sets weekday strings.

For example: "Sunday", "Monday", etc.

Parameters:
newWeekdays the new weekday strings. (not adopted; caller retains ownership)

void DateFormatSymbols::setZoneStrings (  const UnicodeString *const *  strings,
int32_t  rowCount,
int32_t  columnCount
) 
 

Sets timezone strings.

These strings are stored in a 2-dimensional array.

Parameters:
strings The timezone strings as a 2-d array to be copied. (not adopted; caller retains ownership)
rowCount The number of rows (count of first index).
columnCount The number of columns (count of second index).


The documentation for this class was generated from the following file:
Generated on Sun May 22 18:49:40 2005 for ICU 2.1 by  doxygen 1.4.2