From 414b7b40164c4b146c4518d4873cbee9570a222e Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 19 Mar 2007 13:18:02 +0000 Subject: [PATCH] added ctor for wxChar/WCharBuffer from wxCStrData in ANSI/Unicode build to make it possible to compile code like "wxCharBuffer buf = s.c_str()" again (in particular, fixes wxGTK1 compilation) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44924 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/buffer.h | 2 ++ include/wx/string.h | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/include/wx/buffer.h b/include/wx/buffer.h index f17aa0c1ab..55068fb0cb 100644 --- a/include/wx/buffer.h +++ b/include/wx/buffer.h @@ -30,6 +30,8 @@ public: \ { \ } \ \ + classname(const wxCStrData& cstr); \ + \ classname(size_t len) \ : m_str((chartype *)malloc((len + 1)*sizeof(chartype))) \ { \ diff --git a/include/wx/string.h b/include/wx/string.h index 8485ea1aad..90d3b378f2 100644 --- a/include/wx/string.h +++ b/include/wx/string.h @@ -2013,4 +2013,24 @@ inline wxUniChar wxCStrData::operator[](size_t n) const return m_str->at(m_offset + n); } +// ---------------------------------------------------------------------------- +// implementation of wx[W]CharBuffer inline methods using wxCStrData +// ---------------------------------------------------------------------------- + +#if wxUSE_UNICODE + +inline wxWCharBuffer::wxWCharBuffer(const wxCStrData& cstr) + : m_str(wxStrdupW(cstr)) +{ +} + +#else // !wxUSE_UNICODE + +inline wxCharBuffer::wxCharBuffer(const wxCStrData& cstr) + : m_str(wxStrdupA(cstr)) +{ +} + +#endif // wxUSE_UNICODE/!wxUSE_UNICODE + #endif // _WX_WXSTRINGH__ -- 2.45.2