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

- Search for |

- File List
- Globals

# dtptngen.h

    00001 /*
    00002 *******************************************************************************
    00003 * Copyright (C) 2007, 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
    00022 class Hashtable;
    00023 class FormatParser;
    00024 class DateTimeMatcher;
    00025 class DistanceInfo;
    00026 class PatternMap;
    00027
    00042 class U_I18N_API DateTimePatternGenerator : public UObject {
    00043 public:
    00050     static DateTimePatternGenerator* U_EXPORT2 createInstance(UErrorCode& status);
    00051
    00059     static DateTimePatternGenerator* U_EXPORT2 createInstance(const Locale& uLocale, UErrorCode& status);
    00060
    00067      static DateTimePatternGenerator* U_EXPORT2 createEmptyInstance(UErrorCode& status);
    00068
    00073     virtual ~DateTimePatternGenerator();
    00074
    00080     DateTimePatternGenerator* clone() const;
    00081
    00089     UBool operator==(const DateTimePatternGenerator& other) const;
    00090
    00098     UBool operator!=(const DateTimePatternGenerator& other) const;
    00099
    00110     UnicodeString getSkeleton(const UnicodeString& pattern, UErrorCode& status);
    00111
    00125     UnicodeString getBaseSkeleton(const UnicodeString& pattern, UErrorCode& status);
    00126
    00147     UDateTimePatternConflict addPattern(const UnicodeString& pattern,
    00148                                         UBool override,
    00149                                         UnicodeString& conflictingPattern,
    00150                                         UErrorCode& status);
    00151
    00170     void setAppendItemFormat(UDateTimePatternField field, const UnicodeString& value);
    00171
    00180     const UnicodeString& getAppendItemFormat(UDateTimePatternField field) const;
    00181
    00193     void setAppendItemName(UDateTimePatternField field, const UnicodeString& value);
    00194
    00203     const UnicodeString& getAppendItemName(UDateTimePatternField field) const;
    00204
    00224     void setDateTimeFormat(const UnicodeString& dateTimeFormat);
    00225
    00231     const UnicodeString& getDateTimeFormat() const;
    00232
    00246      UnicodeString getBestPattern(const UnicodeString& skeleton, UErrorCode& status);
    00247
    00248
    00265      UnicodeString replaceFieldTypes(const UnicodeString& pattern,
    00266                                      const UnicodeString& skeleton,
    00267                                      UErrorCode& status);
    00268
    00280      StringEnumeration* getSkeletons(UErrorCode& status) const;
    00281
    00288      const UnicodeString& getPatternForSkeleton(const UnicodeString& skeleton) const;
    00289
    00299      StringEnumeration* getBaseSkeletons(UErrorCode& status) const;
    00300
    00313      StringEnumeration* getRedundants(UErrorCode& status);
    00314
    00326     void setDecimal(const UnicodeString& decimal);
    00327
    00333     const UnicodeString& getDecimal() const;
    00334
    00340     virtual UClassID getDynamicClassID() const;
    00341
    00347     static UClassID U_EXPORT2 getStaticClassID(void);
    00348
    00349 private:
    00354     DateTimePatternGenerator(UErrorCode & status);
    00355
    00360     DateTimePatternGenerator(const Locale& locale, UErrorCode & status);
    00361
    00367     DateTimePatternGenerator(const DateTimePatternGenerator& other);
    00368
    00374     DateTimePatternGenerator& operator=(const DateTimePatternGenerator& other);
    00375
    00376     Locale pLocale;  // pattern locale
    00377     FormatParser *fp;
    00378     DateTimeMatcher* dtMatcher;
    00379     DistanceInfo *distanceInfo;
    00380     PatternMap *patternMap;
    00381     UnicodeString appendItemFormats[UDATPG_FIELD_COUNT];
    00382     UnicodeString appendItemNames[UDATPG_FIELD_COUNT];
    00383     UnicodeString dateTimeFormat;
    00384     UnicodeString decimal;
    00385     DateTimeMatcher *skipMatcher;
    00386     Hashtable *fAvailableFormatKeyHash;
    00387     UnicodeString hackPattern;
    00388     UErrorCode fStatus;
    00389     UnicodeString emptyString;
    00390
    00391     void initData(const Locale &locale);
    00392     void addCanonicalItems();
    00393     void addICUPatterns(const Locale& locale, UErrorCode& status);
    00394     void hackTimes(const UnicodeString& hackPattern, UErrorCode& status);
    00395     void addCLDRData(const Locale& locale);
    00396     void initHashtable(UErrorCode& status);
    00397     void setDateTimeFromCalendar(const Locale& locale, UErrorCode& status);
    00398     void setDecimalSymbols(const Locale& locale, UErrorCode& status);
    00399     UDateTimePatternField getAppendFormatNumber(const char* field) const;
    00400     UDateTimePatternField getAppendNameNumber(const char* field) const;
    00401     void getAppendName(UDateTimePatternField field, UnicodeString& value);
    00402     int32_t getCanonicalIndex(const UnicodeString& field);
    00403     const UnicodeString* getBestRaw(DateTimeMatcher& source, int32_t includeMask, DistanceInfo* missingFields);
    00404     UnicodeString adjustFieldTypes(const UnicodeString& pattern, UBool fixFractionalSeconds);
    00405     UnicodeString getBestAppending(int32_t missingFields);
    00406     int32_t getTopBitNumber(int32_t foundMask);
    00407     void setAvailableFormat(const UnicodeString &key, UErrorCode& status);
    00408     UBool isAvailableFormatSet(const UnicodeString &key) const;
    00409     void copyHashtable(Hashtable *other);
    00410     UBool isCanonicalItem(const UnicodeString& item) const;
    00411     UErrorCode getStatus() const {  return fStatus; } ;
    00412 } ;// end class DateTimePatternGenerator
    00413
    00414 U_NAMESPACE_END
    00415
    00416 #endif