Remove wxUSE_STD_STRING and wxUSE_STD_CONTAINERS_COMPATIBLY

Assume they are always 1 now, there is no good reason to ever set them
to 0 any more.

Note that we still keep wxUSE_STD_IOSTREAM for now, but we can drop
wxUSE_STD_DEFAULT as it's not worth having it just for this single
option (previously it was used as the default value for 3 of them).
This commit is contained in:
Vadim Zeitlin 2022-11-16 23:18:57 +01:00
parent 2c0c727f49
commit be7860c766
29 changed files with 134 additions and 579 deletions

View file

@ -187,7 +187,6 @@ if(NOT wxBUILD_DEBUG_LEVEL STREQUAL "Default")
endif()
# Constants for setup.h creation
set(wxUSE_STD_DEFAULT ON)
if(NOT wxUSE_EXPAT)
set(wxUSE_XRC OFF)
endif()

View file

@ -76,6 +76,7 @@ mark_as_advanced(wxBUILD_PIC)
wx_option(wxUSE_NO_RTTI "disable RTTI support" OFF)
# STL options
wx_option(wxUSE_STD_IOSTREAM "use standard C++ streams" ON)
wx_option(wxUSE_STL "use standard C++ classes for everything" OFF)
set(wxTHIRD_PARTY_LIBRARIES ${wxTHIRD_PARTY_LIBRARIES} wxUSE_STL "use C++ STL classes")
wx_dependent_option(wxUSE_STD_CONTAINERS "use standard C++ container classes" ON "wxUSE_STL" OFF)

View file

@ -171,15 +171,9 @@
#cmakedefine01 wxUSE_STL
#cmakedefine01 wxUSE_STD_DEFAULT
#define wxUSE_STD_CONTAINERS_COMPATIBLY wxUSE_STD_DEFAULT
#cmakedefine01 wxUSE_STD_CONTAINERS
#define wxUSE_STD_IOSTREAM wxUSE_STD_DEFAULT
#define wxUSE_STD_STRING wxUSE_STD_DEFAULT
#cmakedefine01 wxUSE_STD_IOSTREAM
#define wxUSE_STD_STRING_CONV_IN_WXSTRING wxUSE_STL

84
configure vendored
View file

@ -1122,9 +1122,7 @@ enable_cxx11
with_cxx
enable_stl
enable_std_containers
enable_std_containers_compat
enable_std_iostreams
enable_std_string
enable_std_string_conv_in_wxstring
enable_unsafe_conv_in_wxstring
enable_utf8
@ -2090,9 +2088,7 @@ Optional Features:
--enable-cxx11 obsolete option doing nothing
--enable-stl use standard C++ classes for everything
--enable-std_containers use standard C++ container classes
--enable-std_containers_compat use standard C++ container classes when it can be done compatible
--enable-std_iostreams use standard C++ stream classes
--enable-std_string use standard C++ string classes
--disable-std_iostreams disable use of standard C++ stream classes
--enable-std_string_conv_in_wxstring provide implicit conversion to std::string in wxString
--disable-unsafe_conv_in_wxstring disable unsafe implicit conversions in wxString
--enable-utf8 use UTF-8 representation for strings (Unix only)
@ -3849,8 +3845,6 @@ SAMPLES_RPATH_FLAG=
DYLIB_RPATH_INSTALL=
DYLIB_RPATH_POSTLINK=
DEFAULT_STD_FLAG=yes
case "${host}" in
*-hp-hpux* )
USE_HPUX=1
@ -4045,9 +4039,6 @@ esac
DEFAULT_wxUSE_ALL_FEATURES=yes
DEFAULT_wxUSE_STD_CONTAINERS=no
DEFAULT_wxUSE_STD_CONTAINERS_COMPATIBLY=$DEFAULT_STD_FLAG
DEFAULT_wxUSE_STD_IOSTREAM=$DEFAULT_STD_FLAG
DEFAULT_wxUSE_STD_STRING=$DEFAULT_STD_FLAG
DEFAULT_wxUSE_DMALLOC=no
DEFAULT_wxUSE_LIBCURL=auto
@ -5662,9 +5653,6 @@ fi
if test "$wxUSE_STL" = "yes"; then
DEFAULT_wxUSE_STD_CONTAINERS=yes
DEFAULT_wxUSE_STD_CONTAINERS_COMPATIBLY=yes
DEFAULT_wxUSE_STD_IOSTREAM=yes
DEFAULT_wxUSE_STD_STRING=yes
fi
enablestring=
@ -5696,36 +5684,7 @@ fi
eval "$wx_cv_use_std_containers"
enablestring=
defaultval=
if test -z "$defaultval"; then
if test x"$enablestring" = xdisable; then
defaultval=yes
else
defaultval=no
fi
fi
# Check whether --enable-std_containers_compat was given.
if test "${enable_std_containers_compat+set}" = set; then :
enableval=$enable_std_containers_compat;
if test "$enableval" = yes; then
wx_cv_use_std_containers_compat='wxUSE_STD_CONTAINERS_COMPATIBLY=yes'
else
wx_cv_use_std_containers_compat='wxUSE_STD_CONTAINERS_COMPATIBLY=no'
fi
else
wx_cv_use_std_containers_compat='wxUSE_STD_CONTAINERS_COMPATIBLY=${'DEFAULT_wxUSE_STD_CONTAINERS_COMPATIBLY":-$defaultval}"
fi
eval "$wx_cv_use_std_containers_compat"
enablestring=
enablestring=disable
defaultval=
if test -z "$defaultval"; then
if test x"$enablestring" = xdisable; then
@ -5754,35 +5713,6 @@ fi
eval "$wx_cv_use_std_iostreams"
enablestring=
defaultval=
if test -z "$defaultval"; then
if test x"$enablestring" = xdisable; then
defaultval=yes
else
defaultval=no
fi
fi
# Check whether --enable-std_string was given.
if test "${enable_std_string+set}" = set; then :
enableval=$enable_std_string;
if test "$enableval" = yes; then
wx_cv_use_std_string='wxUSE_STD_STRING=yes'
else
wx_cv_use_std_string='wxUSE_STD_STRING=no'
fi
else
wx_cv_use_std_string='wxUSE_STD_STRING=${'DEFAULT_wxUSE_STD_STRING":-$defaultval}"
fi
eval "$wx_cv_use_std_string"
enablestring=
defaultval=
if test -z "$defaultval"; then
@ -37599,21 +37529,11 @@ if test "$wxUSE_STD_CONTAINERS" = "yes"; then
fi
if test "$wxUSE_STD_CONTAINERS_COMPATIBLY" = "yes"; then
$as_echo "#define wxUSE_STD_CONTAINERS_COMPATIBLY 1" >>confdefs.h
fi
if test "$wxUSE_STD_IOSTREAM" = "yes"; then
$as_echo "#define wxUSE_STD_IOSTREAM 1" >>confdefs.h
fi
if test "$wxUSE_STD_STRING" = "yes"; then
$as_echo "#define wxUSE_STD_STRING 1" >>confdefs.h
fi
if test "$wxUSE_STD_STRING_CONV_IN_WXSTRING" = "yes"; then
$as_echo "#define wxUSE_STD_STRING_CONV_IN_WXSTRING 1" >>confdefs.h

View file

@ -140,8 +140,6 @@ SAMPLES_RPATH_FLAG=
DYLIB_RPATH_INSTALL=
DYLIB_RPATH_POSTLINK=
DEFAULT_STD_FLAG=yes
dnl to support a new system, you need to add its canonical name (as determined
dnl by config.sub or specified by the configure command line) to this "case"
dnl and also define the shared library flags below - search for
@ -327,9 +325,6 @@ dnl default)
DEFAULT_wxUSE_ALL_FEATURES=yes
DEFAULT_wxUSE_STD_CONTAINERS=no
DEFAULT_wxUSE_STD_CONTAINERS_COMPATIBLY=$DEFAULT_STD_FLAG
DEFAULT_wxUSE_STD_IOSTREAM=$DEFAULT_STD_FLAG
DEFAULT_wxUSE_STD_STRING=$DEFAULT_STD_FLAG
dnl libraries disabled by default or requiring some special handling
DEFAULT_wxUSE_DMALLOC=no
@ -665,14 +660,9 @@ AC_ARG_WITH(cxx, [ --with-cxx=11|14|17|20 use the given C++ dialect]
WX_ARG_ENABLE(stl, [ --enable-stl use standard C++ classes for everything], wxUSE_STL)
if test "$wxUSE_STL" = "yes"; then
DEFAULT_wxUSE_STD_CONTAINERS=yes
DEFAULT_wxUSE_STD_CONTAINERS_COMPATIBLY=yes
DEFAULT_wxUSE_STD_IOSTREAM=yes
DEFAULT_wxUSE_STD_STRING=yes
fi
WX_ARG_ENABLE(std_containers,[ --enable-std_containers use standard C++ container classes], wxUSE_STD_CONTAINERS)
WX_ARG_ENABLE(std_containers_compat, [ --enable-std_containers_compat use standard C++ container classes when it can be done compatible], wxUSE_STD_CONTAINERS_COMPATIBLY)
WX_ARG_ENABLE(std_iostreams, [ --enable-std_iostreams use standard C++ stream classes], wxUSE_STD_IOSTREAM)
WX_ARG_ENABLE(std_string, [ --enable-std_string use standard C++ string classes], wxUSE_STD_STRING)
WX_ARG_DISABLE(std_iostreams,[ --disable-std_iostreams disable use of standard C++ stream classes], wxUSE_STD_IOSTREAM)
WX_ARG_ENABLE(std_string_conv_in_wxstring, [ --enable-std_string_conv_in_wxstring provide implicit conversion to std::string in wxString], wxUSE_STD_STRING_CONV_IN_WXSTRING)
WX_ARG_DISABLE(unsafe_conv_in_wxstring, [ --disable-unsafe_conv_in_wxstring disable unsafe implicit conversions in wxString], wxUSE_UNSAFE_WXSTRING_CONV)
WX_ARG_ENABLE_PARAM(utf8, [ --enable-utf8 use UTF-8 representation for strings (Unix only)], wxUSE_UNICODE_UTF8)
@ -5430,18 +5420,10 @@ if test "$wxUSE_STD_CONTAINERS" = "yes"; then
AC_DEFINE(wxUSE_STD_CONTAINERS)
fi
if test "$wxUSE_STD_CONTAINERS_COMPATIBLY" = "yes"; then
AC_DEFINE(wxUSE_STD_CONTAINERS_COMPATIBLY)
fi
if test "$wxUSE_STD_IOSTREAM" = "yes"; then
AC_DEFINE(wxUSE_STD_IOSTREAM)
fi
if test "$wxUSE_STD_STRING" = "yes"; then
AC_DEFINE(wxUSE_STD_STRING)
fi
if test "$wxUSE_STD_STRING_CONV_IN_WXSTRING" = "yes"; then
AC_DEFINE(wxUSE_STD_STRING_CONV_IN_WXSTRING)
fi

View file

@ -29,11 +29,6 @@ library:
@beginDefList
@itemdef{wxUSE_STL, Container classes and wxString are implemented using
standard classes and provide the same standard API.}
@itemdef{wxUSE_STD_STRING, wxString is implemented using std::[w]string and can
be constructed from it (but provides wxWidgets-compatible API, in
particular is implicitly convertible to @c char* and not std::[w]string).}
@itemdef{wxUSE_STD_IOSTREAM, Standard C++ classes are used instead of or in
addition to wx stream classes.}
@itemdef{wxUSE_UNICODE, Always defined as 1 in wxWidgets 3.3 and later, only
exists for compatibility.}
@itemdef{wxUSE_UNICODE_WCHAR, wxString uses wchar_t buffer for internal storage

View file

@ -283,35 +283,11 @@
//
// Default is 0
//
// Recommended setting: 0 as the options below already provide a relatively
// good level of interoperability and changing this option arguably isn't worth
// diverging from the official builds of the library.
// Recommended setting: 1 for new code bases and if compatibility with the
// official build of the library is not important, 0 otherwise.
#define wxUSE_STL 0
// This is not a real option but is used as the default value for
// wxUSE_STD_IOSTREAM, wxUSE_STD_STRING and wxUSE_STD_CONTAINERS_COMPATIBLY.
//
// Set it to 0 if you want to disable the use of all standard classes
// completely for some reason.
#define wxUSE_STD_DEFAULT 1
// Use standard C++ containers where it can be done without breaking backwards
// compatibility.
//
// This provides better interoperability with the standard library, e.g. with
// this option on it's possible to insert std::vector<> into many wxWidgets
// containers directly.
//
// Default is 1.
//
// Recommended setting is 1 unless you want to avoid all dependencies on the
// standard library.
#define wxUSE_STD_CONTAINERS_COMPATIBLY wxUSE_STD_DEFAULT
// Use standard C++ containers to implement wxVector<>, wxStack<>, wxDList<>
// and wxHashXXX<> classes. If disabled, wxWidgets own (mostly compatible but
// usually more limited) implementations are used which allows to avoid the
// dependency on the C++ run-time library.
// Use standard C++ containers to implement all wx container classes.
//
// Default is 0 for compatibility reasons.
//
@ -320,30 +296,15 @@
#define wxUSE_STD_CONTAINERS 0
// Use standard C++ streams if 1 instead of wx streams in some places. If
// disabled, wx streams are used everywhere and wxWidgets doesn't depend on the
// standard streams library.
// disabled, wx streams are used instead.
//
// Notice that enabling this does not replace wx streams with std streams
// everywhere, in a lot of places wx streams are used no matter what.
//
// Default is 1 if compiler supports it.
// Default is 1.
//
// Recommended setting: 1 if you use the standard streams anyhow and so
// dependency on the standard streams library is not a
// problem
#define wxUSE_STD_IOSTREAM wxUSE_STD_DEFAULT
// Enable minimal interoperability with the standard C++ string class if 1.
// "Minimal" means that wxString can be constructed from std::string or
// std::wstring but can't be implicitly converted to them. You need to enable
// the option below for the latter.
//
// Default is 1 for most compilers.
//
// Recommended setting: 1 unless you want to ensure your program doesn't use
// the standard C++ library at all.
#define wxUSE_STD_STRING wxUSE_STD_DEFAULT
// Recommended setting: 1.
#define wxUSE_STD_IOSTREAM 1
// Make wxString as much interchangeable with std::[w]string as possible, in
// particular allow implicit conversion of wxString to either of these classes.
// This comes at a price (or a benefit, depending on your point of view) of not
@ -353,6 +314,10 @@
// disabled by default but can be enabled for your build if you don't care
// about compatibility.
//
// Note that wxString can always be constructed from std::[w]string, whether
// this option is turned on or off, it only enables implicit conversion in the
// other direction.
//
// Default is 0 if wxUSE_STL has its default value or 1 if it is enabled.
//
// Recommended setting: 0 to remain compatible with the official builds of

View file

@ -15,9 +15,7 @@
#include "wx/string.h"
#include "wx/dynarray.h"
#if wxUSE_STD_CONTAINERS_COMPATIBLY
#include <vector>
#endif
#include <vector>
// these functions are only used in STL build now but we define them in any
// case for compatibility with the existing code outside of the library which
@ -508,14 +506,12 @@ public:
m_data.ptr = strings;
}
#if wxUSE_STD_CONTAINERS_COMPATIBLY
// construct an adapter from a vector of strings
wxArrayStringsAdapter(const std::vector<wxString>& strings)
: m_type(wxSTRING_POINTER), m_size(strings.size())
{
m_data.ptr = m_size == 0 ? nullptr : &strings[0];
}
#endif // wxUSE_STD_CONTAINERS_COMPATIBLY
// construct an adapter from a single wxString
wxArrayStringsAdapter(const wxString& s)

View file

@ -314,14 +314,6 @@
# endif
#endif /* !defined(wxUSE_STD_CONTAINERS) */
#ifndef wxUSE_STD_CONTAINERS_COMPATIBLY
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_STD_CONTAINERS_COMPATIBLY must be defined, please read comment near the top of this file."
# else
# define wxUSE_STD_CONTAINERS_COMPATIBLY 0
# endif
#endif /* !defined(wxUSE_STD_CONTAINERS_COMPATIBLY) */
#ifndef wxUSE_STD_STRING_CONV_IN_WXSTRING
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_STD_STRING_CONV_IN_WXSTRING must be defined, please read comment near the top of this file."
@ -2053,15 +2045,6 @@
# endif
# endif
# if !wxUSE_STREAMS && !wxUSE_STD_IOSTREAM
# ifdef wxABORT_ON_CONFIG_ERROR
# error "DocView requires wxUSE_STREAMS or wxUSE_STD_IOSTREAM"
# else
# undef wxUSE_STREAMS
# define wxUSE_STREAMS 1
# endif
# endif
# if !wxUSE_FILE_HISTORY
# ifdef wxABORT_ON_CONFIG_ERROR
# error "DocView requires wxUSE_FILE_HISTORY"

View file

@ -134,12 +134,7 @@ public:
typedef wxCmdLineArg value_type;
typedef const wxCmdLineArg* pointer;
typedef const wxCmdLineArg& reference;
// We avoid dependency on standard library by default but if we do use
// std::string, then it's ok to use iterator tags as well.
#if wxUSE_STD_STRING
typedef std::bidirectional_iterator_tag iterator_category;
#endif // wx_USE_STD_STRING
const_iterator() : m_parser(nullptr), m_index(0) {}
reference operator *() const;

View file

@ -18,9 +18,7 @@
#include "wx/arrstr.h"
#include "wx/control.h" // base class
#if wxUSE_STD_CONTAINERS_COMPATIBLY
#include <vector>
#endif // wxUSE_STD_CONTAINERS_COMPATIBLY
// ----------------------------------------------------------------------------
// wxItemContainer defines an interface which is implemented by all controls
@ -219,11 +217,8 @@ public:
const wxString *items,
wxClientData **clientData)
{ return AppendItems(wxArrayStringsAdapter(n, items), clientData); }
#if wxUSE_STD_CONTAINERS_COMPATIBLY
int Append(const std::vector<wxString>& items)
{ return AppendItems(items); }
#endif // wxUSE_STD_CONTAINERS_COMPATIBLY
// only for RTTI needs (separate name)
void AppendString(const wxString& item)
@ -263,11 +258,8 @@ public:
unsigned int pos,
wxClientData **clientData)
{ return InsertItems(wxArrayStringsAdapter(n, items), pos, clientData); }
#if wxUSE_STD_CONTAINERS_COMPATIBLY
int Insert(const std::vector<wxString>& items, unsigned int pos)
{ return InsertItems(items, pos); }
#endif // wxUSE_STD_CONTAINERS_COMPATIBLY
// replacing items
// ---------------
@ -284,11 +276,8 @@ public:
{ Clear(); Append(n, items, clientData); }
void Set(unsigned int n, const wxString *items, wxClientData **clientData)
{ Clear(); Append(n, items, clientData); }
#if wxUSE_STD_CONTAINERS_COMPATIBLY
void Set(const std::vector<wxString>& items)
{ Clear(); Append(items); }
#endif // wxUSE_STD_CONTAINERS_COMPATIBLY
// deleting items
// --------------

View file

@ -2602,17 +2602,15 @@ typedef int (* LINKAGEMODE wxListIterateFunction)(void *current);
#endif
#if defined(__CYGWIN__) && defined(__WXMSW__)
# if wxUSE_STD_CONTAINERS || defined(wxUSE_STD_STRING)
/*
NASTY HACK because the gethostname in sys/unistd.h which the gnu
stl includes and wx builds with by default clash with each other
(windows version 2nd param is int, sys/unistd.h version is unsigned
int).
*/
# define gethostname gethostnameHACK
# include <unistd.h>
# undef gethostname
# endif
/*
NASTY HACK because the gethostname in sys/unistd.h which the gnu
stl includes and wx builds with by default clash with each other
(windows version 2nd param is int, sys/unistd.h version is unsigned
int).
*/
# define gethostname gethostnameHACK
# include <unistd.h>
# undef gethostname
#endif
/* --------------------------------------------------------------------------- */

View file

@ -19,9 +19,7 @@
#include "wx/scrolwin.h"
#if wxUSE_STD_CONTAINERS_COMPATIBLY
#include <iterator>
#endif
#include <iterator>
// ----------------------------------------------------------------------------
// constants
@ -1129,9 +1127,7 @@ public:
class iterator
{
public:
#if wxUSE_STD_CONTAINERS_COMPATIBLY
typedef std::forward_iterator_tag iterator_category;
#endif
typedef ptrdiff_t difference_type;
typedef wxGridBlockCoords value_type;
typedef const value_type& reference;

View file

@ -284,35 +284,11 @@
//
// Default is 0
//
// Recommended setting: 0 as the options below already provide a relatively
// good level of interoperability and changing this option arguably isn't worth
// diverging from the official builds of the library.
// Recommended setting: 1 for new code bases and if compatibility with the
// official build of the library is not important, 0 otherwise.
#define wxUSE_STL 0
// This is not a real option but is used as the default value for
// wxUSE_STD_IOSTREAM, wxUSE_STD_STRING and wxUSE_STD_CONTAINERS_COMPATIBLY.
//
// Set it to 0 if you want to disable the use of all standard classes
// completely for some reason.
#define wxUSE_STD_DEFAULT 1
// Use standard C++ containers where it can be done without breaking backwards
// compatibility.
//
// This provides better interoperability with the standard library, e.g. with
// this option on it's possible to insert std::vector<> into many wxWidgets
// containers directly.
//
// Default is 1.
//
// Recommended setting is 1 unless you want to avoid all dependencies on the
// standard library.
#define wxUSE_STD_CONTAINERS_COMPATIBLY wxUSE_STD_DEFAULT
// Use standard C++ containers to implement wxVector<>, wxStack<>, wxDList<>
// and wxHashXXX<> classes. If disabled, wxWidgets own (mostly compatible but
// usually more limited) implementations are used which allows to avoid the
// dependency on the C++ run-time library.
// Use standard C++ containers to implement all wx container classes.
//
// Default is 0 for compatibility reasons.
//
@ -321,30 +297,15 @@
#define wxUSE_STD_CONTAINERS 0
// Use standard C++ streams if 1 instead of wx streams in some places. If
// disabled, wx streams are used everywhere and wxWidgets doesn't depend on the
// standard streams library.
// disabled, wx streams are used instead.
//
// Notice that enabling this does not replace wx streams with std streams
// everywhere, in a lot of places wx streams are used no matter what.
//
// Default is 1 if compiler supports it.
// Default is 1.
//
// Recommended setting: 1 if you use the standard streams anyhow and so
// dependency on the standard streams library is not a
// problem
#define wxUSE_STD_IOSTREAM wxUSE_STD_DEFAULT
// Enable minimal interoperability with the standard C++ string class if 1.
// "Minimal" means that wxString can be constructed from std::string or
// std::wstring but can't be implicitly converted to them. You need to enable
// the option below for the latter.
//
// Default is 1 for most compilers.
//
// Recommended setting: 1 unless you want to ensure your program doesn't use
// the standard C++ library at all.
#define wxUSE_STD_STRING wxUSE_STD_DEFAULT
// Recommended setting: 1.
#define wxUSE_STD_IOSTREAM 1
// Make wxString as much interchangeable with std::[w]string as possible, in
// particular allow implicit conversion of wxString to either of these classes.
// This comes at a price (or a benefit, depending on your point of view) of not
@ -354,6 +315,10 @@
// disabled by default but can be enabled for your build if you don't care
// about compatibility.
//
// Note that wxString can always be constructed from std::[w]string, whether
// this option is turned on or off, it only enables implicit conversion in the
// other direction.
//
// Default is 0 if wxUSE_STL has its default value or 1 if it is enabled.
//
// Recommended setting: 0 to remain compatible with the official builds of

View file

@ -596,15 +596,11 @@ private:
// -----------------------------------------------------------------------------
// Helper macro defining common iterator typedefs
#if wxUSE_STD_CONTAINERS_COMPATIBLY
#include <iterator>
#include <iterator>
#define WX_DECLARE_LIST_ITER_DIFF_AND_CATEGORY() \
typedef std::ptrdiff_t difference_type; \
typedef std::bidirectional_iterator_tag iterator_category;
#else
#define WX_DECLARE_LIST_ITER_DIFF_AND_CATEGORY()
#endif
#define WX_DECLARE_LIST_ITER_DIFF_AND_CATEGORY() \
typedef std::ptrdiff_t difference_type; \
typedef std::bidirectional_iterator_tag iterator_category;
// and now some heavy magic...

View file

@ -31,14 +31,4 @@ struct wxIsMovable
static const bool value = true; \
};
// Our implementation of wxString is written in such way that it's safe to move
// it around (unless position cache is used which unfortunately breaks this).
// OTOH, we don't know anything about std::string.
// (NB: we don't put this into string.h and choose to include wx/string.h from
// here instead so that rarely-used wxIsMovable<T> code isn't included by
// everything)
#if !wxUSE_STD_STRING && !wxUSE_STRING_POS_CACHE
WX_DECLARE_TYPE_MOVABLE(wxString)
#endif
#endif // _WX_META_MOVABLE_H_

View file

@ -284,35 +284,11 @@
//
// Default is 0
//
// Recommended setting: 0 as the options below already provide a relatively
// good level of interoperability and changing this option arguably isn't worth
// diverging from the official builds of the library.
// Recommended setting: 1 for new code bases and if compatibility with the
// official build of the library is not important, 0 otherwise.
#define wxUSE_STL 0
// This is not a real option but is used as the default value for
// wxUSE_STD_IOSTREAM, wxUSE_STD_STRING and wxUSE_STD_CONTAINERS_COMPATIBLY.
//
// Set it to 0 if you want to disable the use of all standard classes
// completely for some reason.
#define wxUSE_STD_DEFAULT 1
// Use standard C++ containers where it can be done without breaking backwards
// compatibility.
//
// This provides better interoperability with the standard library, e.g. with
// this option on it's possible to insert std::vector<> into many wxWidgets
// containers directly.
//
// Default is 1.
//
// Recommended setting is 1 unless you want to avoid all dependencies on the
// standard library.
#define wxUSE_STD_CONTAINERS_COMPATIBLY wxUSE_STD_DEFAULT
// Use standard C++ containers to implement wxVector<>, wxStack<>, wxDList<>
// and wxHashXXX<> classes. If disabled, wxWidgets own (mostly compatible but
// usually more limited) implementations are used which allows to avoid the
// dependency on the C++ run-time library.
// Use standard C++ containers to implement all wx container classes.
//
// Default is 0 for compatibility reasons.
//
@ -321,30 +297,15 @@
#define wxUSE_STD_CONTAINERS 0
// Use standard C++ streams if 1 instead of wx streams in some places. If
// disabled, wx streams are used everywhere and wxWidgets doesn't depend on the
// standard streams library.
// disabled, wx streams are used instead.
//
// Notice that enabling this does not replace wx streams with std streams
// everywhere, in a lot of places wx streams are used no matter what.
//
// Default is 1 if compiler supports it.
// Default is 1.
//
// Recommended setting: 1 if you use the standard streams anyhow and so
// dependency on the standard streams library is not a
// problem
#define wxUSE_STD_IOSTREAM wxUSE_STD_DEFAULT
// Enable minimal interoperability with the standard C++ string class if 1.
// "Minimal" means that wxString can be constructed from std::string or
// std::wstring but can't be implicitly converted to them. You need to enable
// the option below for the latter.
//
// Default is 1 for most compilers.
//
// Recommended setting: 1 unless you want to ensure your program doesn't use
// the standard C++ library at all.
#define wxUSE_STD_STRING wxUSE_STD_DEFAULT
// Recommended setting: 1.
#define wxUSE_STD_IOSTREAM 1
// Make wxString as much interchangeable with std::[w]string as possible, in
// particular allow implicit conversion of wxString to either of these classes.
// This comes at a price (or a benefit, depending on your point of view) of not
@ -354,6 +315,10 @@
// disabled by default but can be enabled for your build if you don't care
// about compatibility.
//
// Note that wxString can always be constructed from std::[w]string, whether
// this option is turned on or off, it only enables implicit conversion in the
// other direction.
//
// Default is 0 if wxUSE_STL has its default value or 1 if it is enabled.
//
// Recommended setting: 0 to remain compatible with the official builds of

View file

@ -290,35 +290,11 @@
//
// Default is 0
//
// Recommended setting: 0 as the options below already provide a relatively
// good level of interoperability and changing this option arguably isn't worth
// diverging from the official builds of the library.
// Recommended setting: 1 for new code bases and if compatibility with the
// official build of the library is not important, 0 otherwise.
#define wxUSE_STL 0
// This is not a real option but is used as the default value for
// wxUSE_STD_IOSTREAM, wxUSE_STD_STRING and wxUSE_STD_CONTAINERS_COMPATIBLY.
//
// Set it to 0 if you want to disable the use of all standard classes
// completely for some reason.
#define wxUSE_STD_DEFAULT 1
// Use standard C++ containers where it can be done without breaking backwards
// compatibility.
//
// This provides better interoperability with the standard library, e.g. with
// this option on it's possible to insert std::vector<> into many wxWidgets
// containers directly.
//
// Default is 1.
//
// Recommended setting is 1 unless you want to avoid all dependencies on the
// standard library.
#define wxUSE_STD_CONTAINERS_COMPATIBLY wxUSE_STD_DEFAULT
// Use standard C++ containers to implement wxVector<>, wxStack<>, wxDList<>
// and wxHashXXX<> classes. If disabled, wxWidgets own (mostly compatible but
// usually more limited) implementations are used which allows to avoid the
// dependency on the C++ run-time library.
// Use standard C++ containers to implement all wx container classes.
//
// Default is 0 for compatibility reasons.
//
@ -327,30 +303,15 @@
#define wxUSE_STD_CONTAINERS 0
// Use standard C++ streams if 1 instead of wx streams in some places. If
// disabled, wx streams are used everywhere and wxWidgets doesn't depend on the
// standard streams library.
// disabled, wx streams are used instead.
//
// Notice that enabling this does not replace wx streams with std streams
// everywhere, in a lot of places wx streams are used no matter what.
//
// Default is 1 if compiler supports it.
// Default is 1.
//
// Recommended setting: 1 if you use the standard streams anyhow and so
// dependency on the standard streams library is not a
// problem
#define wxUSE_STD_IOSTREAM wxUSE_STD_DEFAULT
// Enable minimal interoperability with the standard C++ string class if 1.
// "Minimal" means that wxString can be constructed from std::string or
// std::wstring but can't be implicitly converted to them. You need to enable
// the option below for the latter.
//
// Default is 1 for most compilers.
//
// Recommended setting: 1 unless you want to ensure your program doesn't use
// the standard C++ library at all.
#define wxUSE_STD_STRING wxUSE_STD_DEFAULT
// Recommended setting: 1.
#define wxUSE_STD_IOSTREAM 1
// Make wxString as much interchangeable with std::[w]string as possible, in
// particular allow implicit conversion of wxString to either of these classes.
// This comes at a price (or a benefit, depending on your point of view) of not
@ -360,6 +321,10 @@
// disabled by default but can be enabled for your build if you don't care
// about compatibility.
//
// Note that wxString can always be constructed from std::[w]string, whether
// this option is turned on or off, it only enables implicit conversion in the
// other direction.
//
// Default is 0 if wxUSE_STL has its default value or 1 if it is enabled.
//
// Recommended setting: 0 to remain compatible with the official builds of

View file

@ -280,35 +280,11 @@
//
// Default is 0
//
// Recommended setting: 0 as the options below already provide a relatively
// good level of interoperability and changing this option arguably isn't worth
// diverging from the official builds of the library.
// Recommended setting: 1 for new code bases and if compatibility with the
// official build of the library is not important, 0 otherwise.
#define wxUSE_STL 0
// This is not a real option but is used as the default value for
// wxUSE_STD_IOSTREAM, wxUSE_STD_STRING and wxUSE_STD_CONTAINERS_COMPATIBLY.
//
// Set it to 0 if you want to disable the use of all standard classes
// completely for some reason.
#define wxUSE_STD_DEFAULT 1
// Use standard C++ containers where it can be done without breaking backwards
// compatibility.
//
// This provides better interoperability with the standard library, e.g. with
// this option on it's possible to insert std::vector<> into many wxWidgets
// containers directly.
//
// Default is 1.
//
// Recommended setting is 1 unless you want to avoid all dependencies on the
// standard library.
#define wxUSE_STD_CONTAINERS_COMPATIBLY wxUSE_STD_DEFAULT
// Use standard C++ containers to implement wxVector<>, wxStack<>, wxDList<>
// and wxHashXXX<> classes. If disabled, wxWidgets own (mostly compatible but
// usually more limited) implementations are used which allows to avoid the
// dependency on the C++ run-time library.
// Use standard C++ containers to implement all wx container classes.
//
// Default is 0 for compatibility reasons.
//
@ -317,30 +293,15 @@
#define wxUSE_STD_CONTAINERS 0
// Use standard C++ streams if 1 instead of wx streams in some places. If
// disabled, wx streams are used everywhere and wxWidgets doesn't depend on the
// standard streams library.
// disabled, wx streams are used instead.
//
// Notice that enabling this does not replace wx streams with std streams
// everywhere, in a lot of places wx streams are used no matter what.
//
// Default is 1 if compiler supports it.
// Default is 1.
//
// Recommended setting: 1 if you use the standard streams anyhow and so
// dependency on the standard streams library is not a
// problem
#define wxUSE_STD_IOSTREAM wxUSE_STD_DEFAULT
// Enable minimal interoperability with the standard C++ string class if 1.
// "Minimal" means that wxString can be constructed from std::string or
// std::wstring but can't be implicitly converted to them. You need to enable
// the option below for the latter.
//
// Default is 1 for most compilers.
//
// Recommended setting: 1 unless you want to ensure your program doesn't use
// the standard C++ library at all.
#define wxUSE_STD_STRING wxUSE_STD_DEFAULT
// Recommended setting: 1.
#define wxUSE_STD_IOSTREAM 1
// Make wxString as much interchangeable with std::[w]string as possible, in
// particular allow implicit conversion of wxString to either of these classes.
// This comes at a price (or a benefit, depending on your point of view) of not
@ -350,6 +311,10 @@
// disabled by default but can be enabled for your build if you don't care
// about compatibility.
//
// Note that wxString can always be constructed from std::[w]string, whether
// this option is turned on or off, it only enables implicit conversion in the
// other direction.
//
// Default is 0 if wxUSE_STL has its default value or 1 if it is enabled.
//
// Recommended setting: 0 to remain compatible with the official builds of

View file

@ -283,35 +283,11 @@
//
// Default is 0
//
// Recommended setting: 0 as the options below already provide a relatively
// good level of interoperability and changing this option arguably isn't worth
// diverging from the official builds of the library.
// Recommended setting: 1 for new code bases and if compatibility with the
// official build of the library is not important, 0 otherwise.
#define wxUSE_STL 0
// This is not a real option but is used as the default value for
// wxUSE_STD_IOSTREAM, wxUSE_STD_STRING and wxUSE_STD_CONTAINERS_COMPATIBLY.
//
// Set it to 0 if you want to disable the use of all standard classes
// completely for some reason.
#define wxUSE_STD_DEFAULT 1
// Use standard C++ containers where it can be done without breaking backwards
// compatibility.
//
// This provides better interoperability with the standard library, e.g. with
// this option on it's possible to insert std::vector<> into many wxWidgets
// containers directly.
//
// Default is 1.
//
// Recommended setting is 1 unless you want to avoid all dependencies on the
// standard library.
#define wxUSE_STD_CONTAINERS_COMPATIBLY wxUSE_STD_DEFAULT
// Use standard C++ containers to implement wxVector<>, wxStack<>, wxDList<>
// and wxHashXXX<> classes. If disabled, wxWidgets own (mostly compatible but
// usually more limited) implementations are used which allows to avoid the
// dependency on the C++ run-time library.
// Use standard C++ containers to implement all wx container classes.
//
// Default is 0 for compatibility reasons.
//
@ -320,30 +296,15 @@
#define wxUSE_STD_CONTAINERS 0
// Use standard C++ streams if 1 instead of wx streams in some places. If
// disabled, wx streams are used everywhere and wxWidgets doesn't depend on the
// standard streams library.
// disabled, wx streams are used instead.
//
// Notice that enabling this does not replace wx streams with std streams
// everywhere, in a lot of places wx streams are used no matter what.
//
// Default is 1 if compiler supports it.
// Default is 1.
//
// Recommended setting: 1 if you use the standard streams anyhow and so
// dependency on the standard streams library is not a
// problem
#define wxUSE_STD_IOSTREAM wxUSE_STD_DEFAULT
// Enable minimal interoperability with the standard C++ string class if 1.
// "Minimal" means that wxString can be constructed from std::string or
// std::wstring but can't be implicitly converted to them. You need to enable
// the option below for the latter.
//
// Default is 1 for most compilers.
//
// Recommended setting: 1 unless you want to ensure your program doesn't use
// the standard C++ library at all.
#define wxUSE_STD_STRING wxUSE_STD_DEFAULT
// Recommended setting: 1.
#define wxUSE_STD_IOSTREAM 1
// Make wxString as much interchangeable with std::[w]string as possible, in
// particular allow implicit conversion of wxString to either of these classes.
// This comes at a price (or a benefit, depending on your point of view) of not
@ -353,6 +314,10 @@
// disabled by default but can be enabled for your build if you don't care
// about compatibility.
//
// Note that wxString can always be constructed from std::[w]string, whether
// this option is turned on or off, it only enables implicit conversion in the
// other direction.
//
// Default is 0 if wxUSE_STL has its default value or 1 if it is enabled.
//
// Recommended setting: 0 to remain compatible with the official builds of

View file

@ -231,7 +231,6 @@ public:
inline operator wxString () const { return MakeString(); }
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
@ -251,7 +250,6 @@ public:
wxVariant& operator=(const std::wstring& value)
{ return operator=(wxString(value)); }
operator std::wstring() const { return (operator wxString()).ToStdWstring(); }
#endif // wxUSE_STD_STRING
// wxUniChar
wxVariant(const wxUniChar& val, const wxString& name = wxEmptyString);

View file

@ -174,16 +174,9 @@
#define wxUSE_STL 0
#define wxUSE_STD_DEFAULT 0
#define wxUSE_STD_CONTAINERS_COMPATIBLY wxUSE_STD_DEFAULT
#define wxUSE_STD_CONTAINERS 0
#define wxUSE_STD_IOSTREAM wxUSE_STD_DEFAULT
#define wxUSE_STD_STRING wxUSE_STD_DEFAULT
#define wxUSE_STD_IOSTREAM 0
#define wxUSE_STD_STRING_CONV_IN_WXSTRING wxUSE_STL

View file

@ -218,20 +218,7 @@ typedef pid_t GPid;
#define wxUSE_STL 0
#if defined(__DMC__) \
|| (defined(_MSC_VER) && _MSC_VER < 1200)
#define wxUSE_STD_DEFAULT 0
#else
#define wxUSE_STD_DEFAULT 1
#endif
#define wxUSE_STD_CONTAINERS_COMPATIBLY wxUSE_STD_DEFAULT
#define wxUSE_STD_CONTAINERS wxUSE_STD_DEFAULT
#define wxUSE_STD_IOSTREAM wxUSE_STD_DEFAULT
#define wxUSE_STD_STRING wxUSE_STD_DEFAULT
#define wxUSE_STD_CONTAINERS wxUSE_STL
#define wxUSE_STD_STRING_CONV_IN_WXSTRING wxUSE_STL

View file

@ -969,7 +969,6 @@ wxVariant::wxVariant(const wxScopedWCharBuffer& val, const wxString& name)
m_name = name;
}
#if wxUSE_STD_STRING
wxVariant::wxVariant(const std::string& val, const wxString& name)
{
m_refData = new wxVariantDataString(wxString(val));
@ -981,7 +980,6 @@ wxVariant::wxVariant(const std::wstring& val, const wxString& name)
m_refData = new wxVariantDataString(wxString(val));
m_name = name;
}
#endif // wxUSE_STD_STRING
bool wxVariant::operator== (const wxString& value) const
{

View file

@ -468,87 +468,56 @@ wxDbgHelpDLL::DumpUDT(wxPSYMBOL_INFO pSym, void *pVariable, unsigned level)
s.reserve(512);
s = GetSymbolName(pSym);
#if !wxUSE_STD_STRING
// special handling for ubiquitous wxString: although the code below works
// for it as well, it shows the wxStringBase class and takes 4 lines
// instead of only one as this branch
if ( s == wxT("wxString") )
// Determine how many children this type has.
DWORD dwChildrenCount = 0;
DoGetTypeInfo(pSym, TI_GET_CHILDRENCOUNT, &dwChildrenCount);
// Prepare to get an array of "TypeIds", representing each of the children.
TI_FINDCHILDREN_PARAMS *children = (TI_FINDCHILDREN_PARAMS *)
malloc(sizeof(TI_FINDCHILDREN_PARAMS) +
(dwChildrenCount - 1)*sizeof(ULONG));
if ( !children )
return s;
children->Count = dwChildrenCount;
children->Start = 0;
// Get the array of TypeIds, one for each child type
if ( !DoGetTypeInfo(pSym, TI_FINDCHILDREN, children) )
{
wxString *ps = (wxString *)pVariable;
// we can't just dump wxString directly as it could be corrupted or
// invalid and it could also be locked for writing (i.e. if we're
// between GetWriteBuf() and UngetWriteBuf() calls) and assert when we
// try to access it contents using public methods, so instead use our
// knowledge of its internals
const wxChar *p = nullptr;
if ( !::IsBadReadPtr(ps, sizeof(wxString)) )
{
p = ps->data();
wxStringData *data = (wxStringData *)p - 1;
if ( ::IsBadReadPtr(data, sizeof(wxStringData)) ||
::IsBadReadPtr(p, sizeof(wxChar *)*data->nAllocLength) )
{
p = nullptr; // don't touch this pointer with 10 feet pole
}
}
s << wxT("(\"") << (p ? p : wxT("???")) << wxT(")\"");
}
else // any other UDT
#endif // !wxUSE_STD_STRING
{
// Determine how many children this type has.
DWORD dwChildrenCount = 0;
DoGetTypeInfo(pSym, TI_GET_CHILDRENCOUNT, &dwChildrenCount);
// Prepare to get an array of "TypeIds", representing each of the children.
TI_FINDCHILDREN_PARAMS *children = (TI_FINDCHILDREN_PARAMS *)
malloc(sizeof(TI_FINDCHILDREN_PARAMS) +
(dwChildrenCount - 1)*sizeof(ULONG));
if ( !children )
return s;
children->Count = dwChildrenCount;
children->Start = 0;
// Get the array of TypeIds, one for each child type
if ( !DoGetTypeInfo(pSym, TI_FINDCHILDREN, children) )
{
free(children);
return s;
}
s << wxT(" {\n");
// Iterate through all children
wxSYMBOL_INFO sym;
wxZeroMemory(sym);
sym.ModBase = pSym->ModBase;
for ( unsigned i = 0; i < dwChildrenCount; i++ )
{
sym.TypeIndex = children->ChildId[i];
// children here are in lexicographic sense, i.e. we get all our nested
// classes and not only our member fields, but we can't get the values
// for the members of the nested classes, of course!
DWORD nested;
if ( DoGetTypeInfo(&sym, TI_GET_NESTED, &nested) && nested )
continue;
// avoid infinite recursion: this does seem to happen sometimes with
// complex typedefs...
if ( sym.TypeIndex == pSym->TypeIndex )
continue;
s += DumpField(&sym, pVariable, level + 1);
}
free(children);
s << wxString(wxT('\t'), level + 1) << wxT('}');
return s;
}
s << wxT(" {\n");
// Iterate through all children
wxSYMBOL_INFO sym;
wxZeroMemory(sym);
sym.ModBase = pSym->ModBase;
for ( unsigned i = 0; i < dwChildrenCount; i++ )
{
sym.TypeIndex = children->ChildId[i];
// children here are in lexicographic sense, i.e. we get all our nested
// classes and not only our member fields, but we can't get the values
// for the members of the nested classes, of course!
DWORD nested;
if ( DoGetTypeInfo(&sym, TI_GET_NESTED, &nested) && nested )
continue;
// avoid infinite recursion: this does seem to happen sometimes with
// complex typedefs...
if ( sym.TypeIndex == pSym->TypeIndex )
continue;
s += DumpField(&sym, pVariable, level + 1);
}
free(children);
s << wxString(wxT('\t'), level + 1) << wxT('}');
return s;
}

View file

@ -34,12 +34,6 @@
#include "wx/scopedarray.h"
#include "wx/dcbuffer.h"
#if !wxUSE_STD_CONTAINERS && !wxUSE_STD_IOSTREAM && !wxUSE_STD_STRING
#include "wx/beforestd.h"
#include <string>
#include "wx/afterstd.h"
#endif
#include "ScintillaWX.h"
#include "wx/stc/stc.h"
#include "wx/stc/private.h"

View file

@ -253,8 +253,6 @@ TEST_CASE("wxWindowList::Find", "[list]")
CHECK( it == l.GetFirst() );
}
#if wxUSE_STD_CONTAINERS_COMPATIBLY
#include <list>
// Check that we convert wxList to std::list using the latter's ctor taking 2
@ -275,5 +273,3 @@ TEST_CASE("wxList::iterator", "[list][std][iterator]")
const wxListBazs cli;
CHECK( std::list<Baz*>(cli.begin(), cli.end()).empty() );
}
#endif // wxUSE_STD_CONTAINERS_COMPATIBLY

View file

@ -520,7 +520,6 @@ TEST_CASE("StdString::Substr", "[stdstring]")
CHECK( s1.substr( 17, 30 ) == wxT("") );
}
#if wxUSE_STD_STRING
TEST_CASE("StdString::Conversion", "[stdstring]")
{
std::string strStd("std::string value");
@ -575,7 +574,6 @@ TEST_CASE("StdString::Conversion", "[stdstring]")
CHECK( wxString("bye").utf8_string() == std::string("bye") );
}
#endif // wxUSE_STD_STRING
TEST_CASE("StdString::Algo", "[stdstring]")
{

View file

@ -122,7 +122,6 @@ TEST_CASE("SizetPrintf", "[wxString][Printf][vararg]")
== "size_t=0xA0" );
}
#if wxUSE_STD_STRING
TEST_CASE("StdString", "[wxString][Printf][vararg]")
{
// test passing std::[w]string
@ -137,7 +136,6 @@ TEST_CASE("StdString", "[wxString][Printf][vararg]")
s.Printf("string %s(%i).", wc, 2);
CHECK( s == "string widechar(2)." );
}
#endif // wxUSE_STD_STRING
#if wxUSE_LONGLONG
TEST_CASE("LongLongPrintf", "[wxString][Printf][vararg]")