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 U_NAMESPACE_QUALIFIER Locale& 36 locale, 37 const char* posixLocaleName); 38 virtual status_t SetToPosix(); 39 40 const char* GetLanginfo(int index); 41 42 private: 43 static const int32 kCsPrecedesFlag = 1 << 0; 44 static const int32 kSepBySpaceFlag = 1 << 1; 45 46 int32 _DetermineCurrencyPosAndSeparator( 47 const U_NAMESPACE_QUALIFIER 48 UnicodeString& prefix, 49 const U_NAMESPACE_QUALIFIER 50 UnicodeString& suffix, 51 const U_NAMESPACE_QUALIFIER 52 UnicodeString& signSymbol, 53 const U_NAMESPACE_QUALIFIER 54 UnicodeString& currencySymbol, 55 UChar& currencySeparatorChar); 56 int32 _DetermineSignPos(const U_NAMESPACE_QUALIFIER 57 UnicodeString& prefix, 58 const U_NAMESPACE_QUALIFIER 59 UnicodeString& suffix, 60 const U_NAMESPACE_QUALIFIER 61 UnicodeString& signSymbol, 62 const U_NAMESPACE_QUALIFIER 63 UnicodeString& currencySymbol); 64 65 char fDecimalPoint[skLCBufSize]; 66 char fThousandsSep[skLCBufSize]; 67 char fGrouping[skLCBufSize]; 68 char fIntCurrSymbol[skLCBufSize]; 69 char fCurrencySymbol[skLCBufSize]; 70 char fPositiveSign[skLCBufSize]; 71 char fNegativeSign[skLCBufSize]; 72 73 struct lconv& fLocaleConv; 74 const struct lconv* fPosixLocaleConv; 75 }; 76 77 78 } // namespace Libroot 79 } // namespace BPrivate 80 81 82 #endif // _ICU_MONETARY_DATA_H 83