Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

dtfmtsym.h

Go to the documentation of this file.
00001 /*  
00002 ********************************************************************************
00003 *   Copyright (C) 1997-2001, 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 #include "unicode/uobject.h"
00023 #include "unicode/locid.h"
00024 #include "unicode/resbund.h"
00025 
00026 U_NAMESPACE_BEGIN
00027 
00028 /* forward declaration */
00029 class SimpleDateFormat;
00030 
00061 class U_I18N_API DateFormatSymbols : public UObject {
00062 public:
00076     DateFormatSymbols(UErrorCode& status);
00077 
00088     DateFormatSymbols(const Locale& locale,
00089                       UErrorCode& status);
00090 
00095     DateFormatSymbols(const DateFormatSymbols&);
00096 
00101     DateFormatSymbols& operator=(const DateFormatSymbols&);
00102 
00108     ~DateFormatSymbols();
00109 
00117     UBool operator==(const DateFormatSymbols& other) const;
00118 
00126     UBool operator!=(const DateFormatSymbols& other) const { return !operator==(other); }
00127 
00135     const UnicodeString* getEras(int32_t& count) const;
00136 
00143     void setEras(const UnicodeString* eras, int32_t count);
00144 
00151     const UnicodeString* getMonths(int32_t& count) const;
00152 
00160     void setMonths(const UnicodeString* months, int32_t count);
00161 
00169     const UnicodeString* getShortMonths(int32_t& count) const;
00170 
00177     void setShortMonths(const UnicodeString* shortMonths, int32_t count);
00178 
00185     const UnicodeString* getWeekdays(int32_t& count) const;
00186 
00193     void setWeekdays(const UnicodeString* weekdays, int32_t count);
00194 
00201     const UnicodeString* getShortWeekdays(int32_t& count) const;
00202 
00209     void setShortWeekdays(const UnicodeString* shortWeekdays, int32_t count);
00210 
00217     const UnicodeString* getAmPmStrings(int32_t& count) const;
00218 
00225     void setAmPmStrings(const UnicodeString* ampms, int32_t count);
00226 
00234     const UnicodeString** getZoneStrings(int32_t& rowCount, int32_t& columnCount) const;
00235 
00243     void setZoneStrings(const UnicodeString* const* strings, int32_t rowCount, int32_t columnCount);
00244 
00249     static const UnicodeString& getPatternChars(void);
00250 
00256     static const UChar *getPatternUChars(void);
00257 
00264     UnicodeString& getLocalPatternChars(UnicodeString& result) const;
00265 
00272     void setLocalPatternChars(const UnicodeString& newLocalPatternChars);
00273 
00279     virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); }
00280 
00286     static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; }
00287 
00288 private:
00292     static const char fgErasTag[];   // resource bundle tag for era names
00293     static const char fgMonthNamesTag[]; // resource bundle tag for month names
00294     static const char fgMonthAbbreviationsTag[]; // resource bundle tag for month abbreviations
00295     static const char fgDayNamesTag[];   // resource bundle tag for day names
00296     static const char fgDayAbbreviationsTag[];   // resource bundle tag for day abbreviations
00297     static const char fgAmPmMarkersTag[];    // resource bundle tag for AM/PM strings
00298 
00299     static const char fgZoneStringsTag[];    // resource bundle tag for time zone names
00300     static const char fgLocalPatternCharsTag[];  // resource bundle tag for localized pattern characters
00301 
00302     friend class SimpleDateFormat;
00303 
00307     UnicodeString*  fEras;
00308     int32_t         fErasCount;
00309 
00313     UnicodeString*  fMonths;
00314     int32_t         fMonthsCount;
00315 
00319     UnicodeString*  fShortMonths;
00320     int32_t         fShortMonthsCount;
00321 
00325     UnicodeString*  fWeekdays;
00326     int32_t         fWeekdaysCount;
00327 
00331     UnicodeString*  fShortWeekdays;
00332     int32_t         fShortWeekdaysCount;
00333 
00337     UnicodeString*  fAmPms;
00338     int32_t         fAmPmsCount;
00339 
00343     UnicodeString** fZoneStrings;
00344     int32_t         fZoneStringsRowCount;
00345     int32_t         fZoneStringsColCount;
00346 
00350     UnicodeString   fLocalPatternChars;
00351 
00356     static const char fgClassID;
00357 
00358 private:
00359 
00360     /* Sizes for the last resort string arrays */
00361     typedef enum LastResortSize {
00362         kMonthNum = 13,
00363         kMonthLen = 3,
00364 
00365         kDayNum = 8,
00366         kDayLen = 2,
00367 
00368         kAmPmNum = 2,
00369         kAmPmLen = 3,
00370 
00371         kEraNum = 2,
00372         kEraLen = 3,
00373 
00374         kZoneNum = 5,
00375         kZoneLen = 4
00376     } LastResortSize;
00377 
00378     void initField(UnicodeString **field, int32_t& length, const ResourceBundle data, UErrorCode &status);
00379     void initField(UnicodeString **field, int32_t& length, const UChar *data, LastResortSize numStr, LastResortSize strLen, UErrorCode &status);
00380 
00389     void initializeData(const Locale&, UErrorCode& status, UBool useLastResortData = FALSE);
00390 
00399     static void assignArray(UnicodeString*& dstArray,
00400                             int32_t& dstCount,
00401                             const UnicodeString* srcArray,
00402                             int32_t srcCount);
00403 
00414     static UBool arrayCompare(const UnicodeString* array1,
00415                              const UnicodeString* array2,
00416                              int32_t count);
00417 
00424     void createZoneStrings(const UnicodeString *const * otherStrings);
00425 
00436     int32_t getZoneIndex(const UnicodeString& ID) const;
00437 
00438     // Internal method; see source for documentation
00439     int32_t _getZoneIndex(const UnicodeString& id) const;
00440 
00445     void dispose(void);
00446 
00451     void copyData(const DateFormatSymbols& other);
00452 
00457     void disposeZoneStrings(void);
00458 };
00459 
00460 U_NAMESPACE_END
00461 
00462 #endif // _DTFMTSYM
00463 //eof

Generated on Thu Aug 15 14:13:25 2002 for ICU 2.2 by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001