Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

dtfmtsym.h

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/locid.h"
00023 #include "unicode/resbund.h"
00024 
00025 U_NAMESPACE_BEGIN
00026 
00027 /* forward declaration */
00028 class SimpleDateFormat;
00029 
00060 class U_I18N_API DateFormatSymbols {
00061 public:
00075     DateFormatSymbols(UErrorCode& status);
00076 
00087     DateFormatSymbols(const Locale& locale,
00088                       UErrorCode& status);
00089 
00094     DateFormatSymbols(const DateFormatSymbols&);
00095 
00100     DateFormatSymbols& operator=(const DateFormatSymbols&);
00101 
00107     ~DateFormatSymbols();
00108 
00113     UBool operator==(const DateFormatSymbols& other) const;
00114 
00119     UBool operator!=(const DateFormatSymbols& other) const { return !operator==(other); }
00120 
00126     const UnicodeString* getEras(int32_t& count) const;
00127 
00134     void setEras(const UnicodeString* eras, int32_t count);
00135 
00142     const UnicodeString* getMonths(int32_t& count) const;
00143 
00149     void setMonths(const UnicodeString* months, int32_t count);
00150 
00156     const UnicodeString* getShortMonths(int32_t& count) const;
00157 
00163     void setShortMonths(const UnicodeString* shortMonths, int32_t count);
00164 
00170     const UnicodeString* getWeekdays(int32_t& count) const;
00171 
00177     void setWeekdays(const UnicodeString* weekdays, int32_t count);
00178 
00184     const UnicodeString* getShortWeekdays(int32_t& count) const;
00185 
00191     void setShortWeekdays(const UnicodeString* shortWeekdays, int32_t count);
00192 
00198     const UnicodeString* getAmPmStrings(int32_t& count) const;
00199 
00205     void setAmPmStrings(const UnicodeString* ampms, int32_t count);
00206 
00214     const UnicodeString** getZoneStrings(int32_t& rowCount, int32_t& columnCount) const;
00215 
00223     void setZoneStrings(const UnicodeString* const* strings, int32_t rowCount, int32_t columnCount);
00224 
00229     static const UnicodeString& getPatternChars(void);
00230 
00235     static const UChar *getPatternUChars(void);
00236 
00242     UnicodeString& getLocalPatternChars(UnicodeString& result) const;
00243 
00250     void setLocalPatternChars(const UnicodeString& newLocalPatternChars);
00251 
00252 private:
00256     static const char fgErasTag[];   // resource bundle tag for era names
00257     static const char fgMonthNamesTag[]; // resource bundle tag for month names
00258     static const char fgMonthAbbreviationsTag[]; // resource bundle tag for month abbreviations
00259     static const char fgDayNamesTag[];   // resource bundle tag for day names
00260     static const char fgDayAbbreviationsTag[];   // resource bundle tag for day abbreviations
00261     static const char fgAmPmMarkersTag[];    // resource bundle tag for AM/PM strings
00262 
00263     static const char fgZoneStringsTag[];    // resource bundle tag for time zone names
00264     static const char fgLocalPatternCharsTag[];  // resource bundle tag for localized pattern characters
00265 
00266     friend class SimpleDateFormat;
00267 
00271     UnicodeString*  fEras;
00272     int32_t         fErasCount;
00273 
00277     UnicodeString*  fMonths;
00278     int32_t         fMonthsCount;
00279 
00283     UnicodeString*  fShortMonths;
00284     int32_t         fShortMonthsCount;
00285 
00289     UnicodeString*  fWeekdays;
00290     int32_t         fWeekdaysCount;
00291 
00295     UnicodeString*  fShortWeekdays;
00296     int32_t         fShortWeekdaysCount;
00297 
00301     UnicodeString*  fAmPms;
00302     int32_t         fAmPmsCount;
00303 
00307     UnicodeString** fZoneStrings;
00308     int32_t         fZoneStringsRowCount;
00309     int32_t         fZoneStringsColCount;
00310 
00314     UnicodeString   fLocalPatternChars;
00315 
00316 private:
00317 
00318     /* Sizes for the last resort string arrays */
00319     typedef enum LastResortSize {
00320         kMonthNum = 13,
00321         kMonthLen = 3,
00322 
00323         kDayNum = 8,
00324         kDayLen = 2,
00325 
00326         kAmPmNum = 2,
00327         kAmPmLen = 3,
00328 
00329         kEraNum = 2,
00330         kEraLen = 3,
00331 
00332         kZoneNum = 5,
00333         kZoneLen = 4
00334     } LastResortSize;
00335 
00336     void initField(UnicodeString **field, int32_t& length, const ResourceBundle data, UErrorCode &status);
00337     void initField(UnicodeString **field, int32_t& length, const UChar *data, LastResortSize numStr, LastResortSize strLen, UErrorCode &status);
00338 
00342     void initializeData(const Locale&, UErrorCode& status, UBool useLastResortData = FALSE);
00343 
00347     static void assignArray(UnicodeString*& dstArray,
00348                             int32_t& dstCount,
00349                             const UnicodeString* srcArray,
00350                             int32_t srcCount);
00351 
00356     static UBool arrayCompare(const UnicodeString* array1,
00357                              const UnicodeString* array2,
00358                              int32_t count);
00359 
00366     void createZoneStrings(const UnicodeString *const * otherStrings);
00367 
00378     int32_t getZoneIndex(const UnicodeString& ID) const;
00379 
00380     // Internal method; see source for documentation
00381     int32_t _getZoneIndex(const UnicodeString& id) const;
00382 
00387     void dispose(void);
00388 
00392     void copyData(const DateFormatSymbols& other);
00393 
00398     void disposeZoneStrings(void);
00399 };
00400 
00401 U_NAMESPACE_END
00402 
00403 #endif // _DTFMTSYM
00404 //eof

Generated on Sun May 22 20:17:30 2005 for ICU 2.1 by  doxygen 1.4.2