dtfmtsym.h

Go to the documentation of this file.
00001 /*  
00002 ********************************************************************************
00003 *   Copyright (C) 1997-2006, 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/uobject.h"
00026 #include "unicode/locid.h"
00027 #include "unicode/ures.h"
00028 
00034 U_NAMESPACE_BEGIN
00035 
00036 /* forward declaration */
00037 class SimpleDateFormat;
00038 class Hashtable;
00039 
00077 class U_I18N_API DateFormatSymbols : public UObject {
00078 public:
00092     DateFormatSymbols(UErrorCode& status);
00093 
00104     DateFormatSymbols(const Locale& locale,
00105                       UErrorCode& status);
00106 
00123     DateFormatSymbols(const char *type, UErrorCode& status);
00124 
00138     DateFormatSymbols(const Locale& locale,
00139                       const char *type,
00140                       UErrorCode& status);
00141 
00146     DateFormatSymbols(const DateFormatSymbols&);
00147 
00152     DateFormatSymbols& operator=(const DateFormatSymbols&);
00153 
00159     virtual ~DateFormatSymbols();
00160 
00168     UBool operator==(const DateFormatSymbols& other) const;
00169 
00177     UBool operator!=(const DateFormatSymbols& other) const { return !operator==(other); }
00178 
00186     const UnicodeString* getEras(int32_t& count) const;
00187 
00194     void setEras(const UnicodeString* eras, int32_t count);
00195 
00203     const UnicodeString* getEraNames(int32_t& count) const;
00204 
00211     void setEraNames(const UnicodeString* eraNames, int32_t count);
00212 
00219     const UnicodeString* getMonths(int32_t& count) const;
00220 
00228     void setMonths(const UnicodeString* months, int32_t count);
00229 
00237     const UnicodeString* getShortMonths(int32_t& count) const;
00238 
00245     void setShortMonths(const UnicodeString* shortMonths, int32_t count);
00246 
00251     enum DtContextType {
00252          FORMAT,
00253          STANDALONE,
00254          DT_CONTEXT_COUNT
00255     };
00256 
00261     enum DtWidthType {
00262          ABBREVIATED,
00263          WIDE,
00264          NARROW,
00265          DT_WIDTH_COUNT
00266     };
00267 
00276     const UnicodeString* getMonths(int32_t& count, DtContextType context, DtWidthType width) const;
00277 
00287     void setMonths(const UnicodeString* months, int32_t count, DtContextType context, DtWidthType width);
00288 
00295     const UnicodeString* getWeekdays(int32_t& count) const;
00296 
00297 
00304     void setWeekdays(const UnicodeString* weekdays, int32_t count);
00305 
00312     const UnicodeString* getShortWeekdays(int32_t& count) const;
00313 
00320     void setShortWeekdays(const UnicodeString* shortWeekdays, int32_t count);
00321 
00330     const UnicodeString* getWeekdays(int32_t& count, DtContextType context, DtWidthType width) const;
00331 
00340     void setWeekdays(const UnicodeString* weekdays, int32_t count, DtContextType context, DtWidthType width);
00341 
00351     const UnicodeString* getQuarters(int32_t& count, DtContextType context, DtWidthType width) const;
00352 
00363     void setQuarters(const UnicodeString* quarters, int32_t count, DtContextType context, DtWidthType width);
00364 
00371     const UnicodeString* getAmPmStrings(int32_t& count) const;
00372 
00379     void setAmPmStrings(const UnicodeString* ampms, int32_t count);
00380 
00388     const UnicodeString** getZoneStrings(int32_t& rowCount, int32_t& columnCount) const;
00389 
00397     void setZoneStrings(const UnicodeString* const* strings, int32_t rowCount, int32_t columnCount);
00398 
00404     static const UChar * U_EXPORT2 getPatternUChars(void);
00405 
00412     UnicodeString& getLocalPatternChars(UnicodeString& result) const;
00413 
00420     void setLocalPatternChars(const UnicodeString& newLocalPatternChars);
00421 
00427     Locale getLocale(ULocDataLocaleType type, UErrorCode& status) const;
00428 
00434     virtual UClassID getDynamicClassID() const;
00435 
00441     static UClassID U_EXPORT2 getStaticClassID();
00442 
00447     enum TimeZoneTranslationType {
00448         TIMEZONE_SHORT_GENERIC,
00449         TIMEZONE_SHORT_STANDARD,
00450         TIMEZONE_SHORT_DAYLIGHT,
00451         TIMEZONE_LONG_GENERIC,
00452         TIMEZONE_LONG_STANDARD,
00453         TIMEZONE_LONG_DAYLIGHT,
00454         TIMEZONE_EXEMPLAR_CITY,
00455         TIMEZONE_COUNT
00456     };
00457     
00466     virtual StringEnumeration* createZoneStringIDs(UErrorCode &status);
00467 
00479     UnicodeString& getZoneString(const UnicodeString &ID, const TimeZoneTranslationType type, UnicodeString &result, UErrorCode &status);
00480 
00490     void setZoneString(const UnicodeString &ID, const TimeZoneTranslationType type, const UnicodeString &value, UErrorCode &status);
00491 
00492 private:
00493 
00494     friend class SimpleDateFormat;
00495     friend class DateFormatSymbolsSingleSetter; // see udat.cpp
00496 
00500     UnicodeString*  fEras;
00501     int32_t         fErasCount;
00502 
00506     UnicodeString*  fEraNames;
00507     int32_t         fEraNamesCount;
00508 
00512     UnicodeString*  fMonths;
00513     int32_t         fMonthsCount;
00514 
00518     UnicodeString*  fShortMonths;
00519     int32_t         fShortMonthsCount;
00520 
00524     UnicodeString*  fNarrowMonths;
00525     int32_t         fNarrowMonthsCount;
00526 
00530     UnicodeString*  fStandaloneMonths;
00531     int32_t         fStandaloneMonthsCount;
00532 
00536     UnicodeString*  fStandaloneShortMonths;
00537     int32_t         fStandaloneShortMonthsCount;
00538 
00542     UnicodeString*  fStandaloneNarrowMonths;
00543     int32_t         fStandaloneNarrowMonthsCount;
00544 
00548     UnicodeString*  fWeekdays;
00549     int32_t         fWeekdaysCount;
00550 
00554     UnicodeString*  fShortWeekdays;
00555     int32_t         fShortWeekdaysCount;
00556 
00560     UnicodeString*  fNarrowWeekdays;
00561     int32_t         fNarrowWeekdaysCount;
00562 
00566     UnicodeString*  fStandaloneWeekdays;
00567     int32_t         fStandaloneWeekdaysCount;
00568 
00572     UnicodeString*  fStandaloneShortWeekdays;
00573     int32_t         fStandaloneShortWeekdaysCount;
00574 
00578     UnicodeString*  fStandaloneNarrowWeekdays;
00579     int32_t         fStandaloneNarrowWeekdaysCount;
00580 
00584     UnicodeString*  fAmPms;
00585     int32_t         fAmPmsCount;
00586 
00590     UnicodeString  *fQuarters;
00591     int32_t         fQuartersCount;
00592 
00596     UnicodeString  *fShortQuarters;
00597     int32_t         fShortQuartersCount;
00598 
00602     UnicodeString  *fStandaloneQuarters;
00603     int32_t         fStandaloneQuartersCount;
00604 
00608     UnicodeString  *fStandaloneShortQuarters;
00609     int32_t         fStandaloneShortQuartersCount;
00610 
00614     UnicodeString** fZoneStrings;
00615     int32_t         fZoneStringsRowCount;
00616     int32_t         fZoneStringsColCount;
00617     StringEnumeration* fZoneIDEnumeration;
00618     Hashtable*         fZoneStringsHash;
00619     UResourceBundle* fResourceBundle;
00620 
00624     UnicodeString   fLocalPatternChars;
00625 
00626 private:
00630     char validLocale[ULOC_FULLNAME_CAPACITY];
00631     char actualLocale[ULOC_FULLNAME_CAPACITY];
00632 
00633     DateFormatSymbols(); // default constructor not implemented
00634 
00644     void initializeData(const Locale&, const char *type, UErrorCode& status, UBool useLastResortData = FALSE);
00645 
00654     static void assignArray(UnicodeString*& dstArray,
00655                             int32_t& dstCount,
00656                             const UnicodeString* srcArray,
00657                             int32_t srcCount);
00658 
00669     static UBool arrayCompare(const UnicodeString* array1,
00670                              const UnicodeString* array2,
00671                              int32_t count);
00672 
00678     void createZoneStrings(const UnicodeString *const * otherStrings);
00679 
00690     int32_t getZoneIndex(const UnicodeString& ID) const;
00691 
00692     // Internal method; see source for documentation
00693     int32_t _getZoneIndex(const UnicodeString& id) const;
00694 
00698     void dispose(void);
00699 
00704     void copyData(const DateFormatSymbols& other);
00705 
00709     void disposeZoneStrings(void);
00713     void initZoneStrings(UErrorCode &status);
00718     void initZoneStrings(const UnicodeString** strings, int32_t rowCount, int32_t collumnCount, UErrorCode& status);
00722     void initZoneStringsArray(UErrorCode& status);
00726     Hashtable* createZoneStringsHash(const Hashtable* otherHash);
00727     
00736     UnicodeString& getZoneID(const UnicodeString& zid, UnicodeString& result, UErrorCode& status);
00737     
00749     void getZoneType(const UnicodeString& zid, const UnicodeString& text, int32_t start, TimeZoneTranslationType& type, UnicodeString& value, UErrorCode& status);
00750     
00763     void findZoneIDTypeValue(UnicodeString& zid, const UnicodeString& text, int32_t start, TimeZoneTranslationType& type, UnicodeString& value, UErrorCode& status);
00764 
00765 };
00766 
00767 U_NAMESPACE_END
00768 
00769 #endif /* #if !UCONFIG_NO_FORMATTING */
00770 
00771 #endif // _DTFMTSYM
00772 //eof

Generated on Mon Aug 13 07:17:24 2007 for ICU 3.6 by  doxygen 1.5.2