DateTimePatternGenerator Class Reference

This class provides flexible generation of date format patterns, like "yy-MM-dd". More...

#include <dtptngen.h>

Inheritance diagram for DateTimePatternGenerator:

UObject UMemory

Public Member Functions

virtual ~DateTimePatternGenerator ()
 Destructor.
DateTimePatternGeneratorclone () const
 Clone DateTimePatternGenerator object.
UBool operator== (const DateTimePatternGenerator &other) const
 Return true if another object is semantically equal to this one.
UBool operator!= (const DateTimePatternGenerator &other) const
 Return true if another object is semantically unequal to this one.
UnicodeString getSkeleton (const UnicodeString &pattern, UErrorCode &status)
 Utility to return a unique skeleton from a given pattern.
UnicodeString getBaseSkeleton (const UnicodeString &pattern, UErrorCode &status)
 Utility to return a unique base skeleton from a given pattern.
UDateTimePatternConflict addPattern (const UnicodeString &pattern, UBool override, UnicodeString &conflictingPattern, UErrorCode &status)
 Adds a pattern to the generator.
void setAppendItemFormat (UDateTimePatternField field, const UnicodeString &value)
 An AppendItem format is a pattern used to append a field if there is no good match.
const UnicodeStringgetAppendItemFormat (UDateTimePatternField field) const
 Getter corresponding to setAppendItemFormat.
void setAppendItemName (UDateTimePatternField field, const UnicodeString &value)
 Sets the names of field, eg "era" in English for ERA.
const UnicodeStringgetAppendItemName (UDateTimePatternField field) const
 Getter corresponding to setAppendItemNames.
void setDateTimeFormat (const UnicodeString &dateTimeFormat)
 The date time format is a message format pattern used to compose date and time patterns.
const UnicodeStringgetDateTimeFormat () const
 Getter corresponding to setDateTimeFormat.
UnicodeString getBestPattern (const UnicodeString &skeleton, UErrorCode &status)
 Return the best pattern matching the input skeleton.
UnicodeString replaceFieldTypes (const UnicodeString &pattern, const UnicodeString &skeleton, UErrorCode &status)
 Adjusts the field types (width and subtype) of a pattern to match what is in a skeleton.
StringEnumerationgetSkeletons (UErrorCode &status) const
 Return a list of all the skeletons (in canonical form) from this class.
const UnicodeStringgetPatternForSkeleton (const UnicodeString &skeleton) const
 Get the pattern corresponding to a given skeleton.
StringEnumerationgetBaseSkeletons (UErrorCode &status) const
 Return a list of all the base skeletons (in canonical form) from this class.
StringEnumerationgetRedundants (UErrorCode &status)
 Return a list of redundant patterns are those which if removed, make no difference in the resulting getBestPattern values.
void setDecimal (const UnicodeString &decimal)
 The decimal value is used in formatting fractions of seconds.
const UnicodeStringgetDecimal () const
 Getter corresponding to setDecimal.
virtual UClassID getDynamicClassID () const
 ICU "poor man's RTTI", returns a UClassID for the actual class.

Static Public Member Functions

static DateTimePatternGeneratorcreateInstance (UErrorCode &status)
 Construct a flexible generator according to default locale.
static DateTimePatternGeneratorcreateInstance (const Locale &uLocale, UErrorCode &status)
 Construct a flexible generator according to data for a given locale.
static DateTimePatternGeneratorcreateEmptyInstance (UErrorCode &status)
 Create an empty generator, to be constructed with addPattern(.
static UClassID getStaticClassID (void)
 ICU "poor man's RTTI", returns a UClassID for this class.

Detailed Description

This class provides flexible generation of date format patterns, like "yy-MM-dd".

The user can build up the generator by adding successive patterns. Once that is done, a query can be made using a "skeleton", which is a pattern which just includes the desired fields and lengths. The generator will return the "best fit" pattern corresponding to that skeleton.

The main method people will use is getBestPattern(String skeleton), since normally this class is pre-built with data from a particular locale. However, generators can be built directly from other data as well.

Issue: may be useful to also have a function that returns the list of fields in a pattern, in order, since we have that internally. That would be useful for getting the UI order of field elements.

Draft:
This API may be changed in the future versions and was introduced in ICU 3.8

Definition at line 42 of file dtptngen.h.


Constructor & Destructor Documentation

virtual DateTimePatternGenerator::~DateTimePatternGenerator (  )  [virtual]

Destructor.

Draft:
This API may be changed in the future versions and was introduced in ICU 3.8


Member Function Documentation

static DateTimePatternGenerator* DateTimePatternGenerator::createInstance ( UErrorCode status  )  [static]

Construct a flexible generator according to default locale.

Parameters:
status Output param set to success/failure code on exit, which must not indicate a failure before the function call.
Draft:
This API may be changed in the future versions and was introduced in ICU 3.8

static DateTimePatternGenerator* DateTimePatternGenerator::createInstance ( const Locale uLocale,
UErrorCode status 
) [static]

Construct a flexible generator according to data for a given locale.

Parameters:
uLocale 
status Output param set to success/failure code on exit, which must not indicate a failure before the function call.
Draft:
This API may be changed in the future versions and was introduced in ICU 3.8

static DateTimePatternGenerator* DateTimePatternGenerator::createEmptyInstance ( UErrorCode status  )  [static]

Create an empty generator, to be constructed with addPattern(.

..) etc.

Parameters:
status Output param set to success/failure code on exit, which must not indicate a failure before the function call.
Draft:
This API may be changed in the future versions and was introduced in ICU 3.8

DateTimePatternGenerator* DateTimePatternGenerator::clone (  )  const

Clone DateTimePatternGenerator object.

Clients are responsible for deleting the DateTimePatternGenerator object cloned.

Draft:
This API may be changed in the future versions and was introduced in ICU 3.8

UBool DateTimePatternGenerator::operator== ( const DateTimePatternGenerator other  )  const

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

Parameters:
other the DateTimePatternGenerator object to be compared with.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.
Returns:
true if other is semantically equal to this.