Deprecate unused wxMBConv parameters in wxString functions

Some wxString functions using wide strings still took wxMBConv just for
consistency with the same functions taking narrow strings in ANSI build,
but this doesn't really make sense any longer because the same code
can't be compiled with different values of wxChar -- it is always the
same thing as wchar_t now, and so we shouldn't pass unused conversion
objects to these functions any more.

So give deprecation warning when these functions are used (but without
formally deprecating them, as it doesn't cost much to keep them) and
avoid using them in the library code.
This commit is contained in:
Vadim Zeitlin 2022-10-28 19:19:05 +01:00
parent f36e414072
commit 3bc0d1ed92
8 changed files with 23 additions and 18 deletions

View file

@ -1171,10 +1171,15 @@ public:
// ctors from wchar_t* strings:
wxString(const wchar_t *pwz)
: m_impl(ImplStr(pwz)) {}
wxString(const wchar_t *pwz, const wxMBConv& WXUNUSED(conv))
: m_impl(ImplStr(pwz)) {}
wxString(const wchar_t *pwz, size_t nLength)
{ assign(pwz, nLength); }
// These ctors only existed for compatibility with the ANSI build and
// shouldn't be used any longer.
wxDEPRECATED_MSG("remove the wxMBConv ctor argument")
wxString(const wchar_t *pwz, const wxMBConv& WXUNUSED(conv))
: m_impl(ImplStr(pwz)) {}
wxDEPRECATED_MSG("remove the wxMBConv ctor argument")
wxString(const wchar_t *pwz, const wxMBConv& WXUNUSED(conv), size_t nLength)
{ assign(pwz, nLength); }
@ -1773,6 +1778,7 @@ public:
{ return AsWCharBuf(wxMBConvStrictUTF8()); }
#endif
// for compatibility only
wxDEPRECATED_MSG("remove the wxMBConv argument")
const wxWX2WCbuf wc_str(const wxMBConv& WXUNUSED(conv)) const
{ return wc_str(); }