X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/04e7692af163f3c6f1e58f01e7be665882d65ce9..a8fd1047b81302d010ff29b9c0885819cbf25011:/include/wx/strvararg.h diff --git a/include/wx/strvararg.h b/include/wx/strvararg.h index bd7d867b3c..4a9f0dbdd6 100644 --- a/include/wx/strvararg.h +++ b/include/wx/strvararg.h @@ -124,11 +124,6 @@ class WXDLLIMPEXP_FWD_BASE wxString; // accounts for string changes done by wxArgNormalizer<> // // Note that this class can _only_ be used for function arguments! -#ifdef __VISUALC__ - // "struct 'wx[W]CharBuffer' needs to have dll-interface to be used by - // clients of class 'wxString'" - this is private, we don't care - #pragma warning (disable:4251) -#endif class WXDLLIMPEXP_BASE wxFormatString { public: @@ -161,7 +156,7 @@ public: #if !wxUSE_UNICODE_WCHAR operator const char*() const - { return wx_const_cast(wxFormatString*, this)->AsChar(); } + { return const_cast(this)->AsChar(); } private: // InputAsChar() returns the value converted passed to ctor, only converted // to char, while AsChar() takes the the string returned by InputAsChar() @@ -175,7 +170,7 @@ private: #if wxUSE_UNICODE && !wxUSE_UTF8_LOCALE_ONLY public: operator const wchar_t*() const - { return wx_const_cast(wxFormatString*, this)->AsWChar(); } + { return const_cast(this)->AsWChar(); } private: const wchar_t* InputAsWChar(); const wchar_t* AsWChar(); @@ -185,9 +180,6 @@ private: private: wxCharBuffer m_char; wxWCharBuffer m_wchar; -#ifdef __VISUALC__ - #pragma warning (default:4251) -#endif // NB: we can use a pointer here, because wxFormatString is only used // as function argument, so it has shorter life than the string @@ -195,7 +187,7 @@ private: const wxString * const m_str; const wxCStrData * const m_cstr; - DECLARE_NO_COPY_CLASS(wxFormatString) + DECLARE_NO_ASSIGN_CLASS(wxFormatString) }; // these two helper classes are used to find wxFormatString argument among fixed @@ -235,10 +227,21 @@ struct wxFormatStringArgumentFinder template<> struct wxFormatStringArgumentFinder -{ - static wxFormatStringArgument find(const wxFormatString& arg) - { return wxFormatStringArgument(&arg); } -}; + : public wxFormatStringArgumentFinder {}; + +// avoid passing big objects by value to wxFormatStringArgumentFinder::find() +// (and especially wx[W]CharBuffer with its auto_ptr<> style semantics!): +template<> +struct wxFormatStringArgumentFinder + : public wxFormatStringArgumentFinder {}; + +template<> +struct wxFormatStringArgumentFinder + : public wxFormatStringArgumentFinder {}; + +template<> +struct wxFormatStringArgumentFinder + : public wxFormatStringArgumentFinder {}; // ---------------------------------------------------------------------------- @@ -561,7 +564,7 @@ struct wxArgNormalizerNarrowChar // 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 = wxUniChar(value).GetValue(); + m_value = wx_truncate_cast(T, wxUniChar(value).GetValue()); else m_value = value; }