Browse Source

CodeConversions: Make compatible with wx3.0

Signed-off-by: Mart Raudsepp <leio@gentoo.org>
pull/514/head
Mart Raudsepp 6 months ago
parent
commit
f6b0cd343c
  1. 11
      libraries/lib-string-utils/CodeConversions.cpp

11
libraries/lib-string-utils/CodeConversions.cpp

@ -28,7 +28,14 @@ std::string ToUTF8 (const wchar_t* wstr)
std::string ToUTF8 (const wxString& wstr)
{
#if wxCHECK_VERSION(3, 1, 1)
return wstr.ToStdString (wxGet_wxConvUTF8 ());
#elif !wxUSE_UNICODE
return std::string (wstr.c_str (), wstr.length ());
#else
wxScopedCharBuffer buf (wstr.mb_str (wxGet_wxConvUTF8 ()));
return std::string (buf.data (), buf.length ());
#endif
}
std::wstring ToWString (const std::string& str)
@ -48,7 +55,11 @@ std::wstring ToWString (const wxString& str)
wxString ToWXString (const std::string& str)
{
#if wxCHECK_VERSION(3, 1, 1)
return wxString::FromUTF8 (str);
#else
return wxString::FromUTF8 (str.c_str());
#endif
}
wxString ToWXString (const std::wstring& str)

Loading…
Cancel
Save