X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/39c20230ba7ca49fbdfd7c558b4669ddc15ba4aa..333e57d578e9e0fb6555452b5a53698ffd85ee69:/include/wx/string.h diff --git a/include/wx/string.h b/include/wx/string.h index 04483f3e12..b6002fd5aa 100644 --- a/include/wx/string.h +++ b/include/wx/string.h @@ -59,7 +59,7 @@ #include "wx/stringops.h" #include "wx/unichar.h" -class WXDLLIMPEXP_BASE wxString; +class WXDLLIMPEXP_FWD_BASE wxString; // unless this symbol is predefined to disable the compatibility functions, do // use them @@ -276,7 +276,7 @@ private: size_t m_offset; bool m_owned; - friend class WXDLLIMPEXP_BASE wxString; + friend class WXDLLIMPEXP_FWD_BASE wxString; }; // ---------------------------------------------------------------------------- @@ -652,13 +652,13 @@ public: /* for internal wxString use only: */ \ underlying_iterator impl() const { return m_cur; } \ \ - friend class WXDLLIMPEXP_BASE wxString; \ - friend class WXDLLIMPEXP_BASE wxCStrData; \ + friend class wxString; \ + friend class wxCStrData; \ \ private: \ underlying_iterator m_cur - class WXDLLIMPEXP_BASE const_iterator; + class WXDLLIMPEXP_FWD_BASE const_iterator; #if wxUSE_UNICODE_UTF8 // NB: In UTF-8 build, (non-const) iterator needs to keep reference @@ -1202,17 +1202,20 @@ public: // implicit conversion to C string operator wxCStrData() const { return c_str(); } - // these operators conflict with operators for conversion to std::string, - // so they must be disabled in STL build: + // the first two operators conflict with operators for conversion to + // std::string and they must be disabled in STL build; the next one only + // makes sense if conversions to char* are also defined and not defining it + // in STL build also helps us to get more clear error messages for the code + // which relies on implicit conversion to char* in STL build #if !wxUSE_STL operator const char*() const { return c_str(); } operator const wchar_t*() const { return c_str(); } -#endif // implicit conversion to untyped pointer for compatibility with previous // wxWidgets versions: this is the same as conversion to const char * so it // may fail! operator const void*() const { return c_str(); } +#endif // wxUSE_STL // identical to c_str(), for MFC compatibility const wxCStrData GetData() const { return c_str(); } @@ -2627,11 +2630,11 @@ private: wxStringIteratorNodeHead m_iterators; - friend class WXDLLIMPEXP_BASE wxStringIteratorNode; - friend class WXDLLIMPEXP_BASE wxUniCharRef; + friend class WXDLLIMPEXP_FWD_BASE wxStringIteratorNode; + friend class WXDLLIMPEXP_FWD_BASE wxUniCharRef; #endif // wxUSE_UNICODE_UTF8 - friend class WXDLLIMPEXP_BASE wxCStrData; + friend class WXDLLIMPEXP_FWD_BASE wxCStrData; friend class wxImplStringBuffer; friend class wxImplStringBufferLength; }; @@ -3010,7 +3013,7 @@ inline wxCStrData::wxCStrData(const wxCStrData& data) inline wxCStrData::~wxCStrData() { if ( m_owned ) - delete m_str; + delete wx_const_cast(wxString*, m_str); // cast to silence warnings } // simple cases for AsChar() and AsWChar(), the complicated ones are @@ -3126,7 +3129,7 @@ void wxStringIteratorNode::DoSet(const wxString *str, wxStringImpl::const_iterator *citer, wxStringImpl::iterator *iter) { - m_next = m_prev = NULL; + m_prev = NULL; m_iter = iter; m_citer = citer; m_str = str; @@ -3137,6 +3140,10 @@ void wxStringIteratorNode::DoSet(const wxString *str, if ( m_next ) m_next->m_prev = this; } + else + { + m_next = NULL; + } } void wxStringIteratorNode::clear()