1 /* 2 * Copyright 2010, Oliver Tappe, zooey@hirschkaefer.de. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _ICU_LOCALE_BACKEND_H 6 #define _ICU_LOCALE_BACKEND_H 7 8 9 #include "LocaleBackend.h" 10 11 #include <locale.h> 12 #include <timelocal.h> 13 14 #include "ICUCollateData.h" 15 #include "ICUCtypeData.h" 16 #include "ICUMessagesData.h" 17 #include "ICUMonetaryData.h" 18 #include "ICUNumericData.h" 19 #include "ICUTimeData.h" 20 21 22 namespace BPrivate { 23 24 25 class ICULocaleBackend : public LocaleBackend { 26 public: 27 ICULocaleBackend(); 28 virtual ~ICULocaleBackend(); 29 30 virtual void Initialize(LocaleDataBridge* dataBridge); 31 32 virtual const char* SetLocale(int category, 33 const char* posixLocaleName); 34 virtual const struct lconv* LocaleConv(); 35 virtual const struct lc_time_t* LCTimeInfo(); 36 37 virtual int IsWCType(wint_t wc, wctype_t charClass); 38 virtual status_t ToWCTrans(wint_t wc, wctrans_t transition, 39 wint_t& result); 40 41 virtual const char* GetLanginfo(int index); 42 43 virtual status_t Strcoll(const char* a, const char* b, int& out); 44 virtual status_t Strxfrm(char* out, const char* in, size_t size, 45 size_t& outSize); 46 47 private: 48 const char* _QueryLocale(int category); 49 const char* _SetPosixLocale(int category); 50 51 // buffer for locale names (up to one per category) 52 char fLocaleDescription[512]; 53 54 // data containers 55 struct lconv fLocaleConv; 56 struct lc_time_t fLCTimeInfo; 57 58 // these work on the data containers above 59 ICUCollateData fCollateData; 60 ICUCtypeData fCtypeData; 61 ICUMessagesData fMessagesData; 62 ICUMonetaryData fMonetaryData; 63 ICUNumericData fNumericData; 64 ICUTimeData fTimeData; 65 66 // static posix langinfo data 67 const char** fPosixLanginfo; 68 }; 69 70 71 } // namespace BPrivate 72 73 74 #endif // _ICU_LOCALE_BACKEND_H 75