00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
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
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
00347
00348 int32_t _getZoneIndex(const UnicodeString& id) const;
00349
00354 void dispose(void);
00355
00360 void disposeZoneStrings(void);
00361
00366 static const UnicodeString fgLastResortMonthNames[];
00367 static const UnicodeString fgLastResortDayNames[];
00368 static const UnicodeString fgLastResortAmPmMarkers[];
00369 static const UnicodeString fgLastResortEras[];
00370 static const UnicodeString fgLastResortZoneStrings[];
00371 static UnicodeString** fgLastResortZoneStringsH;
00372
00379 enum
00380 {
00381 kEras,
00382 kMonths,
00383 kShortMonths,
00384 kWeekdays,
00385 kShortWeekdays,
00386 kAmPms,
00387 kZoneStrings
00388 };
00389 uint8_t fIsOwned;
00390
00394 void setIsOwned(int32_t which, UBool isOwned);
00395
00399 UBool isOwned(int32_t which) const;
00400 };
00401
00402 inline void
00403 DateFormatSymbols::setIsOwned(int32_t which, UBool isOwned)
00404 {
00405 fIsOwned = (uint8_t)(( fIsOwned & ~(1 << which) ) | ( (isOwned ? 1 : 0) << which ));
00406 }
00407
00408 inline UBool
00409 DateFormatSymbols::isOwned(int32_t which) const
00410 {
00411 return ( (fIsOwned >> which) & 1 ) != 0;
00412 }
00413
00414 #endif // _DTFMTSYM
00415