X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c9f7896861f734ce044ee8601ba2d8a6959c9d9e..59953bf4ba167311fb0cd2c2c0f3d5d0475b98c8:/include/wx/strvararg.h?ds=inline diff --git a/include/wx/strvararg.h b/include/wx/strvararg.h index fd7301603a..55eb9c01f2 100644 --- a/include/wx/strvararg.h +++ b/include/wx/strvararg.h @@ -16,13 +16,7 @@ #error "OpenWatcom version >= 1.4 is required to compile this code" #endif -// include wchar_t definition if needed: -#if defined(__WATCOMC__) -#include -#elif defined(__VISUALC__) -#include -#endif - +#include "wx/chartype.h" class WXDLLIMPEXP_BASE wxCStrData; class WXDLLIMPEXP_BASE wxString; @@ -95,27 +89,11 @@ struct wxArgNormalizer // special cases for converting strings: -// FIXME-UTF8: move this to wxchartype.h! -#if wxUSE_UNICODE - /* for now, all Unicode builds are wchar_t* based: */ - #define wxUSE_UNICODE_WCHAR 1 -#else - #define wxUSE_UNICODE_WCHAR 0 -#endif - -// FIXME-UTF8: include wx/wxchartype.h and use wxChar after headers split -// FIXME-UTF8: this will be char* in UTF-8 build and wchar_t* on Windows -#if wxUSE_UNICODE_WCHAR - typedef wchar_t wxArgNativeCharType; -#else - typedef char wxArgNativeCharType; -#endif - template<> struct WXDLLIMPEXP_BASE wxArgNormalizer { wxArgNormalizer(const wxCStrData& value) : m_value(value) {} - const wxArgNativeCharType *get() const; + const wxChar *get() const; // FIXME-UTF8: should be wxStringCharType const wxCStrData& m_value; }; @@ -131,7 +109,7 @@ template<> struct WXDLLIMPEXP_BASE wxArgNormalizer { wxArgNormalizer(const wxString& value) : m_value(value) {} - const wxArgNativeCharType *get() const; + const wxChar *get() const; // FIXME-UTF8: should be wxStringCharType const wxString& m_value; }; @@ -143,8 +121,7 @@ struct wxArgNormalizer : public wxArgNormalizer : wxArgNormalizer(value) {} }; -#if wxUSE_UNICODE_WCHAR - +#if wxUSE_UNICODE // FIXME-UTF8: should be wxUSE_UNICODE_WCHAR template<> struct WXDLLIMPEXP_BASE wxArgNormalizer { @@ -161,9 +138,30 @@ struct wxArgNormalizer : public wxArgNormalizer wxArgNormalizer(char *value) : wxArgNormalizer(value) {} }; +#endif // wxUSE_UNICODE_WCHAR + +// FIXME-UTF8 +#if 0 // wxUSE_UNICODE_UTF8 +// for conversion from local charset to UTF-8 +template<> +struct WXDLLIMPEXP_BASE wxArgNormalizer +{ + wxArgNormalizer(const char *value); + ~wxArgNormalizer(); + const char *get() const; + + wxCharBuffer *m_value; +}; -#elif wxUSE_WCHAR_T // !wxUSE_UNICODE_WCHAR && wxUSE_WCHAR_T +template<> +struct wxArgNormalizer : public wxArgNormalizer +{ + wxArgNormalizer(char *value) + : wxArgNormalizer(value) {} +}; +#endif // wxUSE_UNICODE_UTF8 +#if /*wxUSE_UNICODE_UTF8 || */ !wxUSE_UNICODE // FIXME-UTF8 template<> struct WXDLLIMPEXP_BASE wxArgNormalizer { @@ -180,8 +178,24 @@ struct wxArgNormalizer : public wxArgNormalizer wxArgNormalizer(wchar_t *value) : wxArgNormalizer(value) {} }; +#endif // wxUSE_UNICODE_UTF8 || !wxUSE_UNICODE + +// versions for passing wx[W]CharBuffer: +template<> +struct WXDLLIMPEXP_BASE wxArgNormalizer + : public wxArgNormalizer +{ + wxArgNormalizer(const wxCharBuffer& buf); +}; + +template<> +struct WXDLLIMPEXP_BASE wxArgNormalizer + : public wxArgNormalizer +{ + wxArgNormalizer(const wxWCharBuffer& buf); +}; + -#endif // wxUSE_UNICODE_WCHAR / !wxUSE_UNICODE_WCHAR && wxUSE_WCHAR_T // NB: The vararg emulation code is limited to 30 arguments at the moment. // If you need more, you need to