Use std::wstring unconditionally
Don't test for its existence in configure and CMake and don't use wxStdWideString in the code.
This commit is contained in:
parent
eb97bf90e4
commit
0a387693c6
14 changed files with 25 additions and 58 deletions
|
|
@ -144,12 +144,6 @@ wx_check_cxx_source_compiles("
|
||||||
string
|
string
|
||||||
)
|
)
|
||||||
|
|
||||||
wx_check_cxx_source_compiles(
|
|
||||||
"std::wstring s;"
|
|
||||||
HAVE_STD_WSTRING
|
|
||||||
string
|
|
||||||
)
|
|
||||||
|
|
||||||
wx_check_cxx_source_compiles("
|
wx_check_cxx_source_compiles("
|
||||||
std::hash_map<double*, char*, std::hash<double*>, std::equal_to<double*> > test1;
|
std::hash_map<double*, char*, std::hash<double*>, std::equal_to<double*> > test1;
|
||||||
std::hash_set<char*, std::hash<char*>, std::equal_to<char*> > test2;"
|
std::hash_set<char*, std::hash<char*>, std::equal_to<char*> > test2;"
|
||||||
|
|
|
||||||
|
|
@ -741,10 +741,6 @@
|
||||||
*/
|
*/
|
||||||
#cmakedefine VA_LIST_IS_ARRAY 1
|
#cmakedefine VA_LIST_IS_ARRAY 1
|
||||||
|
|
||||||
/*
|
|
||||||
* Define if your compiler has std::wstring
|
|
||||||
*/
|
|
||||||
#cmakedefine HAVE_STD_WSTRING 1
|
|
||||||
/*
|
/*
|
||||||
* Define if your compiler has compliant std::string::compare
|
* Define if your compiler has compliant std::string::compare
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
2
configure
vendored
2
configure
vendored
|
|
@ -24728,8 +24728,6 @@ if test "x$COMPAQCXX" = "xyes"; then
|
||||||
CXXFLAGS="-w0 -msg_disable basclsnondto,unrimpret,intconlosbit"
|
CXXFLAGS="-w0 -msg_disable basclsnondto,unrimpret,intconlosbit"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
$as_echo "#define HAVE_STD_WSTRING 1" >>confdefs.h
|
|
||||||
|
|
||||||
$as_echo "#define HAVE_STD_STRING_COMPARE 1" >>confdefs.h
|
$as_echo "#define HAVE_STD_STRING_COMPARE 1" >>confdefs.h
|
||||||
|
|
||||||
$as_echo "#define HAVE_STD_UNORDERED_MAP 1" >>confdefs.h
|
$as_echo "#define HAVE_STD_UNORDERED_MAP 1" >>confdefs.h
|
||||||
|
|
|
||||||
|
|
@ -1880,7 +1880,6 @@ if test "x$COMPAQCXX" = "xyes"; then
|
||||||
CXXFLAGS="-w0 -msg_disable basclsnondto,unrimpret,intconlosbit"
|
CXXFLAGS="-w0 -msg_disable basclsnondto,unrimpret,intconlosbit"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_DEFINE(HAVE_STD_WSTRING)
|
|
||||||
AC_DEFINE(HAVE_STD_STRING_COMPARE)
|
AC_DEFINE(HAVE_STD_STRING_COMPARE)
|
||||||
AC_DEFINE(HAVE_STD_UNORDERED_MAP)
|
AC_DEFINE(HAVE_STD_UNORDERED_MAP)
|
||||||
AC_DEFINE(HAVE_STD_UNORDERED_SET)
|
AC_DEFINE(HAVE_STD_UNORDERED_SET)
|
||||||
|
|
|
||||||
|
|
@ -315,10 +315,6 @@ typedef short int WXTYPE;
|
||||||
/* for consistency with wxStatic/DynamicCast defined in wx/object.h */
|
/* for consistency with wxStatic/DynamicCast defined in wx/object.h */
|
||||||
#define wxConstCast(obj, className) const_cast<className *>(obj)
|
#define wxConstCast(obj, className) const_cast<className *>(obj)
|
||||||
|
|
||||||
#ifndef HAVE_STD_WSTRING
|
|
||||||
#define HAVE_STD_WSTRING
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef HAVE_STD_STRING_COMPARE
|
#ifndef HAVE_STD_STRING_COMPARE
|
||||||
#define HAVE_STD_STRING_COMPARE
|
#define HAVE_STD_STRING_COMPARE
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@
|
||||||
#define wx_USE_NANOX 0
|
#define wx_USE_NANOX 0
|
||||||
|
|
||||||
#define HAVE_VA_COPY 1
|
#define HAVE_VA_COPY 1
|
||||||
#define HAVE_STD_WSTRING 1
|
|
||||||
#if __GNUC__ > 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ >= 2 )
|
#if __GNUC__ > 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ >= 2 )
|
||||||
#if !defined(__has_include)
|
#if !defined(__has_include)
|
||||||
#define HAVE_TR1_UNORDERED_MAP 1
|
#define HAVE_TR1_UNORDERED_MAP 1
|
||||||
|
|
|
||||||
|
|
@ -1239,9 +1239,9 @@ public:
|
||||||
// they need it
|
// they need it
|
||||||
#if wxUSE_STD_STRING
|
#if wxUSE_STD_STRING
|
||||||
#if wxUSE_UNICODE_WCHAR
|
#if wxUSE_UNICODE_WCHAR
|
||||||
wxString(const wxStdWideString& str) : m_impl(str) {}
|
wxString(const std::wstring& str) : m_impl(str) {}
|
||||||
#else // UTF-8 or ANSI
|
#else // UTF-8 or ANSI
|
||||||
wxString(const wxStdWideString& str)
|
wxString(const std::wstring& str)
|
||||||
{ assign(str.c_str(), str.length()); }
|
{ assign(str.c_str(), str.length()); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -1262,12 +1262,12 @@ public:
|
||||||
// We can avoid a copy if we already use this string type internally,
|
// We can avoid a copy if we already use this string type internally,
|
||||||
// otherwise we create a copy on the fly:
|
// otherwise we create a copy on the fly:
|
||||||
#if wxUSE_UNICODE_WCHAR && wxUSE_STL_BASED_WXSTRING
|
#if wxUSE_UNICODE_WCHAR && wxUSE_STL_BASED_WXSTRING
|
||||||
#define wxStringToStdWstringRetType const wxStdWideString&
|
#define wxStringToStdWstringRetType const std::wstring&
|
||||||
const wxStdWideString& ToStdWstring() const { return m_impl; }
|
const std::wstring& ToStdWstring() const { return m_impl; }
|
||||||
#else
|
#else
|
||||||
// wxStringImpl is either not std::string or needs conversion
|
// wxStringImpl is either not std::string or needs conversion
|
||||||
#define wxStringToStdWstringRetType wxStdWideString
|
#define wxStringToStdWstringRetType std::wstring
|
||||||
wxStdWideString ToStdWstring() const
|
std::wstring ToStdWstring() const
|
||||||
{
|
{
|
||||||
#if wxUSE_UNICODE_WCHAR
|
#if wxUSE_UNICODE_WCHAR
|
||||||
wxScopedWCharBuffer buf =
|
wxScopedWCharBuffer buf =
|
||||||
|
|
@ -1276,7 +1276,7 @@ public:
|
||||||
wxScopedWCharBuffer buf(wc_str());
|
wxScopedWCharBuffer buf(wc_str());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return wxStdWideString(buf.data(), buf.length());
|
return std::wstring(buf.data(), buf.length());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -66,14 +66,11 @@ extern WXDLLIMPEXP_DATA_BASE(const wxStringCharType*) wxEmptyStringImpl;
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "wx/afterstd.h"
|
#include "wx/afterstd.h"
|
||||||
|
|
||||||
#ifdef HAVE_STD_WSTRING
|
// Define this for compatibility only, it is not used any longer.
|
||||||
typedef std::wstring wxStdWideString;
|
typedef std::wstring wxStdWideString;
|
||||||
#else
|
|
||||||
typedef std::basic_string<wchar_t> wxStdWideString;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if wxUSE_UNICODE_WCHAR
|
#if wxUSE_UNICODE_WCHAR
|
||||||
typedef wxStdWideString wxStdString;
|
typedef std::wstring wxStdString;
|
||||||
#else
|
#else
|
||||||
typedef std::string wxStdString;
|
typedef std::string wxStdString;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -816,10 +816,10 @@ struct wxArgNormalizerWchar<const std::string_view&>
|
||||||
#endif // NO_IMPLICIT_WXSTRING_ENCODING
|
#endif // NO_IMPLICIT_WXSTRING_ENCODING
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct wxArgNormalizerWchar<const wxStdWideString&>
|
struct wxArgNormalizerWchar<const std::wstring&>
|
||||||
: public wxArgNormalizerWchar<const wchar_t*>
|
: public wxArgNormalizerWchar<const wchar_t*>
|
||||||
{
|
{
|
||||||
wxArgNormalizerWchar(const wxStdWideString& s,
|
wxArgNormalizerWchar(const std::wstring& s,
|
||||||
const wxFormatString *fmt, unsigned index)
|
const wxFormatString *fmt, unsigned index)
|
||||||
: wxArgNormalizerWchar<const wchar_t*>(s.c_str(), fmt, index) {}
|
: wxArgNormalizerWchar<const wchar_t*>(s.c_str(), fmt, index) {}
|
||||||
};
|
};
|
||||||
|
|
@ -850,10 +850,10 @@ struct wxArgNormalizerUtf8<const std::string_view&>
|
||||||
#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
|
#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct wxArgNormalizerUtf8<const wxStdWideString&>
|
struct wxArgNormalizerUtf8<const std::wstring&>
|
||||||
: public wxArgNormalizerUtf8<const wchar_t*>
|
: public wxArgNormalizerUtf8<const wchar_t*>
|
||||||
{
|
{
|
||||||
wxArgNormalizerUtf8(const wxStdWideString& s,
|
wxArgNormalizerUtf8(const std::wstring& s,
|
||||||
const wxFormatString *fmt, unsigned index)
|
const wxFormatString *fmt, unsigned index)
|
||||||
: wxArgNormalizerUtf8<const wchar_t*>(s.c_str(), fmt, index) {}
|
: wxArgNormalizerUtf8<const wchar_t*>(s.c_str(), fmt, index) {}
|
||||||
};
|
};
|
||||||
|
|
@ -865,7 +865,7 @@ WX_ARG_NORMALIZER_FORWARD(std::string, const std::string&);
|
||||||
WX_ARG_NORMALIZER_FORWARD(std::string_view, const std::string_view&);
|
WX_ARG_NORMALIZER_FORWARD(std::string_view, const std::string_view&);
|
||||||
#endif // __cpp_lib_string_view
|
#endif // __cpp_lib_string_view
|
||||||
#endif
|
#endif
|
||||||
WX_ARG_NORMALIZER_FORWARD(wxStdWideString, const wxStdWideString&);
|
WX_ARG_NORMALIZER_FORWARD(std::wstring, const std::wstring&);
|
||||||
|
|
||||||
#endif // wxUSE_STD_STRING
|
#endif // wxUSE_STD_STRING
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -243,14 +243,14 @@ public:
|
||||||
operator std::string() const { return (operator wxString()).ToStdString(); }
|
operator std::string() const { return (operator wxString()).ToStdString(); }
|
||||||
#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
|
#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||||
|
|
||||||
wxVariant(const wxStdWideString& val, const wxString& name = wxEmptyString);
|
wxVariant(const std::wstring& val, const wxString& name = wxEmptyString);
|
||||||
bool operator==(const wxStdWideString& value) const
|
bool operator==(const std::wstring& value) const
|
||||||
{ return operator==(wxString(value)); }
|
{ return operator==(wxString(value)); }
|
||||||
bool operator!=(const wxStdWideString& value) const
|
bool operator!=(const std::wstring& value) const
|
||||||
{ return operator!=(wxString(value)); }
|
{ return operator!=(wxString(value)); }
|
||||||
wxVariant& operator=(const wxStdWideString& value)
|
wxVariant& operator=(const std::wstring& value)
|
||||||
{ return operator=(wxString(value)); }
|
{ return operator=(wxString(value)); }
|
||||||
operator wxStdWideString() const { return (operator wxString()).ToStdWstring(); }
|
operator std::wstring() const { return (operator wxString()).ToStdWstring(); }
|
||||||
#endif // wxUSE_STD_STRING
|
#endif // wxUSE_STD_STRING
|
||||||
|
|
||||||
// wxUniChar
|
// wxUniChar
|
||||||
|
|
|
||||||
|
|
@ -741,10 +741,6 @@
|
||||||
*/
|
*/
|
||||||
#undef VA_LIST_IS_ARRAY
|
#undef VA_LIST_IS_ARRAY
|
||||||
|
|
||||||
/*
|
|
||||||
* Define if your compiler has std::wstring
|
|
||||||
*/
|
|
||||||
#undef HAVE_STD_WSTRING
|
|
||||||
/*
|
/*
|
||||||
* Define if your compiler has compliant std::string::compare
|
* Define if your compiler has compliant std::string::compare
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -808,19 +808,11 @@ typedef pid_t GPid;
|
||||||
#undef VA_LIST_IS_ARRAY
|
#undef VA_LIST_IS_ARRAY
|
||||||
|
|
||||||
#if defined(__NAMESPACE_STD) && !defined(__NAMESPACE_STD_ONLY)
|
#if defined(__NAMESPACE_STD) && !defined(__NAMESPACE_STD_ONLY)
|
||||||
/*
|
|
||||||
* Define if your compiler has std::wstring
|
|
||||||
*/
|
|
||||||
#define HAVE_STD_WSTRING 1
|
|
||||||
/*
|
/*
|
||||||
* Define if your compiler has compliant std::string::compare
|
* Define if your compiler has compliant std::string::compare
|
||||||
*/
|
*/
|
||||||
#define HAVE_STD_STRING_COMPARE 1
|
#define HAVE_STD_STRING_COMPARE 1
|
||||||
#else
|
#else
|
||||||
/*
|
|
||||||
* Define if your compiler has std::wstring
|
|
||||||
*/
|
|
||||||
/* #unfine HAVE_STD_WSTRING */
|
|
||||||
/*
|
/*
|
||||||
* Define if your compiler has compliant std::string::compare
|
* Define if your compiler has compliant std::string::compare
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -976,7 +976,7 @@ wxVariant::wxVariant(const std::string& val, const wxString& name)
|
||||||
m_name = name;
|
m_name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxVariant::wxVariant(const wxStdWideString& val, const wxString& name)
|
wxVariant::wxVariant(const std::wstring& val, const wxString& name)
|
||||||
{
|
{
|
||||||
m_refData = new wxVariantDataString(wxString(val));
|
m_refData = new wxVariantDataString(wxString(val));
|
||||||
m_name = name;
|
m_name = name;
|
||||||
|
|
|
||||||
|
|
@ -526,7 +526,7 @@ TEST_CASE("StdString::Substr", "[stdstring]")
|
||||||
TEST_CASE("StdString::Conversion", "[stdstring]")
|
TEST_CASE("StdString::Conversion", "[stdstring]")
|
||||||
{
|
{
|
||||||
std::string strStd("std::string value");
|
std::string strStd("std::string value");
|
||||||
wxStdWideString strStdWide(L"std::wstring value");
|
std::wstring strStdWide(L"std::wstring value");
|
||||||
|
|
||||||
wxString s1(strStd);
|
wxString s1(strStd);
|
||||||
CHECK( s1 == "std::string value" );
|
CHECK( s1 == "std::string value" );
|
||||||
|
|
@ -553,9 +553,9 @@ TEST_CASE("StdString::Conversion", "[stdstring]")
|
||||||
CHECK( s5 == "hello" );
|
CHECK( s5 == "hello" );
|
||||||
|
|
||||||
#if wxUSE_STL
|
#if wxUSE_STL
|
||||||
wxStdWideString s6 = s4;
|
std::wstring s6 = s4;
|
||||||
#else
|
#else
|
||||||
wxStdWideString s6 = s4.ToStdWstring();
|
std::wstring s6 = s4.ToStdWstring();
|
||||||
#endif
|
#endif
|
||||||
CHECK( s6 == "hello" );
|
CHECK( s6 == "hello" );
|
||||||
|
|
||||||
|
|
@ -564,7 +564,7 @@ TEST_CASE("StdString::Conversion", "[stdstring]")
|
||||||
CHECK( s7 == "hello" );
|
CHECK( s7 == "hello" );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
wxStdWideString s8(s4);
|
std::wstring s8(s4);
|
||||||
CHECK( s8 == "hello" );
|
CHECK( s8 == "hello" );
|
||||||
|
|
||||||
#if wxUSE_UNICODE
|
#if wxUSE_UNICODE
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue