Main Page   Class Hierarchy   Compound List   File List   Header Files   Sources   Compound Members   File Members  

dtfmtsym.h

00001 /*  
00002 ********************************************************************************
00003 *   Copyright (C) 1997-1999, 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 /* forward declaration */
00026 class SimpleDateFormat;
00027 
00058 class U_I18N_API DateFormatSymbols {
00059 public:
00073     DateFormatSymbols(UErrorCode& status);
00074 
00085     DateFormatSymbols(const Locale& locale,
00086                       UErrorCode& status);
00087 
00092     DateFormatSymbols(const DateFormatSymbols&);
00093 
00098     DateFormatSymbols& operator=(const DateFormatSymbols&);
00099 
00105     ~DateFormatSymbols();
00106 
00111     UBool operator==(const DateFormatSymbols& other) const;
00112 
00117     UBool operator!=(const DateFormatSymbols& other) const { return !operator==(other); }
00118 
00124     const UnicodeString* getEras(int32_t& count) const;
00125 
00132     void setEras(const UnicodeString* eras, int32_t count);
00133 
00140     const UnicodeString* getMonths(int32_t& count) const;
00141 
00147     void setMonths(const UnicodeString* months, int32_t count);
00148 
00154     const UnicodeString* getShortMonths(int32_t& count) const;
00155 
00161     void setShortMonths(const UnicodeString* shortMonths, int32_t count);
00162 
00168     const UnicodeString* getWeekdays(int32_t& count) const;
00169 
00175     void setWeekdays(const UnicodeString* weekdays, int32_t count);
00176 
00182     const UnicodeString* getShortWeekdays(int32_t& count) const;
00183 
00189     void setShortWeekdays(const UnicodeString* shortWeekdays, int32_t count);
00190 
00196     const UnicodeString* getAmPmStrings(int32_t& count) const;
00197 
00203     void setAmPmStrings(const UnicodeString* ampms, int32_t count);
00204 
00212     const UnicodeString** getZoneStrings(int32_t& rowCount, int32_t& columnCount) const;
00213 
00221     void setZoneStrings(const UnicodeString* const* strings, int32_t rowCount, int32_t columnCount);
00222 
00227     static const UnicodeString& getPatternChars(void) { return fgPatternChars; }
00228 
00234     UnicodeString& getLocalPatternChars(UnicodeString& result) const;
00235 
00242     void setLocalPatternChars(const UnicodeString& newLocalPatternChars);
00243 
00244 private:
00245     friend class SimpleDateFormat;
00246 
00250     UnicodeString*  fEras;
00251     int32_t         fErasCount;
00252 
00256     UnicodeString*  fMonths;
00257     int32_t         fMonthsCount;
00258 
00262     UnicodeString*  fShortMonths;
00263     int32_t         fShortMonthsCount;
00264 
00268     UnicodeString*  fWeekdays;
00269     int32_t         fWeekdaysCount;
00270 
00274     UnicodeString*  fShortWeekdays;
00275     int32_t         fShortWeekdaysCount;
00276 
00280     UnicodeString*  fAmPms;
00281     int32_t         fAmPmsCount;
00282 
00286     UnicodeString** fZoneStrings;
00287     int32_t         fZoneStringsRowCount;
00288     int32_t         fZoneStringsColCount;
00289 
00293     UnicodeString   fLocalPatternChars;
00294 
00299     static UnicodeString fgPatternChars;
00300 
00301 private:
00302 
00303     void initField(UnicodeString **field, int32_t& length, const ResourceBundle data, uint8_t ownfield, UErrorCode &status);
00307     void initializeData(const Locale&, UErrorCode& status, UBool useLastResortData = FALSE);
00308 
00312     void assignArray(UnicodeString*& dstArray,
00313                      int32_t& dstCount,
00314                      const UnicodeString* srcArray,
00315                      int32_t srcCount,
00316                      const DateFormatSymbols& other,
00317                      int32_t which);
00318 
00323     static UBool arrayCompare(const UnicodeString* array1,
00324                              const UnicodeString* array2,
00325                              int32_t count);
00326 
00333     void createZoneStrings(const UnicodeString *const * otherStrings);
00334 
00345     int32_t getZoneIndex(const UnicodeString& ID) const;
00346 
00351     void dispose(void);
00352 
00357     void disposeZoneStrings(void);
00358 
00363     static const UnicodeString     fgLastResortMonthNames[];
00364     static const UnicodeString     fgLastResortDayNames[];
00365     static const UnicodeString     fgLastResortAmPmMarkers[];
00366     static const UnicodeString     fgLastResortEras[];
00367     static const UnicodeString     fgLastResortZoneStrings[];
00368     static UnicodeString**         fgLastResortZoneStringsH;
00369 
00376     enum
00377     {
00378         kEras,
00379         kMonths,
00380         kShortMonths,
00381         kWeekdays,
00382         kShortWeekdays,
00383         kAmPms,
00384         kZoneStrings
00385     };
00386     uint8_t                 fIsOwned;
00387 
00391     void                    setIsOwned(int32_t which, UBool isOwned);
00392 
00396     UBool                  isOwned(int32_t which) const;
00397 };
00398 
00399 inline void
00400 DateFormatSymbols::setIsOwned(int32_t which, UBool isOwned)
00401 {
00402     fIsOwned = (uint8_t)(( fIsOwned & ~(1 << which) ) | ( (isOwned ? 1 : 0) << which ));
00403 }
00404 
00405 inline UBool
00406 DateFormatSymbols::isOwned(int32_t which) const
00407 {
00408     return ( (fIsOwned >> which) & 1 ) != 0;
00409 }
00410 
00411 #endif // _DTFMTSYM
00412 //eof

Generated at Wed Aug 16 16:05:33 2000 for ICU1.6 by doxygen 1.0.0 written by Dimitri van Heesch, © 1997-1999