1 /* 2 * Copyright 2010-2011, Oliver Tappe, zooey@hirschkaefer.de. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _ICU_TIME_DATA_H 6 #define _ICU_TIME_DATA_H 7 8 9 #include "ICUCategoryData.h" 10 #include "LocaleBackend.h" 11 12 #include <unicode/datefmt.h> 13 14 #include <timelocal.h> 15 16 17 namespace BPrivate { 18 namespace Libroot { 19 20 21 class ICUMessagesData; 22 23 24 class ICUTimeData : public ICUCategoryData { 25 typedef ICUCategoryData inherited; 26 public: 27 ICUTimeData(pthread_key_t tlsKey, 28 struct lc_time_t& lcTimeInfo, 29 const ICUMessagesData& messagesData); 30 ~ICUTimeData(); 31 32 void Initialize(LocaleTimeDataBridge* dataBridge); 33 34 virtual status_t SetTo(const Locale& locale, 35 const char* posixLocaleName); 36 virtual status_t SetToPosix(); 37 38 const char* GetLanginfo(int index); 39 40 const Locale& ICULocaleForStrings() const; 41 42 private: 43 status_t _SetLCTimeEntries(const UnicodeString* strings, 44 char* destination, int entrySize, 45 int count, int maxCount); 46 status_t _SetLCTimePattern(DateFormat* format, 47 char* destination, int destinationSize); 48 49 char fMon[12][24]; 50 char fMonth[12][64]; 51 char fWday[7][24]; 52 char fWeekday[7][64]; 53 char fTimeFormat[24]; 54 char fDateFormat[24]; 55 char fDateTimeFormat[32]; 56 char fAm[24]; 57 char fPm[24]; 58 char fDateTimeZoneFormat[32]; 59 char fAltMonth[12][64]; 60 char fMonthDayOrder[4]; 61 char fAmPmFormat[32]; 62 63 struct lc_time_t& fLCTimeInfo; 64 65 LocaleTimeDataBridge* fDataBridge; 66 67 const ICUMessagesData& fMessagesData; 68 }; 69 70 71 } // namespace Libroot 72 } // namespace BPrivate 73 74 75 #endif // _ICU_TIME_DATA_H 76