dtfmtsym.h

Go to the documentation of this file.
00001 /*  
00002 ********************************************************************************
00003 *   Copyright (C) 1997-2005, 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 
00076 class U_I18N_API DateFormatSymbols : public UObject {
00077 public:
00091     DateFormatSymbols(UErrorCode& status);
00092 
00103     DateFormatSymbols(const Locale& locale,
00104                       UErrorCode& status);
00105 
00122     DateFormatSymbols(const char *type, UErrorCode& status);
00123 
00137     DateFormatSymbols(const Locale& locale,
00138                       const char *type,
00139                       UErrorCode& status);
00140 
00145     DateFormatSymbols(const DateFormatSymbols&);
00146 
00151     DateFormatSymbols& operator=(const DateFormatSymbols&);
00152 
00158     virtual ~DateFormatSymbols();
00159 
00167     UBool operator==(const DateFormatSymbols& other) const;
00168 
00176     UBool operator!=(const DateFormatSymbols& other) const { return !operator==(other); }
00177 
00185     const UnicodeString* getEras(int32_t& count) const;
00186 
00193     void setEras(const UnicodeString* eras, int32_t count);
00194 
00202     const UnicodeString* getEraNames(int32_t& count) const;
00203 
00210     const UnicodeString* getMonths(int32_t& count) const;
00211 
00219     void setMonths(const UnicodeString* months, int32_t count);
00220 
00228     const UnicodeString* getShortMonths(int32_t& count) const;
00229 
00236     void setShortMonths(const UnicodeString* shortMonths, int32_t count);
00237 
00238     enum DtContextType {
00243          FORMAT = 0,
00248          STANDALONE = 1
00249     };
00250 
00251     enum DtWidthType {
00256          WIDE = 4,
00261          ABBREVIATED = 3,
00266          NARROW = 5
00267     };
00268 
00277     const UnicodeString* getMonths(int32_t& count, DtContextType context, DtWidthType width) const;
00278 
00285     const UnicodeString* getWeekdays(int32_t& count) const;
00286 
00287 
00294     void setWeekdays(const UnicodeString* weekdays, int32_t count);
00295 
00302     const UnicodeString* getShortWeekdays(int32_t& count) const;
00303 
00310     void setShortWeekdays(const UnicodeString* shortWeekdays, int32_t count);
00311 
00320     const UnicodeString* getWeekdays(int32_t& count, DtContextType context, DtWidthType width) const;
00321 
00328     const UnicodeString* getAmPmStrings(int32_t& count) const;
00329 
00336     void setAmPmStrings(const UnicodeString* ampms, int32_t count);
00337 
00345     const UnicodeString** getZoneStrings(int32_t& rowCount, int32_t& columnCount) const;
00346 
00354     void setZoneStrings(const UnicodeString* const* strings, int32_t rowCount, int32_t columnCount);
00355 
00361     static const UChar * U_EXPORT2 getPatternUChars(void);
00362 
00369     UnicodeString& getLocalPatternChars(UnicodeString& result) const;
00370 
00377     void setLocalPatternChars(const UnicodeString& newLocalPatternChars);
00378 
00384     Locale getLocale(ULocDataLocaleType type, UErrorCode& status) const;
00385 
00391     virtual UClassID getDynamicClassID() const;
00392 
00398     static UClassID U_EXPORT2 getStaticClassID();
00399 
00400 private:
00401 
00402     friend class SimpleDateFormat;
00403     friend class DateFormatSymbolsSingleSetter; // see udat.cpp
00404 
00408     UnicodeString*  fEras;
00409     int32_t         fErasCount;
00410 
00414     UnicodeString*  fEraNames;
00415     int32_t         fEraNamesCount;
00416 
00420     UnicodeString*  fMonths;
00421     int32_t         fMonthsCount;
00422 
00426     UnicodeString*  fShortMonths;
00427     int32_t         fShortMonthsCount;
00428 
00432     UnicodeString*  fNarrowMonths;
00433     int32_t         fNarrowMonthsCount;
00434 
00438     UnicodeString*  fStandaloneMonths;
00439     int32_t         fStandaloneMonthsCount;
00440 
00444     UnicodeString*  fStandaloneShortMonths;
00445     int32_t         fStandaloneShortMonthsCount;
00446 
00450     UnicodeString*  fStandaloneNarrowMonths;
00451     int32_t         fStandaloneNarrowMonthsCount;
00452 
00456     UnicodeString*  fWeekdays;
00457     int32_t         fWeekdaysCount;
00458 
00462     UnicodeString*  fShortWeekdays;
00463     int32_t         fShortWeekdaysCount;
00464 
00468     UnicodeString*  fNarrowWeekdays;
00469     int32_t         fNarrowWeekdaysCount;
00470 
00474     UnicodeString*  fStandaloneWeekdays;
00475     int32_t         fStandaloneWeekdaysCount;
00476 
00480     UnicodeString*  fStandaloneShortWeekdays;
00481     int32_t         fStandaloneShortWeekdaysCount;
00482 
00486     UnicodeString*  fStandaloneNarrowWeekdays;
00487     int32_t         fStandaloneNarrowWeekdaysCount;
00488 
00492     UnicodeString*  fAmPms;
00493     int32_t         fAmPmsCount;
00494 
00498     UnicodeString** fZoneStrings;
00499     int32_t         fZoneStringsRowCount;
00500     int32_t         fZoneStringsColCount;
00501 
00505     UnicodeString   fLocalPatternChars;
00506 
00507 private:
00511     char validLocale[ULOC_FULLNAME_CAPACITY];
00512     char actualLocale[ULOC_FULLNAME_CAPACITY];
00513 
00514     DateFormatSymbols(); // default constructor not implemented
00515 
00525     void initializeData(const Locale&, const char *type, UErrorCode& status, UBool useLastResortData = FALSE);
00526 
00535     static void assignArray(UnicodeString*& dstArray,
00536                             int32_t& dstCount,
00537                             const UnicodeString* srcArray,
00538                             int32_t srcCount);
00539 
00550     static UBool arrayCompare(const UnicodeString* array1,
00551                              const UnicodeString* array2,
00552                              int32_t count);
00553 
00559     void createZoneStrings(const UnicodeString *const * otherStrings);
00560 
00571     int32_t getZoneIndex(const UnicodeString& ID) const;
00572 
00573     // Internal method; see source for documentation
00574     int32_t _getZoneIndex(const UnicodeString& id) const;
00575 
00579     void dispose(void);
00580 
00585     void copyData(const DateFormatSymbols& other);
00586 
00590     void disposeZoneStrings(void);
00591 };
00592 
00593 U_NAMESPACE_END
00594 
00595 #endif /* #if !UCONFIG_NO_FORMATTING */
00596 
00597 #endif // _DTFMTSYM
00598 //eof

Generated on Tue Sep 13 11:03:32 2005 for ICU 3.4 by  doxygen 1.4.4