xref: /haiku/headers/private/libroot/locale/ICUTimeData.h (revision 323b65468e5836bb27a5e373b14027d902349437)
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 ICUTimeData : public ICUCategoryData {
22 	typedef	ICUCategoryData		inherited;
23 public:
24 								ICUTimeData(pthread_key_t tlsKey,
25 									struct lc_time_t& lcTimeInfo);
26 								~ICUTimeData();
27 
28 			void				Initialize(LocaleTimeDataBridge* dataBridge);
29 
30 	virtual	status_t			SetTo(const Locale& locale,
31 									const char* posixLocaleName);
32 	virtual	status_t			SetToPosix();
33 
34 			const char*			GetLanginfo(int index);
35 
36 			const Locale&		ICULocale() const;
37 
38 private:
39 			status_t			_SetLCTimeEntries(const UnicodeString* strings,
40 									char* destination, int entrySize,
41 									int count, int maxCount);
42 			status_t			_SetLCTimePattern(DateFormat* format,
43 									char* destination, int destinationSize);
44 
45 			char				fMon[12][24];
46 			char				fMonth[12][64];
47 			char				fWday[7][24];
48 			char				fWeekday[7][64];
49 			char				fTimeFormat[24];
50 			char				fDateFormat[24];
51 			char				fDateTimeFormat[32];
52 			char				fAm[24];
53 			char				fPm[24];
54 			char				fDateTimeZoneFormat[32];
55 			char				fAltMonth[12][64];
56 			char				fMonthDayOrder[4];
57 			char				fAmPmFormat[32];
58 
59 			struct lc_time_t&	fLCTimeInfo;
60 
61 			LocaleTimeDataBridge*	fDataBridge;
62 };
63 
64 
65 }	// namespace Libroot
66 }	// namespace BPrivate
67 
68 
69 #endif	// _ICU_TIME_DATA_H
70