added char_str() and wchar_str() methods to wxString for obtaining char*/wchar_t* pointers

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45175 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2007-03-30 20:09:02 +00:00
parent 6af350d428
commit ef0f138756
5 changed files with 123 additions and 11 deletions

View File

@@ -146,6 +146,27 @@ public:
};
#endif // wxUSE_WCHAR_T
// wxCharTypeBuffer<T> implicitly convertible to T*
template <typename T>
class wxWritableCharTypeBuffer : wxCharTypeBuffer<T>
{
public:
typedef typename wxCharTypeBuffer<T>::CharType CharType;
wxWritableCharTypeBuffer(const wxCharTypeBuffer<T>& src)
: wxCharTypeBuffer<T>(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<T>(str) {}
operator CharType*() { return this->data(); }
};
typedef wxWritableCharTypeBuffer<char> wxWritableCharBuffer;
typedef wxWritableCharTypeBuffer<wchar_t> wxWritableWCharBuffer;
#if wxUSE_UNICODE
#define wxWxCharBuffer wxWCharBuffer