// accounts for string changes done by wxArgNormalizer<>
//
// Note that this class can _only_ be used for function arguments!
-#ifdef __VISUALC__
- // "struct 'wx[W]CharBuffer<T>' 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:
#if !wxUSE_UNICODE_WCHAR
operator const char*() const
- { return wx_const_cast(wxFormatString*, this)->AsChar(); }
+ { return const_cast<wxFormatString*>(this)->AsChar(); }
private:
// InputAsChar() returns the value converted passed to ctor, only converted
// to char, while AsChar() takes the the string returned by InputAsChar()
#if wxUSE_UNICODE && !wxUSE_UTF8_LOCALE_ONLY
public:
operator const wchar_t*() const
- { return wx_const_cast(wxFormatString*, this)->AsWChar(); }
+ { return const_cast<wxFormatString*>(this)->AsWChar(); }
private:
const wchar_t* InputAsWChar();
const wchar_t* AsWChar();
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
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
template<>
struct wxFormatStringArgumentFinder<wxFormatString>
-{
- static wxFormatStringArgument find(const wxFormatString& arg)
- { return wxFormatStringArgument(&arg); }
-};
+ : public wxFormatStringArgumentFinder<const wxFormatString&> {};
+
+// avoid passing big objects by value to wxFormatStringArgumentFinder::find()
+// (and especially wx[W]CharBuffer with its auto_ptr<> style semantics!):
+template<>
+struct wxFormatStringArgumentFinder<wxString>
+ : public wxFormatStringArgumentFinder<const wxString&> {};
+
+template<>
+struct wxFormatStringArgumentFinder<wxCharBuffer>
+ : public wxFormatStringArgumentFinder<const wxCharBuffer&> {};
+
+template<>
+struct wxFormatStringArgumentFinder<wxWCharBuffer>
+ : public wxFormatStringArgumentFinder<const wxWCharBuffer&> {};
// ----------------------------------------------------------------------------