xref: /haiku/headers/private/libroot/locale/ICUMonetaryData.h (revision 22440f4105cafc95cc1d49f9bc65bb395c527d86)
1 /*
2  * Copyright 2010-2011, Oliver Tappe, zooey@hirschkaefer.de.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _ICU_MONETARY_DATA_H
6 #define _ICU_MONETARY_DATA_H
7 
8 
9 #include "ICULocaleconvData.h"
10 #include "LocaleBackend.h"
11 
12 #include <locale.h>
13 
14 
15 namespace BPrivate {
16 namespace Libroot {
17 
18 
19 class ICUMonetaryData : public ICULocaleconvData {
20 	typedef	ICULocaleconvData	inherited;
21 
22 public:
23 	static	const int32			kParenthesesAroundCurrencyAndValue = 0;
24 	static	const int32			kSignPrecedesCurrencyAndValue      = 1;
25 	static	const int32			kSignSucceedsCurrencyAndValue      = 2;
26 	static	const int32			kSignImmediatelyPrecedesCurrency   = 3;
27 	static	const int32			kSignImmediatelySucceedsCurrency   = 4;
28 
29 								ICUMonetaryData(pthread_key_t tlsKey,
30 									struct lconv& localeConv);
31 
32 			void				Initialize(
33 									LocaleMonetaryDataBridge* dataBridge);
34 
35 	virtual	status_t			SetTo(const Locale& locale,
36 									const char* posixLocaleName);
37 	virtual	status_t			SetToPosix();
38 
39 			const char*			GetLanginfo(int index);
40 
41 private:
42 	static	const int32			kCsPrecedesFlag = 1 << 0;
43 	static	const int32			kSepBySpaceFlag = 1 << 1;
44 
45 			int32				_DetermineCurrencyPosAndSeparator(
46 									const UnicodeString& prefix,
47 									const UnicodeString& suffix,
48 									const UnicodeString& signSymbol,
49 									const UnicodeString& currencySymbol,
50 									UChar& currencySeparatorChar);
51 			int32				_DetermineSignPos(const UnicodeString& prefix,
52 									const UnicodeString& suffix,
53 									const UnicodeString& signSymbol,
54 									const UnicodeString& currencySymbol);
55 
56 			char				fDecimalPoint[skLCBufSize];
57 			char				fThousandsSep[skLCBufSize];
58 			char				fGrouping[skLCBufSize];
59 			char				fIntCurrSymbol[skLCBufSize];
60 			char				fCurrencySymbol[skLCBufSize];
61 			char				fPositiveSign[skLCBufSize];
62 			char				fNegativeSign[skLCBufSize];
63 
64 			struct lconv&		fLocaleConv;
65 			const struct lconv*	fPosixLocaleConv;
66 };
67 
68 
69 }	// namespace Libroot
70 }	// namespace BPrivate
71 
72 
73 #endif	// _ICU_MONETARY_DATA_H
74