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

- Search for |

- File List
- Globals

# dtfmtsym.h

Go to the documentation of this file.

    00001 /*
    00002 ********************************************************************************
    00003 *   Copyright (C) 1997-2007, International Business Machines
    00004 *   Corporation and others.  All Rights Reserved.
    00005 ********************************************************************************
    00006 *
    00007 * File DTFMTSYM.H
    00008 *
    00009 * Modification History:
    00010 *
    00011 *   Date        Name        Description
    00012 *   02/19/97    aliu        Converted from java.
    00013 *    07/21/98    stephen        Added getZoneIndex()
    00014 *                            Changed to match C++ conventions
    00015 ********************************************************************************
    00016 */
    00017
    00018 #ifndef DTFMTSYM_H
    00019 #define DTFMTSYM_H
    00020
    00021 #include "unicode/utypes.h"
    00022
    00023 #if !UCONFIG_NO_FORMATTING
    00024
    00025 #include "unicode/calendar.h"
    00026 #include "unicode/uobject.h"
    00027 #include "unicode/locid.h"
    00028 #include "unicode/ures.h"
    00029
    00035 U_NAMESPACE_BEGIN
    00036
    00037 /* forward declaration */
    00038 class SimpleDateFormat;
    00039 class Hashtable;
    00040
    00078 class U_I18N_API DateFormatSymbols : public UObject {
    00079 public:
    00093     DateFormatSymbols(UErrorCode& status);
    00094
    00105     DateFormatSymbols(const Locale& locale,
    00106                       UErrorCode& status);
    00107
    00124     DateFormatSymbols(const char *type, UErrorCode& status);
    00125
    00139     DateFormatSymbols(const Locale& locale,
    00140                       const char *type,
    00141                       UErrorCode& status);
    00142
    00147     DateFormatSymbols(const DateFormatSymbols&);
    00148
    00153     DateFormatSymbols& operator=(const DateFormatSymbols&);
    00154
    00160     virtual ~DateFormatSymbols();
    00161
    00169     UBool operator==(const DateFormatSymbols& other) const;
    00170
    00178     UBool operator!=(const DateFormatSymbols& other) const { return !operator==(other); }
    00179
    00187     const UnicodeString* getEras(int32_t& count) const;
    00188
    00195     void setEras(const UnicodeString* eras, int32_t count);
    00196
    00204     const UnicodeString* getEraNames(int32_t& count) const;
    00205
    00212     void setEraNames(const UnicodeString* eraNames, int32_t count);
    00213
    00220     const UnicodeString* getMonths(int32_t& count) const;
    00221
    00229     void setMonths(const UnicodeString* months, int32_t count);
    00230
    00238     const UnicodeString* getShortMonths(int32_t& count) const;
    00239
    00246     void setShortMonths(const UnicodeString* shortMonths, int32_t count);
    00247
    00252     enum DtContextType {
    00253          FORMAT,
    00254          STANDALONE,
    00255          DT_CONTEXT_COUNT
    00256     };
    00257
    00262     enum DtWidthType {
    00263          ABBREVIATED,
    00264          WIDE,
    00265          NARROW,
    00266          DT_WIDTH_COUNT
    00267     };
    00268
    00277     const UnicodeString* getMonths(int32_t& count, DtContextType context, DtWidthType width) const;
    00278
    00288     void setMonths(const UnicodeString* months, int32_t count, DtContextType context, DtWidthType width);
    00289
    00296     const UnicodeString* getWeekdays(int32_t& count) const;
    00297
    00298
    00305     void setWeekdays(const UnicodeString* weekdays, int32_t count);
    00306
    00313     const UnicodeString* getShortWeekdays(int32_t& count) const;
    00314
    00321     void setShortWeekdays(const UnicodeString* shortWeekdays, int32_t count);
    00322
    00331     const UnicodeString* getWeekdays(int32_t& count, DtContextType context, DtWidthType width) const;
    00332
    00341     void setWeekdays(const UnicodeString* weekdays, int32_t count, DtContextType context, DtWidthType width);
    00342
    00352     const UnicodeString* getQuarters(int32_t& count, DtContextType context, DtWidthType width) const;
    00353
    00364     void setQuarters(const UnicodeString* quarters, int32_t count, DtContextType context, DtWidthType width);
    00365
    00372     const UnicodeString* getAmPmStrings(int32_t& count) const;
    00373
    00380     void setAmPmStrings(const UnicodeString* ampms, int32_t count);
    00381
    00389     const UnicodeString** getZoneStrings(int32_t& rowCount, int32_t& columnCount) const;
    00390
    00398     void setZoneStrings(const UnicodeString* const* strings, int32_t rowCount, int32_t columnCount);
    00399
    00405     static const UChar * U_EXPORT2 getPatternUChars(void);
    00406
    00417     UnicodeString& getLocalPatternChars(UnicodeString& result) const;
    00418
    00425     void setLocalPatternChars(const UnicodeString& newLocalPatternChars);
    00426
    00432     Locale getLocale(ULocDataLocaleType type, UErrorCode& status) const;
    00433
    00439     virtual UClassID getDynamicClassID() const;
    00440
    00446     static UClassID U_EXPORT2 getStaticClassID();
    00447
    00452     enum TimeZoneTranslationType {
    00453         TIMEZONE_SHORT_GENERIC,
    00454         TIMEZONE_SHORT_STANDARD,
    00455         TIMEZONE_SHORT_DAYLIGHT,
    00456         TIMEZONE_LONG_GENERIC,
    00457         TIMEZONE_LONG_STANDARD,
    00458         TIMEZONE_LONG_DAYLIGHT,
    00459         TIMEZONE_EXEMPLAR_CITY,
    00460         TIMEZONE_COUNT
    00461     };
    00462
    00471     virtual StringEnumeration* createZoneStringIDs(UErrorCode &status);
    00472
    00484     UnicodeString& getZoneString(const UnicodeString &ID, const TimeZoneTranslationType type, UnicodeString &result, UErrorCode &status);
    00485
    00498     UnicodeString getMetazoneString(const UnicodeString &ID, const TimeZoneTranslationType type, Calendar &cal, UnicodeString &result, UErrorCode &status);
    00499
    00510     UnicodeString& getFallbackString(const UnicodeString &ID, UnicodeString &result, UErrorCode &status);
    00511
    00529     UBool isCommonlyUsed(const UnicodeString &zid);
    00530
    00540     void setZoneString(const UnicodeString &ID, const TimeZoneTranslationType type, const UnicodeString &value, UErrorCode &status);
    00541
    00542 private:
    00543
    00544     friend class SimpleDateFormat;
    00545     friend class DateFormatSymbolsSingleSetter; // see udat.cpp
    00546
    00550     UnicodeString*  fEras;
    00551     int32_t         fErasCount;
    00552
    00556     UnicodeString*  fEraNames;
    00557     int32_t         fEraNamesCount;
    00558
    00562     UnicodeString*  fMonths;
    00563     int32_t         fMonthsCount;
    00564
    00568     UnicodeString*  fShortMonths;
    00569     int32_t         fShortMonthsCount;
    00570
    00574     UnicodeString*  fNarrowMonths;
    00575     int32_t         fNarrowMonthsCount;
    00576
    00580     UnicodeString*  fStandaloneMonths;
    00581     int32_t         fStandaloneMonthsCount;
    00582
    00586     UnicodeString*  fStandaloneShortMonths;
    00587     int32_t         fStandaloneShortMonthsCount;
    00588
    00592     UnicodeString*  fStandaloneNarrowMonths;
    00593     int32_t         fStandaloneNarrowMonthsCount;
    00594
    00598     UnicodeString*  fWeekdays;
    00599     int32_t         fWeekdaysCount;
    00600
    00604     UnicodeString*  fShortWeekdays;
    00605     int32_t         fShortWeekdaysCount;
    00606
    00610     UnicodeString*  fNarrowWeekdays;
    00611     int32_t         fNarrowWeekdaysCount;
    00612
    00616     UnicodeString*  fStandaloneWeekdays;
    00617     int32_t         fStandaloneWeekdaysCount;
    00618
    00622     UnicodeString*  fStandaloneShortWeekdays;
    00623     int32_t         fStandaloneShortWeekdaysCount;
    00624
    00628     UnicodeString*  fStandaloneNarrowWeekdays;
    00629     int32_t         fStandaloneNarrowWeekdaysCount;
    00630
    00634     UnicodeString*  fAmPms;
    00635     int32_t         fAmPmsCount;
    00636
    00640     UnicodeString  *fQuarters;
    00641     int32_t         fQuartersCount;
    00642
    00646     UnicodeString  *fShortQuarters;
    00647     int32_t         fShortQuartersCount;
    00648
    00652     UnicodeString  *fStandaloneQuarters;
    00653     int32_t         fStandaloneQuartersCount;
    00654
    00658     UnicodeString  *fStandaloneShortQuarters;
    00659     int32_t         fStandaloneShortQuartersCount;
    00660
    00664     UnicodeString** fZoneStrings;
    00665     int32_t         fZoneStringsRowCount;
    00666     int32_t         fZoneStringsColCount;
    00667     StringEnumeration* fZoneIDEnumeration;
    00668     Hashtable*         fZoneStringsHash;
    00669     UResourceBundle* fResourceBundle;
    00670     const char*      fCountry;
    00671
    00675     UnicodeString   fLocalPatternChars;
    00676
    00677 private:
    00681     char validLocale[ULOC_FULLNAME_CAPACITY];
    00682     char actualLocale[ULOC_FULLNAME_CAPACITY];
    00683
    00684     DateFormatSymbols(); // default constructor not implemented
    00685
    00695     void initializeData(const Locale&, const char *type, UErrorCode& status, UBool useLastResortData = FALSE);
    00696
    00705     static void assignArray(UnicodeString*& dstArray,
    00706                             int32_t& dstCount,
    00707                             const UnicodeString* srcArray,
    00708                             int32_t srcCount);
    00709
    00720     static UBool arrayCompare(const UnicodeString* array1,
    00721                              const UnicodeString* array2,
    00722                              int32_t count);
    00723
    00729     void createZoneStrings(const UnicodeString *const * otherStrings);
    00730
    00741     int32_t getZoneIndex(const UnicodeString& ID) const;
    00742
    00743     // Internal method; see source for documentation
    00744     int32_t _getZoneIndex(const UnicodeString& id) const;
    00745
    00749     void dispose(void);
    00750
    00755     void copyData(const DateFormatSymbols& other);
    00756
    00760     void disposeZoneStrings(void);
    00761
    00765     void initZoneStrings(UErrorCode &status);
    00770     void initZoneStrings(const UnicodeString** strings, int32_t rowCount, int32_t collumnCount, UErrorCode& status);
    00774     void initZoneStringsArray(UErrorCode& status);
    00778     Hashtable* createZoneStringsHash(const Hashtable* otherHash);
    00779
    00788     UnicodeString& getZoneID(const UnicodeString& zid, UnicodeString& result, UErrorCode& status);
    00789
    00801     void getZoneType(const UnicodeString& zid, const UnicodeString& text, int32_t start, TimeZoneTranslationType& type, UnicodeString& value, UErrorCode& status);
    00802
    00815     void findZoneIDTypeValue(UnicodeString& zid, const UnicodeString& text, int32_t start, TimeZoneTranslationType& type, UnicodeString& value, UErrorCode& status);
    00816
    00817     UnicodeString resolveParsedMetazone(const UnicodeString& zid);
    00818 };
    00819
    00820 U_NAMESPACE_END
    00821
    00822 #endif /* #if !UCONFIG_NO_FORMATTING */
    00823
    00824 #endif // _DTFMTSYM
    00825 //eof