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-2003, 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/resbund.h"
00028 
00029 U_NAMESPACE_BEGIN
00030 
00031 /* forward declaration */
00032 class SimpleDateFormat;
00033 
00071 class U_I18N_API DateFormatSymbols : public UObject {
00072 public:
00086     DateFormatSymbols(UErrorCode& status);
00087 
00098     DateFormatSymbols(const Locale& locale,
00099                       UErrorCode& status);
00100 
00117     DateFormatSymbols(const char *type, UErrorCode& status);
00118 
00132     DateFormatSymbols(const Locale& locale,
00133                       const char *type,
00134                       UErrorCode& status);
00135 
00140     DateFormatSymbols(const DateFormatSymbols&);
00141 
00146     DateFormatSymbols& operator=(const DateFormatSymbols&);
00147 
00153     ~DateFormatSymbols();
00154 
00162     UBool operator==(const DateFormatSymbols& other) const;
00163 
00171     UBool operator!=(const DateFormatSymbols& other) const { return !operator==(other); }
00172 
00180     const UnicodeString* getEras(int32_t& count) const;
00181 
00188     void setEras(const UnicodeString* eras, int32_t count);
00189 
00196     const UnicodeString* getMonths(int32_t& count) const;
00197 
00205     void setMonths(const UnicodeString* months, int32_t count);
00206 
00214     const UnicodeString* getShortMonths(int32_t& count) const;
00215 
00222     void setShortMonths(const UnicodeString* shortMonths, int32_t count);
00223 
00230     const UnicodeString* getWeekdays(int32_t& count) const;
00231 
00238     void setWeekdays(const UnicodeString* weekdays, int32_t count);
00239 
00246     const UnicodeString* getShortWeekdays(int32_t& count) const;
00247 
00254     void setShortWeekdays(const UnicodeString* shortWeekdays, int32_t count);
00255 
00262     const UnicodeString* getAmPmStrings(int32_t& count) const;
00263 
00270     void setAmPmStrings(const UnicodeString* ampms, int32_t count);
00271 
00279     const UnicodeString** getZoneStrings(int32_t& rowCount, int32_t& columnCount) const;
00280 
00288     void setZoneStrings(const UnicodeString* const* strings, int32_t rowCount, int32_t columnCount);
00289 
00295     static const UChar *getPatternUChars(void);
00296 
00303     UnicodeString& getLocalPatternChars(UnicodeString& result) const;
00304 
00311     void setLocalPatternChars(const UnicodeString& newLocalPatternChars);
00312 
00318     virtual UClassID getDynamicClassID() const;
00319 
00325     static UClassID getStaticClassID();
00326 
00327 private:
00328 
00329     friend class SimpleDateFormat;
00330     friend class DateFormatSymbolsSingleSetter; // see udat.cpp
00331 
00335     UnicodeString*  fEras;
00336     int32_t         fErasCount;
00337 
00341     UnicodeString*  fMonths;
00342     int32_t         fMonthsCount;
00343 
00347     UnicodeString*  fShortMonths;
00348     int32_t         fShortMonthsCount;
00349 
00353     UnicodeString*  fWeekdays;
00354     int32_t         fWeekdaysCount;
00355 
00359     UnicodeString*  fShortWeekdays;
00360     int32_t         fShortWeekdaysCount;
00361 
00365     UnicodeString*  fAmPms;
00366     int32_t         fAmPmsCount;
00367 
00371     UnicodeString** fZoneStrings;
00372     int32_t         fZoneStringsRowCount;
00373     int32_t         fZoneStringsColCount;
00374 
00378     UnicodeString   fLocalPatternChars;
00379 
00380 private:
00384     char validLocale[50];
00385     char actualLocale[50];
00386 
00387 
00388     /* Sizes for the last resort string arrays */
00389     typedef enum LastResortSize {
00390         kMonthNum = 13,
00391         kMonthLen = 3,
00392 
00393         kDayNum = 8,
00394         kDayLen = 2,
00395 
00396         kAmPmNum = 2,
00397         kAmPmLen = 3,
00398 
00399         kEraNum = 2,
00400         kEraLen = 3,
00401 
00402         kZoneNum = 5,
00403         kZoneLen = 4
00404     } LastResortSize;
00405 
00406     DateFormatSymbols(); // default constructor not implemented
00407 
00408     void initField(UnicodeString **field, int32_t& length, const ResourceBundle &data, UErrorCode &status);
00409     void initField(UnicodeString **field, int32_t& length, const UChar *data, LastResortSize numStr, LastResortSize strLen, UErrorCode &status);
00410 
00420     static ResourceBundle
00421       getData(ResourceBundle &rb, const char *tag, const char *type, UErrorCode& status);
00422 
00423 
00433     void initializeData(const Locale&, const char *type, UErrorCode& status, UBool useLastResortData = FALSE);
00434 
00443     static void assignArray(UnicodeString*& dstArray,
00444                             int32_t& dstCount,
00445                             const UnicodeString* srcArray,
00446                             int32_t srcCount);
00447 
00458     static UBool arrayCompare(const UnicodeString* array1,
00459                              const UnicodeString* array2,
00460                              int32_t count);
00461 
00467     void createZoneStrings(const UnicodeString *const * otherStrings);
00468 
00479     int32_t getZoneIndex(const UnicodeString& ID) const;
00480 
00481     // Internal method; see source for documentation
00482     int32_t _getZoneIndex(const UnicodeString& id) const;
00483 
00487     void dispose(void);
00488 
00493     void copyData(const DateFormatSymbols& other);
00494 
00498     void disposeZoneStrings(void);
00499 };
00500 
00501 U_NAMESPACE_END
00502 
00503 #endif /* #if !UCONFIG_NO_FORMATTING */
00504 
00505 #endif // _DTFMTSYM
00506 //eof

Generated on Mon Nov 24 14:35:30 2003 for ICU 2.8 by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001