Add multibyte-support to ctype-locale backend.

* add actual converter methods MultibyteToWchar() and WcharToMultibyte()
  to locale backend and implement them in the ctype subpart
* add management code for maintaining converters referenced by mbstate_t
This commit is contained in:
Oliver Tappe
2011-11-22 18:17:58 +01:00
parent 0f21cf0ca0
commit 28ae43d033
5 changed files with 176 additions and 1 deletions
@@ -30,9 +30,20 @@ public:
status_t ToWCTrans(wint_t wc, wctrans_t transition,
wint_t& result);
status_t MultibyteToWchar(wchar_t* wcOut, const char* mb,
size_t mbLength, mbstate_t* mbState,
size_t& lengthOut);
status_t WcharToMultibyte(char* mbOut, wchar_t wc,
mbstate_t* mbState, size_t& lengthOut);
const char* GetLanginfo(int index);
private:
status_t _GetConverterForMbState(mbstate_t* mbState,
ICUConverterRef& converterRefOut);
status_t _DropConverterFromMbState(mbstate_t* mbState);
/*
* The following arrays have 384 elements where the elements at
* index -128..-2 mirror the elements at index 128..255 (to protect
@@ -41,6 +41,12 @@ public:
virtual status_t ToWCTrans(wint_t wc, wctrans_t transition,
wint_t& result);
virtual status_t MultibyteToWchar(wchar_t* wcOut, const char* mb,
size_t mbLength, mbstate_t* mbState,
size_t& lengthOut);
virtual status_t WcharToMultibyte(char* mbOut, wchar_t wc,
mbstate_t* mbState, size_t& lengthOut);
virtual const char* GetLanginfo(int index);
virtual status_t Strcoll(const char* a, const char* b, int& out);
@@ -123,6 +123,12 @@ public:
virtual status_t ToWCTrans(wint_t wc, wctrans_t transition,
wint_t& result) = 0;
virtual status_t MultibyteToWchar(wchar_t* wcOut, const char* mb,
size_t mbLength, mbstate_t* mbState,
size_t& lengthOut) = 0;
virtual status_t WcharToMultibyte(char* mbOut, wchar_t wc,
mbstate_t* mbState, size_t& lengthOut) = 0;
virtual const char* GetLanginfo(int index) = 0;
virtual status_t Strcoll(const char* a, const char* b,