From: Václav Slavík Date: Sun, 29 Apr 2007 08:04:58 +0000 (+0000) Subject: added support for passing std::[w]string to 'vararg' templates X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/564a5bbe57f20d9f42ddf2a13f2fcae49c4179d9 added support for passing std::[w]string to 'vararg' templates git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45710 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/strvararg.h b/include/wx/strvararg.h index 459c0ffeec..1077ac301f 100644 --- a/include/wx/strvararg.h +++ b/include/wx/strvararg.h @@ -320,6 +320,53 @@ WX_ARG_NORMALIZER_FORWARD(const wxCharBuffer&, const char*); WX_ARG_NORMALIZER_FORWARD(wxWCharBuffer, const wchar_t*); WX_ARG_NORMALIZER_FORWARD(const wxWCharBuffer&, const wchar_t*); +// versions for std::[w]string: +#if wxUSE_STD_STRING + +#include "wx/stringimpl.h" + +#if !wxUSE_UTF8_LOCALE_ONLY +template<> +struct wxArgNormalizerWchar + : public wxArgNormalizerWchar +{ + wxArgNormalizerWchar(const std::string& s) + : wxArgNormalizerWchar(s.c_str()) {} +}; + +template<> +struct wxArgNormalizerWchar + : public wxArgNormalizerWchar +{ + wxArgNormalizerWchar(const wxStdWideString& s) + : wxArgNormalizerWchar(s.c_str()) {} +}; +#endif // !wxUSE_UTF8_LOCALE_ONLY + +#if wxUSE_UNICODE_UTF8 +template<> +struct wxArgNormalizerUtf8 + : public wxArgNormalizerUtf8 +{ + wxArgNormalizerUtf8(const std::string& s) + : wxArgNormalizerUtf8(s.c_str()) {} +}; + +template<> +struct wxArgNormalizerUtf8 + : public wxArgNormalizerUtf8 +{ + wxArgNormalizerUtf8(const wxStdWideString& s) + : wxArgNormalizerUtf8(s.c_str()) {} +}; +#endif // wxUSE_UNICODE_UTF8 + +WX_ARG_NORMALIZER_FORWARD(std::string, const std::string&); +WX_ARG_NORMALIZER_FORWARD(wxStdWideString, const wxStdWideString&); + +#endif // wxUSE_STD_STRING + + #undef WX_ARG_NORMALIZER_FORWARD #undef _WX_ARG_NORMALIZER_FORWARD_IMPL