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__