From 4f29051b4e53fd2265005d4ec6bf727abd32493a Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 7 May 2008 00:46:45 +0000 Subject: [PATCH] use std::[w]string for wxString implementation unless wxUSE_STD_STRING==0 but even if wxUSE_STL==1 git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53475 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 2 ++ docs/doxygen/mainpages/const_wxusedef.h | 5 +++-- include/wx/stringimpl.h | 13 ++++++++++++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index d2fb60c611..f61638fcbd 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -241,6 +241,8 @@ All: - Added wxON_BLOCK_EXIT_SET() and wxON_BLOCK_EXIT_NULL() to wx/scopeguard.h. - Added wxEvtHandler::QueueEvent() replacing AddPendingEvent() and wxQueueEvent() replacing wxPostEvent(). +- wxString now uses std::[w]string internally by default, meaning that it is + now thread-safe if the standard library provided with your compiler is. All (Unix): diff --git a/docs/doxygen/mainpages/const_wxusedef.h b/docs/doxygen/mainpages/const_wxusedef.h index 93bb092f42..d80ac6aa89 100644 --- a/docs/doxygen/mainpages/const_wxusedef.h +++ b/docs/doxygen/mainpages/const_wxusedef.h @@ -41,10 +41,11 @@ 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_STD_STRING, wxString can be constructed from std::string (but - provides wxWidgets-compatible API).} @itemdef{wxUSE_UNICODE, Compiled with Unicode support (default in wxWidgets 3.0, non-Unicode build will be deprecated in the future).} @itemdef{wxUSE_UNICODE_WCHAR, wxString uses wchar_t buffer for internal storage diff --git a/include/wx/stringimpl.h b/include/wx/stringimpl.h index 7a9adb99bf..f3cd17cec2 100644 --- a/include/wx/stringimpl.h +++ b/include/wx/stringimpl.h @@ -53,7 +53,18 @@ extern WXDLLIMPEXP_DATA_BASE(const wxStringCharType*) wxEmptyStringImpl; // deal with STL/non-STL/non-STL-but-wxUSE_STD_STRING // ---------------------------------------------------------------------------- -#define wxUSE_STL_BASED_WXSTRING wxUSE_STL +// using STL implies using std::string +#if wxUSE_STL + #undef wxUSE_STD_STRING + #define wxUSE_STD_STRING 1 +#endif + +// we use STL-based string internally if we use std::string at all now, there +// should be no reason to prefer our internal implement but if you really need +// it you can predefine wxUSE_STL_BASED_WXSTRING as 0 when building the library +#ifndef wxUSE_STL_BASED_WXSTRING + #define wxUSE_STL_BASED_WXSTRING wxUSE_STD_STRING +#endif // in both cases we need to define wxStdString #if wxUSE_STL_BASED_WXSTRING || wxUSE_STD_STRING