- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

# dtptngen.h

Go to the documentation of this file.

    00001 /*
    00002 *******************************************************************************
    00003 * Copyright (C) 2007-2009, International Business Machines Corporation and
    00004 * others. All Rights Reserved.
    00005 *******************************************************************************
    00006 *
    00007 * File DTPTNGEN.H
    00008 *
    00009 *******************************************************************************
    00010 */
    00011
    00012 #ifndef __DTPTNGEN_H__
    00013 #define __DTPTNGEN_H__
    00014
    00015 #include "unicode/datefmt.h"
    00016 #include "unicode/locid.h"
    00017 #include "unicode/udat.h"
    00018 #include "unicode/udatpg.h"
    00019
    00020 U_NAMESPACE_BEGIN
    00021
    00028 class Hashtable;
    00029 class FormatParser;
    00030 class DateTimeMatcher;
    00031 class DistanceInfo;
    00032 class PatternMap;
    00033 class PtnSkeleton;
    00034
    00049 class U_I18N_API DateTimePatternGenerator : public UObject {
    00050 public:
    00057     static DateTimePatternGenerator* U_EXPORT2 createInstance(UErrorCode& status);
    00058
    00066     static DateTimePatternGenerator* U_EXPORT2 createInstance(const Locale& uLocale, UErrorCode& status);
    00067
    00074      static DateTimePatternGenerator* U_EXPORT2 createEmptyInstance(UErrorCode& status);
    00075
    00080     virtual ~DateTimePatternGenerator();
    00081
    00087     DateTimePatternGenerator* clone() const;
    00088
    00096     UBool operator==(const DateTimePatternGenerator& other) const;
    00097
    00105     UBool operator!=(const DateTimePatternGenerator& other) const;
    00106
    00117     UnicodeString getSkeleton(const UnicodeString& pattern, UErrorCode& status);
    00118
    00132     UnicodeString getBaseSkeleton(const UnicodeString& pattern, UErrorCode& status);
    00133
    00154     UDateTimePatternConflict addPattern(const UnicodeString& pattern,
    00155                                         UBool override,
    00156                                         UnicodeString& conflictingPattern,
    00157                                         UErrorCode& status);
    00158
    00177     void setAppendItemFormat(UDateTimePatternField field, const UnicodeString& value);
    00178
    00187     const UnicodeString& getAppendItemFormat(UDateTimePatternField field) const;
    00188
    00200     void setAppendItemName(UDateTimePatternField field, const UnicodeString& value);
    00201
    00210     const UnicodeString& getAppendItemName(UDateTimePatternField field) const;
    00211
    00231     void setDateTimeFormat(const UnicodeString& dateTimeFormat);
    00232
    00238     const UnicodeString& getDateTimeFormat() const;
    00239
    00253      UnicodeString getBestPattern(const UnicodeString& skeleton, UErrorCode& status);
    00254
    00255
    00275      UnicodeString getBestPattern(const UnicodeString& skeleton,
    00276                                   UDateTimePatternMatchOptions options,
    00277                                   UErrorCode& status);
    00278
    00279
    00296      UnicodeString replaceFieldTypes(const UnicodeString& pattern,
    00297                                      const UnicodeString& skeleton,
    00298                                      UErrorCode& status);
    00299
    00322      UnicodeString replaceFieldTypes(const UnicodeString& pattern,
    00323                                      const UnicodeString& skeleton,
    00324                                      UDateTimePatternMatchOptions options,
    00325                                      UErrorCode& status);
    00326
    00338      StringEnumeration* getSkeletons(UErrorCode& status) const;
    00339
    00346      const UnicodeString& getPatternForSkeleton(const UnicodeString& skeleton) const;
    00347
    00357      StringEnumeration* getBaseSkeletons(UErrorCode& status) const;
    00358
    00371      StringEnumeration* getRedundants(UErrorCode& status);
    00372
    00384     void setDecimal(const UnicodeString& decimal);
    00385
    00391     const UnicodeString& getDecimal() const;
    00392
    00398     virtual UClassID getDynamicClassID() const;
    00399
    00405     static UClassID U_EXPORT2 getStaticClassID(void);
    00406
    00407 private:
    00412     DateTimePatternGenerator(UErrorCode & status);
    00413
    00418     DateTimePatternGenerator(const Locale& locale, UErrorCode & status);
    00419
    00425     DateTimePatternGenerator(const DateTimePatternGenerator& other);
    00426
    00432     DateTimePatternGenerator& operator=(const DateTimePatternGenerator& other);
    00433
    00434     Locale pLocale;  // pattern locale
    00435     FormatParser *fp;
    00436     DateTimeMatcher* dtMatcher;
    00437     DistanceInfo *distanceInfo;
    00438     PatternMap *patternMap;
    00439     UnicodeString appendItemFormats[UDATPG_FIELD_COUNT];
    00440     UnicodeString appendItemNames[UDATPG_FIELD_COUNT];
    00441     UnicodeString dateTimeFormat;
    00442     UnicodeString decimal;
    00443     DateTimeMatcher *skipMatcher;
    00444     Hashtable *fAvailableFormatKeyHash;
    00445     UnicodeString hackPattern;
    00446     UnicodeString emptyString;
    00447     UChar fDefaultHourFormatChar;
    00448
    00449     void initData(const Locale &locale, UErrorCode &status);
    00450     void addCanonicalItems();
    00451     void addICUPatterns(const Locale& locale, UErrorCode& status);
    00452     void hackTimes(const UnicodeString& hackPattern, UErrorCode& status);
    00453     void addCLDRData(const Locale& locale, UErrorCode& status);
    00454     UDateTimePatternConflict addPatternWithSkeleton(const UnicodeString& pattern, const UnicodeString * skeletonToUse, UBool override, UnicodeString& conflictingPattern, UErrorCode& status);
    00455     void initHashtable(UErrorCode& status);
    00456     void setDateTimeFromCalendar(const Locale& locale, UErrorCode& status);
    00457     void setDecimalSymbols(const Locale& locale, UErrorCode& status);
    00458     UDateTimePatternField getAppendFormatNumber(const char* field) const;
    00459     UDateTimePatternField getAppendNameNumber(const char* field) const;
    00460     void getAppendName(UDateTimePatternField field, UnicodeString& value);
    00461     int32_t getCanonicalIndex(const UnicodeString& field);
    00462     const UnicodeString* getBestRaw(DateTimeMatcher& source, int32_t includeMask, DistanceInfo* missingFields, const PtnSkeleton** specifiedSkeletonPtr = 0);
    00463     UnicodeString adjustFieldTypes(const UnicodeString& pattern, const PtnSkeleton* specifiedSkeleton, UBool fixFractionalSeconds, UDateTimePatternMatchOptions options = UDATPG_MATCH_NO_OPTIONS);
    00464     UnicodeString getBestAppending(int32_t missingFields, UDateTimePatternMatchOptions options = UDATPG_MATCH_NO_OPTIONS);
    00465     int32_t getTopBitNumber(int32_t foundMask);
    00466     void setAvailableFormat(const UnicodeString &key, UErrorCode& status);
    00467     UBool isAvailableFormatSet(const UnicodeString &key) const;
    00468     void copyHashtable(Hashtable *other, UErrorCode &status);
    00469     UBool isCanonicalItem(const UnicodeString& item) const;
    00470 } ;// end class DateTimePatternGenerator
    00471
    00472 U_NAMESPACE_END
    00473
    00474 #endif

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines