// n-th variadic argument desired representation
ArgumentType GetArgumentType(unsigned n) const;
+ // returns the value passed to ctor, only converted to wxString, similarly
+ // to other InputAsXXX() methods
+ wxString InputAsString() const;
+
#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
+ // InputAsChar() returns the value passed to ctor, only converted
// to char, while AsChar() takes the the string returned by InputAsChar()
// and does format string conversion on it as well (and similarly for
// ..AsWChar() below)
#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();
const wxString * const m_str;
const wxCStrData * const m_cstr;
- DECLARE_NO_ASSIGN_CLASS(wxFormatString)
+ wxDECLARE_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&> {};
// ----------------------------------------------------------------------------
// 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;
}