From 1c714a5d0718a51c57338986e9736f58ae355042 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 9 Dec 2006 16:19:34 +0000 Subject: [PATCH] implement To/FromWchar() as wxCSConv methods, otherwise wxCSConv(wxFONTENCODING_UTF16) didn't work correctly even if the underlying wxMBConvUTF16 did git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43877 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/strconv.h | 5 +++++ src/common/strconv.cpp | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/include/wx/strconv.h b/include/wx/strconv.h index d48ae1e44b..947efad799 100644 --- a/include/wx/strconv.h +++ b/include/wx/strconv.h @@ -373,9 +373,14 @@ public: wxCSConv& operator=(const wxCSConv& conv); + virtual size_t ToWChar(wchar_t *dst, size_t dstLen, + const char *src, size_t srcLen = wxNO_LEN) const; + virtual size_t FromWChar(char *dst, size_t dstLen, + const wchar_t *src, size_t srcLen = wxNO_LEN) const; virtual size_t MB2WC(wchar_t *outputBuf, const char *psz, size_t outputSize) const; virtual size_t WC2MB(char *outputBuf, const wchar_t *psz, size_t outputSize) const; virtual size_t GetMBNulLen() const; + virtual wxMBConv *Clone() const { return new wxCSConv(*this); } void Clear(); diff --git a/src/common/strconv.cpp b/src/common/strconv.cpp index 95ef424042..b80d82fdb6 100644 --- a/src/common/strconv.cpp +++ b/src/common/strconv.cpp @@ -3518,6 +3518,24 @@ void wxCSConv::CreateConvIfNeeded() const } } +size_t wxCSConv::ToWChar(wchar_t *dst, size_t dstLen, + const char *src, size_t srcLen) const +{ + CreateConvIfNeeded(); + + return m_convReal ? m_convReal->ToWChar(dst, dstLen, src, srcLen) + : wxCONV_FAILED; +} + +size_t wxCSConv::FromWChar(char *dst, size_t dstLen, + const wchar_t *src, size_t srcLen) const +{ + CreateConvIfNeeded(); + + return m_convReal ? m_convReal->FromWChar(dst, dstLen, src, srcLen) + : wxCONV_FAILED; +} + size_t wxCSConv::MB2WC(wchar_t *buf, const char *psz, size_t n) const { CreateConvIfNeeded(); -- 2.45.2