xref: /haiku/headers/private/libroot/locale/ICUTimeData.h (revision cbe0a0c436162d78cc3f92a305b64918c839d079)
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 U_NAMESPACE_QUALIFIER Locale&
35 										locale,
36 									const char* posixLocaleName);
37 	virtual	status_t			SetToPosix();
38 
39 			const char*			GetLanginfo(int index);
40 
41 			const U_NAMESPACE_QUALIFIER Locale&	ICULocaleForStrings() const;
42 
43 private:
44 			status_t			_SetLCTimeEntries(const U_NAMESPACE_QUALIFIER
45 										UnicodeString* strings,
46 									char* destination, int entrySize,
47 									int count, int maxCount);
48 			status_t			_SetLCTimePattern(U_NAMESPACE_QUALIFIER
49 										DateFormat* format,
50 									char* destination, int destinationSize);
51 
52 			char				fMon[12][24];
53 			char				fMonth[12][64];
54 			char				fWday[7][24];
55 			char				fWeekday[7][64];
56 			char				fTimeFormat[24];
57 			char				fDateFormat[24];
58 			char				fDateTimeFormat[32];
59 			char				fAm[24];
60 			char				fPm[24];
61 			char				fDateTimeZoneFormat[32];
62 			char				fAltMonth[12][64];
63 			char				fMonthDayOrder[4];
64 			char				fAmPmFormat[32];
65 
66 			struct lc_time_t&	fLCTimeInfo;
67 
68 			LocaleTimeDataBridge*	fDataBridge;
69 
70 			const ICUMessagesData&	fMessagesData;
71 };
72 
73 
74 }	// namespace Libroot
75 }	// namespace BPrivate
76 
77 
78 #endif	// _ICU_TIME_DATA_H
79