Allow passing wxLongLong values directly to wx pseudo-vararg functions.

Allow passing wxLongLong objects when a "%lld" format specifier (or
equivalent) is used just as we already do for wxString objects when "%s" is
used. This is more convenient and makes wxLongLong closes to the native type.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67760 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2011-05-17 22:12:39 +00:00
parent 8ea26eedce
commit 715efa4e25
3 changed files with 46 additions and 1 deletions

View File

@@ -1113,6 +1113,33 @@ template<> class numeric_limits<wxULongLong>
#endif // wxUSE_LONGLONG_NATIVE
// ----------------------------------------------------------------------------
// Specialize wxArgNormalizer to allow using wxLongLong directly with wx pseudo
// vararg functions.
// ----------------------------------------------------------------------------
// Notice that this must be done here and not in wx/strvararg.h itself because
// we can't include wx/longlong.h from there as this header itself includes
// wx/string.h which includes wx/strvararg.h too, so to avoid the circular
// dependencies we can only do it here (or add another header just for this but
// it doesn't seem necessary).
#include "wx/strvararg.h"
template<>
struct WXDLLIMPEXP_BASE wxArgNormalizer<wxLongLong>
{
wxArgNormalizer(wxLongLong value,
const wxFormatString *fmt, unsigned index)
: m_value(value)
{
wxASSERT_ARG_TYPE( fmt, index, wxFormatString::Arg_LongLongInt );
}
wxLongLong_t get() const { return m_value.GetValue(); }
wxLongLong m_value;
};
#endif // wxUSE_LONGLONG
#endif // _WX_LONGLONG_H