Go to the documentation of this file.
14 #ifndef __DTPTNGEN_H__
15 #define __DTPTNGEN_H__
19 #if U_SHOW_CPLUSPLUS_API
38 class DateTimeMatcher;
42 class SharedDateTimePatternGenerator;
77 #ifndef U_HIDE_INTERNAL_API
450 #ifndef U_HIDE_INTERNAL_API
486 #if !UCONFIG_NO_FORMATTING
488 #ifndef U_HIDE_DRAFT_API
548 DateTimeMatcher* dtMatcher;
549 DistanceInfo *distanceInfo;
550 PatternMap *patternMap;
556 DateTimeMatcher *skipMatcher;
557 Hashtable *fAvailableFormatKeyHash;
559 char16_t fDefaultHourFormatChar;
561 int32_t fAllowedHourFormats[7];
571 kDTPGFixFractionalSeconds = 1,
572 kDTPGSkeletonUsesCapJ = 2
580 void getCalendarTypeToUse(
const Locale& locale, CharString& destination,
UErrorCode& err);
594 const UnicodeString* getBestRaw(DateTimeMatcher& source, int32_t includeMask, DistanceInfo* missingFields,
UErrorCode& status,
const PtnSkeleton** specifiedSkeletonPtr = 0);
597 int32_t getTopBitNumber(int32_t foundMask)
const;
600 void copyHashtable(Hashtable *other,
UErrorCode &status);
605 struct AppendItemFormatsSink;
606 struct AppendItemNamesSink;
607 struct AvailableFormatsSink;
UDateTimePatternConflict addPattern(const UnicodeString &pattern, UBool override, UnicodeString &conflictingPattern, UErrorCode &status)
Adds a pattern to the generator.
@ UDATPG_FIELD_COUNT
One more than the highest normal UDateTimePatternField value.
UnicodeString getFieldDisplayName(UDateTimePatternField field, UDateTimePGDisplayWidth width) const
The general interface to get a display name for a particular date/time field, in one of several possi...
UnicodeString replaceFieldTypes(const UnicodeString &pattern, const UnicodeString &skeleton, UDateTimePatternMatchOptions options, UErrorCode &status)
Adjusts the field types (width and subtype) of a pattern to match what is in a skeleton.
Basic definitions for ICU, for both C and C++ APIs.
UDateTimePatternConflict
Status return values from udatpg_addPattern().
int8_t UBool
The ICU boolean type.
UnicodeString getBestPattern(const UnicodeString &skeleton, UDateTimePatternMatchOptions options, UErrorCode &status)
Return the best pattern matching the input skeleton.
C API: Wrapper for icu::DateTimePatternGenerator (unicode/dtptngen.h).
UBool operator!=(const DateTimePatternGenerator &other) const
Return true if another object is semantically unequal to this one.
void setDecimal(const UnicodeString &decimal)
The decimal value is used in formatting fractions of seconds.
StringEnumeration * getRedundants(UErrorCode &status)
Return a list of redundant patterns are those which if removed, make no difference in the resulting g...
static UnicodeString staticGetBaseSkeleton(const UnicodeString &pattern, UErrorCode &status)
Utility to return a unique base skeleton from a given pattern.
This class provides flexible generation of date format patterns, like "yy-MM-dd".
UDateTimePatternField
Field number constants for udatpg_getAppendItemFormats() and similar functions.
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
UnicodeString getBestPattern(const UnicodeString &skeleton, UErrorCode &status)
Return the best pattern matching the input skeleton.
void setAppendItemName(UDateTimePatternField field, const UnicodeString &value)
Sets the names of field, eg "era" in English for ERA.
UObject is the common ICU "boilerplate" class.
UnicodeString getSkeleton(const UnicodeString &pattern, UErrorCode &status)
Utility to return a unique skeleton from a given pattern.
const UnicodeString & getAppendItemFormat(UDateTimePatternField field) const
Getter corresponding to setAppendItemFormat.
void * UClassID
UClassID is used to identify classes without using the compiler's RTTI.
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
UDateFormatHourCycle
Hour Cycle.
virtual UClassID getDynamicClassID() const
ICU "poor man's RTTI", returns a UClassID for the actual class.
Base class for 'pure' C++ implementations of uenum api.
DateTimePatternGenerator * clone() const
Clone DateTimePatternGenerator object.
@ UDATPG_MATCH_NO_OPTIONS
static UClassID getStaticClassID(void)
ICU "poor man's RTTI", returns a UClassID for this class.
StringEnumeration * getSkeletons(UErrorCode &status) const
Return a list of all the skeletons (in canonical form) from this class.
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.
const UnicodeString & getDecimal() const
Getter corresponding to setDecimal.
UDateTimePatternMatchOptions
Masks to control forcing the length of specified fields in the returned pattern to match those in the...
static DateTimePatternGenerator * createInstance(UErrorCode &status)
Construct a flexible generator according to default locale.
const UnicodeString & getAppendItemName(UDateTimePatternField field) const
Getter corresponding to setAppendItemNames.
C++ API: Abstract class for converting dates.
UDateFormatHourCycle getDefaultHourCycle(UErrorCode &status) const
Get the default hour cycle for a locale.
UBool operator==(const DateTimePatternGenerator &other) const
Return true if another object is semantically equal to this one.
void setDateTimeFormat(const UnicodeString &dateTimeFormat)
The DateTimeFormat is a message format pattern used to compose date and time patterns.
const UnicodeString & getDateTimeFormat() const
Getter corresponding to setDateTimeFormat.
static DateTimePatternGenerator * internalMakeInstance(const Locale &uLocale, UErrorCode &status)
For ICU use only.
C++ API: Locale ID object.
const UnicodeString & getPatternForSkeleton(const UnicodeString &skeleton) const
Get the pattern corresponding to a given skeleton.
void setAppendItemFormat(UDateTimePatternField field, const UnicodeString &value)
An AppendItem format is a pattern used to append a field if there is no good match.
static UnicodeString staticGetSkeleton(const UnicodeString &pattern, UErrorCode &status)
Utility to return a unique skeleton from a given pattern.
static DateTimePatternGenerator * createEmptyInstance(UErrorCode &status)
Create an empty generator, to be constructed with addPattern(...) etc.
virtual ~DateTimePatternGenerator()
Destructor.
UnicodeString getBaseSkeleton(const UnicodeString &pattern, UErrorCode &status)
Utility to return a unique base skeleton from a given pattern.
A Locale object represents a specific geographical, political, or cultural region.
static DateTimePatternGenerator * createInstance(const Locale &uLocale, UErrorCode &status)
Construct a flexible generator according to data for a given locale.
StringEnumeration * getBaseSkeletons(UErrorCode &status) const
Return a list of all the base skeletons (in canonical form) from this class.
UDateTimePGDisplayWidth
Field display name width constants for udatpg_getFieldDisplayName().