xref: /haiku/headers/private/libroot/locale/ICUCategoryData.h (revision e0ef64750f3169cd634bb2f7a001e22488b05231)
1 /*
2  * Copyright 2010, Oliver Tappe, zooey@hirschkaefer.de.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _ICU_CATEGORY_DATA_H
6 #define _ICU_CATEGORY_DATA_H
7 
8 
9 #include <unicode/locid.h>
10 #include <unicode/ucnv.h>
11 #include <unicode/unistr.h>
12 
13 #include <SupportDefs.h>
14 
15 
16 namespace BPrivate {
17 
18 
19 class ICUCategoryData {
20 public:
21 								ICUCategoryData();
22 	virtual 					~ICUCategoryData();
23 
24 	virtual	status_t			SetTo(const Locale& locale,
25 									const char* posixLocaleName);
26 	virtual	status_t			SetToPosix();
27 
28 			const char *		PosixLocaleName()
29 									{ return fPosixLocaleName; }
30 
31 protected:
32 			status_t			_ConvertUnicodeStringToLocaleconvEntry(
33 									const UnicodeString& string,
34 									char* destination, int destinationSize,
35 									const char* defaultValue = "");
36 
37 	static	const uint16		skMaxPosixLocaleNameLen = 128;
38 	static	const size_t		skLCBufSize = 16;
39 
40 			Locale				fLocale;
41 			UConverter*			fConverter;
42 			char				fPosixLocaleName[skMaxPosixLocaleNameLen];
43 			char				fGivenCharset[UCNV_MAX_CONVERTER_NAME_LENGTH];
44 
45 private:
46 			status_t			_SetupConverter();
47 };
48 
49 
50 }	// namespace BPrivate
51 
52 
53 #endif	// _ICU_CATEGORY_DATA_H
54