+// versions for wxUniChar, wxUniCharRef:
+// (this is same for UTF-8 and Wchar builds, we just convert to wchar_t)
+template<>
+struct wxArgNormalizer<const wxUniChar&> : public wxArgNormalizer<wchar_t>
+{
+ wxArgNormalizer(const wxUniChar& s,
+ const wxFormatString *fmt, unsigned index)
+ : wxArgNormalizer<wchar_t>(s.GetValue(), fmt, index) {}
+};
+
+// for wchar_t, default handler does the right thing
+
+// char has to be treated differently in Unicode builds: a char argument may
+// be used either for a character value (which should be converted into
+// wxUniChar) or as an integer value (which should be left as-is). We take
+// advantage of the fact that both char and wchar_t are converted into int
+// in variadic arguments here.
+#if wxUSE_UNICODE
+template<typename T>
+struct wxArgNormalizerNarrowChar
+{
+ wxArgNormalizerNarrowChar(T value,
+ const wxFormatString *fmt, unsigned index)
+ {
+ // FIXME-UTF8: which one is better default in absence of fmt string
+ // (i.e. when used like e.g. Foo("foo", "bar", 'c', NULL)?
+ if ( !fmt || fmt->GetArgumentType(index) == wxFormatString::Arg_Char )
+ m_value = wx_truncate_cast(T, wxUniChar(value).GetValue());
+ else
+ m_value = value;
+ }
+
+ int get() const { return m_value; }
+
+ T m_value;
+};
+
+template<>
+struct wxArgNormalizer<char> : public wxArgNormalizerNarrowChar<char>
+{
+ wxArgNormalizer(char value,
+ const wxFormatString *fmt, unsigned index)
+ : wxArgNormalizerNarrowChar<char>(value, fmt, index) {}
+};
+
+template<>
+struct wxArgNormalizer<unsigned char>
+ : public wxArgNormalizerNarrowChar<unsigned char>
+{
+ wxArgNormalizer(unsigned char value,
+ const wxFormatString *fmt, unsigned index)
+ : wxArgNormalizerNarrowChar<unsigned char>(value, fmt, index) {}
+};
+
+#endif // wxUSE_UNICODE
+
+// convert references:
+WX_ARG_NORMALIZER_FORWARD(wxUniChar, const wxUniChar&);
+WX_ARG_NORMALIZER_FORWARD(const wxUniCharRef&, const wxUniChar&);
+WX_ARG_NORMALIZER_FORWARD(wxUniCharRef, const wxUniChar&);
+WX_ARG_NORMALIZER_FORWARD(const wchar_t&, wchar_t);
+
+WX_ARG_NORMALIZER_FORWARD(const char&, char);
+WX_ARG_NORMALIZER_FORWARD(const unsigned char&, unsigned char);
+
+