Add wxNO_UNSAFE_WXSTRING_CONV2 macro

The macro disallows implicit conversions between wxString and const
char*
This commit is contained in:
Arrigo Marchiori
2019-10-21 11:05:58 +02:00
committed by Vadim Zeitlin
parent 15a4375f93
commit 65cbf40b7e
16 changed files with 502 additions and 33 deletions

View File

@@ -216,8 +216,10 @@ public:
wxVariant& operator=(const wxString& value);
// these overloads are necessary to prevent the compiler from using bool
// version instead of wxString one:
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
wxVariant& operator=(const char* value)
{ return *this = wxString(value); }
#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
wxVariant& operator=(const wchar_t* value)
{ return *this = wxString(value); }
wxVariant& operator=(const wxCStrData& value)
@@ -230,6 +232,7 @@ public:
wxString GetString() const;
#if wxUSE_STD_STRING
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
wxVariant(const std::string& val, const wxString& name = wxEmptyString);
bool operator==(const std::string& value) const
{ return operator==(wxString(value)); }
@@ -238,6 +241,7 @@ public:
wxVariant& operator=(const std::string& value)
{ return operator=(wxString(value)); }
operator std::string() const { return (operator wxString()).ToStdString(); }
#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
wxVariant(const wxStdWideString& val, const wxString& name = wxEmptyString);
bool operator==(const wxStdWideString& value) const