X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/681e44128670bd58c09ff9b42af52666635b19a6..472eec8a0391538e4dcf7f7c6c4f4d44c8383616:/include/wx/buffer.h diff --git a/include/wx/buffer.h b/include/wx/buffer.h index 7f61793f04..bfaba4e58d 100644 --- a/include/wx/buffer.h +++ b/include/wx/buffer.h @@ -12,14 +12,12 @@ #ifndef _WX_BUFFER_H #define _WX_BUFFER_H -#include "wx/wxchar.h" +#include "wx/chartype.h" +#include "wx/wxcrtbase.h" #include // malloc() and free() -inline char *wxStrDup(const char *s) { return wxStrdupA(s); } -#if wxUSE_WCHAR_T - inline wchar_t *wxStrDup(const wchar_t *ws) { return wxStrdupW(ws); } -#endif +class WXDLLIMPEXP_FWD_BASE wxCStrData; // ---------------------------------------------------------------------------- // Special classes for (wide) character strings: they use malloc/free instead @@ -27,13 +25,13 @@ inline char *wxStrDup(const char *s) { return wxStrdupA(s); } // ---------------------------------------------------------------------------- template -class wxCharTypeBuffer +class WXDLLIMPEXP_BASE wxCharTypeBuffer { public: typedef T CharType; wxCharTypeBuffer(const CharType *str = NULL) - : m_str(str ? wxStrDup(str) : NULL), + : m_str(str ? wxStrdup(str) : NULL), m_owned(true) { } @@ -100,7 +98,7 @@ public: { if ( m_owned ) free(m_str); - m_str = str ? wxStrDup(str) : NULL; + m_str = str ? wxStrdup(str) : NULL; m_owned = true; return *this; } @@ -152,6 +150,8 @@ private: bool m_owned; }; +WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE( wxCharTypeBuffer ) + class WXDLLIMPEXP_BASE wxCharBuffer : public wxCharTypeBuffer { public: @@ -167,6 +167,8 @@ public: }; #if wxUSE_WCHAR_T +WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE( wxCharTypeBuffer ) + class WXDLLIMPEXP_BASE wxWCharBuffer : public wxCharTypeBuffer { public: @@ -224,6 +226,13 @@ typedef wxWritableCharTypeBuffer wxWritableWCharBuffer; #define wxWX2WCbuf wxWCharBuffer #endif // Unicode/ANSI +// type of the value returned by wxString::utf8_str() +#if wxUSE_UNICODE_UTF8 + #define wxUTF8Buf wxCharBuffer +#else + #define wxUTF8Buf char * +#endif + // ---------------------------------------------------------------------------- // A class for holding growable data buffers (not necessarily strings) // ---------------------------------------------------------------------------- @@ -286,7 +295,7 @@ private: }; -class wxMemoryBuffer +class WXDLLIMPEXP_BASE wxMemoryBuffer { public: // ctor and dtor