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

- Search for |

- 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
    00272      UnicodeString replaceFieldTypes(const UnicodeString& pattern,
    00273                                      const UnicodeString& skeleton,
    00274                                      UErrorCode& status);
    00275
    00287      StringEnumeration* getSkeletons(UErrorCode& status) const;
    00288
    00295      const UnicodeString& getPatternForSkeleton(const UnicodeString& skeleton) const;
    00296
    00306      StringEnumeration* getBaseSkeletons(UErrorCode& status) const;
    00307
    00320      StringEnumeration* getRedundants(UErrorCode& status);
    00321
    00333     void setDecimal(const UnicodeString& decimal);
    00334
    00340     const UnicodeString& getDecimal() const;
    00341
    00347     virtual UClassID getDynamicClassID() const;
    00348
    00354     static UClassID U_EXPORT2 getStaticClassID(void);
    00355
    00356 private:
    00361     DateTimePatternGenerator(UErrorCode & status);
    00362
    00367     DateTimePatternGenerator(const Locale& locale, UErrorCode & status);
    00368
    00374     DateTimePatternGenerator(const DateTimePatternGenerator& other);
    00375
    00381     DateTimePatternGenerator& operator=(const DateTimePatternGenerator& other);
    00382
    00383     Locale pLocale;  // pattern locale
    00384     FormatParser *fp;
    00385     DateTimeMatcher* dtMatcher;
    00386     DistanceInfo *distanceInfo;
    00387     PatternMap *patternMap;
    00388     UnicodeString appendItemFormats[UDATPG_FIELD_COUNT];
    00389     UnicodeString appendItemNames[UDATPG_FIELD_COUNT];
    00390     UnicodeString dateTimeFormat;
    00391     UnicodeString decimal;
    00392     DateTimeMatcher *skipMatcher;
    00393     Hashtable *fAvailableFormatKeyHash;
    00394     UnicodeString hackPattern;
    00395     UnicodeString emptyString;
    00396     UChar fDefaultHourFormatChar;
    00397
    00398     void initData(const Locale &locale, UErrorCode &status);
    00399     void addCanonicalItems();
    00400     void addICUPatterns(const Locale& locale, UErrorCode& status);
    00401     void hackTimes(const UnicodeString& hackPattern, UErrorCode& status);
    00402     void addCLDRData(const Locale& locale);
    00403     UDateTimePatternConflict addPatternWithSkeleton(const UnicodeString& pattern, const UnicodeString * skeletonToUse, UBool override, UnicodeString& conflictingPattern, UErrorCode& status);
    00404     void initHashtable(UErrorCode& status);
    00405     void setDateTimeFromCalendar(const Locale& locale, UErrorCode& status);
    00406     void setDecimalSymbols(const Locale& locale, UErrorCode& status);
    00407     UDateTimePatternField getAppendFormatNumber(const char* field) const;
    00408     UDateTimePatternField getAppendNameNumber(const char* field) const;
    00409     void getAppendName(UDateTimePatternField field, UnicodeString& value);
    00410     int32_t getCanonicalIndex(const UnicodeString& field);
    00411     const UnicodeString* getBestRaw(DateTimeMatcher& source, int32_t includeMask, DistanceInfo* missingFields, const PtnSkeleton** specifiedSkeletonPtr = 0);
    00412     UnicodeString adjustFieldTypes(const UnicodeString& pattern, const PtnSkeleton* specifiedSkeleton, UBool fixFractionalSeconds);
    00413     UnicodeString getBestAppending(int32_t missingFields);
    00414     int32_t getTopBitNumber(int32_t foundMask);
    00415     void setAvailableFormat(const UnicodeString &key, UErrorCode& status);
    00416     UBool isAvailableFormatSet(const UnicodeString &key) const;
    00417     void copyHashtable(Hashtable *other, UErrorCode &status);
    00418     UBool isCanonicalItem(const UnicodeString& item) const;
    00419 } ;// end class DateTimePatternGenerator
    00420
    00421 U_NAMESPACE_END
    00422
    00423 #endif