X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ccd4deab6b05e27b3275dda38bec124300436480..9aee0061fe0efe24cc3ece104a9370599086ea04:/include/wx/buffer.h diff --git a/include/wx/buffer.h b/include/wx/buffer.h index c9232820fe..59a7ad6c35 100644 --- a/include/wx/buffer.h +++ b/include/wx/buffer.h @@ -126,9 +126,7 @@ public: wxCharBuffer(const CharType *str = NULL) : wxCharTypeBufferBase(str) {} wxCharBuffer(size_t len) : wxCharTypeBufferBase(len) {} -#if !wxUSE_UNICODE wxCharBuffer(const wxCStrData& cstr); -#endif }; #if wxUSE_WCHAR_T @@ -140,12 +138,31 @@ public: wxWCharBuffer(const CharType *str = NULL) : wxCharTypeBufferBase(str) {} wxWCharBuffer(size_t len) : wxCharTypeBufferBase(len) {} -#if wxUSE_UNICODE wxWCharBuffer(const wxCStrData& cstr); -#endif }; #endif // wxUSE_WCHAR_T +// wxCharTypeBuffer implicitly convertible to T* +template +class wxWritableCharTypeBuffer : public wxCharTypeBuffer +{ +public: + typedef typename wxCharTypeBuffer::CharType CharType; + + wxWritableCharTypeBuffer(const wxCharTypeBuffer& src) + : wxCharTypeBuffer(src) {} + // FIXME-UTF8: this won't be needed after converting mb_str()/wc_str() to + // always return a buffer + wxWritableCharTypeBuffer(const CharType *str = NULL) + : wxCharTypeBuffer(str) {} + + operator CharType*() { return this->data(); } +}; + +typedef wxWritableCharTypeBuffer wxWritableCharBuffer; +typedef wxWritableCharTypeBuffer wxWritableWCharBuffer; + + #if wxUSE_UNICODE #define wxWxCharBuffer wxWCharBuffer