Remove wxUSE_STL which is not really used any longer

wxString is always based on std::[w]string since 2c0c727f49 (Remove wx
own wxStringImpl implementation, 2022-11-16) and all containers use
standard containers by default too now -- and there is a separate
wxUSE_STD_CONTAINERS for this anyhow.

The only remaining use of wxUSE_STL was as the default value for
wxUSE_STD_STRING_CONV_IN_WXSTRING option, but it's not really needed
for this neither, and this option can just be set to 0 by default.

Also add wxUSE_CHAR_CONV_IN_WXSTRING which can now be set to 0 too to
disable all unwanted implicit conversions (even "safe" ones, to wide
strings, in addition to the unsafe ones to narrow strings that could be
already disabled with wxUSE_UNSAFE_WXSTRING_CONV) to allow people who
don't want to have any implicit conversions at all to do it.

Keep --enable-stl configure option for compatibility, but warn if it is
used to tell people that it is not needed any longer.
This commit is contained in:
Vadim Zeitlin
2023-04-15 17:22:09 +02:00
parent d65eed50fa
commit 35c35c235e
22 changed files with 315 additions and 248 deletions
+4 -5
View File
@@ -614,23 +614,21 @@ TEST_CASE("StdString::Conversion", "[stdstring]")
wxString s4("hello");
// notice that implicit wxString -> std::string conversion is only
// available in wxUSE_STL case, because it conflicts with conversion to
// const char*/wchar_t*
#if wxUSE_STL && wxUSE_UNSAFE_WXSTRING_CONV
#if wxUSE_STD_STRING_CONV_IN_WXSTRING && wxUSE_UNSAFE_WXSTRING_CONV
std::string s5 = s4;
#else
std::string s5 = s4.ToStdString();
#endif
CHECK( s5 == "hello" );
#if wxUSE_STL
#if wxUSE_STD_STRING_CONV_IN_WXSTRING
std::wstring s6 = s4;
#else
std::wstring s6 = s4.ToStdWstring();
#endif
CHECK( s6 == L"hello" );
#if wxUSE_STD_STRING_CONV_IN_WXSTRING
#if wxUSE_UNSAFE_WXSTRING_CONV
std::string s7(s4);
CHECK( s7 == "hello" );
@@ -638,6 +636,7 @@ TEST_CASE("StdString::Conversion", "[stdstring]")
std::wstring s8(s4);
CHECK( s8 == L"hello" );
#endif // wxUSE_STD_STRING_CONV_IN_WXSTRING
std::string s9("\xF0\x9F\x90\xB1\0\xE7\x8C\xAB", 9); /* U+1F431 U+0000 U+732B */
wxString s10 = wxString::FromUTF8(s9);