X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/012286eb3b9e05c15c1f7732c141b61d3ebb2524..e93a3a18fc35386cfb04a1f4e73cddfb8ae33315:/src/common/string.cpp diff --git a/src/common/string.cpp b/src/common/string.cpp index d97e47a0d1..f8d1fc4594 100644 --- a/src/common/string.cpp +++ b/src/common/string.cpp @@ -1536,8 +1536,34 @@ int wxString::sprintf(const wxChar *pszFormat, ...) // --------------------------------------------------------------------------- // standard C++ library string functions // --------------------------------------------------------------------------- + #ifdef wxSTD_STRING_COMPATIBILITY +void wxString::resize(size_t nSize, wxChar ch) +{ + size_t len = length(); + + if ( nSize < len ) + { + Truncate(nSize); + } + else if ( nSize > len ) + { + *this += wxString(ch, len - nSize); + } + //else: we have exactly the specified length, nothing to do +} + +void wxString::swap(wxString& str) +{ + // this is slightly less efficient than fiddling with m_pchData directly, + // but it is still quite efficient as we don't copy the string here because + // ref count always stays positive + wxString tmp = str; + str = *this; + *this = str; +} + wxString& wxString::insert(size_t nPos, const wxString& str) { wxASSERT( str.GetStringData()->IsValid() );