added wxString::[w]char_str() to 2.8 for forward compatibility with wx3

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@45213 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2007-04-02 12:25:40 +00:00
parent 3646999e0c
commit 89b6915f14
6 changed files with 93 additions and 3 deletions

View File

@@ -111,15 +111,29 @@ private: \
chartype *m_str; \
}
// needed for wxString::char_str() and wchar_str()
#define DEFINE_WRITABLE_BUFFER(classname, baseclass, chartype) \
class WXDLLIMPEXP_BASE classname : public baseclass \
{ \
public: \
classname(const baseclass& src) : baseclass(src) {} \
classname(const chartype *str = NULL) : baseclass(str) {} \
\
operator chartype*() { return this->data(); } \
}
DEFINE_BUFFER(wxCharBuffer, char, wxStrdupA);
DEFINE_WRITABLE_BUFFER(wxWritableCharBuffer, wxCharBuffer, char);
#if wxUSE_WCHAR_T
DEFINE_BUFFER(wxWCharBuffer, wchar_t, wxStrdupW);
DEFINE_WRITABLE_BUFFER(wxWritableWCharBuffer, wxWCharBuffer, wchar_t);
#endif // wxUSE_WCHAR_T
#undef DEFINE_BUFFER
#undef DEFINE_WRITABLE_BUFFER
#if wxUSE_UNICODE
typedef wxWCharBuffer wxWxCharBuffer;