Fix building wxMSW using GCC 10.1 with C++20 standard

Add comparison operator overloads using NativeFormat to wxDataFormat
to prevent ambiguous operator overload errors.

Closes https://github.com/wxWidgets/wxWidgets/pull/1962
This commit is contained in:
PB 2020-07-13 23:53:50 +02:00 committed by Vadim Zeitlin
parent 7f617d97a5
commit 88a6c8c905
2 changed files with 12 additions and 0 deletions

View File

@ -41,6 +41,8 @@ public:
bool operator!=(wxDataFormatId format) const;
bool operator==(const wxDataFormat& format) const;
bool operator!=(const wxDataFormat& format) const;
bool operator==(NativeFormat format) const;
bool operator!=(NativeFormat format) const;
// explicit and implicit conversions to NativeFormat which is one of
// standard data types (implicit conversion is useful for preserving the

View File

@ -369,6 +369,16 @@ bool wxDataFormat::operator!=(const wxDataFormat& format) const
return !(*this == format);
}
bool wxDataFormat::operator==(NativeFormat format) const
{
return HtmlFormatFixup(*this).m_format == format;
}
bool wxDataFormat::operator!=(NativeFormat format) const
{
return !(*this == format);
}
void wxDataFormat::SetId(const wxString& format)
{
m_format = (wxDataFormat::NativeFormat)::RegisterClipboardFormat(format.t_str());