mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-01 05:08:05 -06:00
Merge pull request #13953 from Chocobo1/cmp
Migrate away from deprecated QVariant comparison operators
This commit is contained in:
@@ -84,6 +84,11 @@ bool BitTorrent::operator!=(const InfoHash &left, const InfoHash &right)
|
||||
return !(left == right);
|
||||
}
|
||||
|
||||
bool BitTorrent::operator<(const InfoHash &left, const InfoHash &right)
|
||||
{
|
||||
return static_cast<lt::sha1_hash>(left) < static_cast<lt::sha1_hash>(right);
|
||||
}
|
||||
|
||||
uint BitTorrent::qHash(const InfoHash &key, const uint seed)
|
||||
{
|
||||
return ::qHash((std::hash<lt::sha1_hash> {})(key), seed);
|
||||
|
||||
@@ -61,6 +61,7 @@ namespace BitTorrent
|
||||
|
||||
bool operator==(const InfoHash &left, const InfoHash &right);
|
||||
bool operator!=(const InfoHash &left, const InfoHash &right);
|
||||
bool operator<(const InfoHash &left, const InfoHash &right);
|
||||
uint qHash(const InfoHash &key, uint seed);
|
||||
}
|
||||
|
||||
|
||||
@@ -133,19 +133,15 @@ namespace Utils
|
||||
return (*this != ThisType {});
|
||||
}
|
||||
|
||||
constexpr bool operator==(const ThisType &other) const
|
||||
// TODO: remove manually defined operators and use compiler generated `operator<=>()` in C++20
|
||||
friend bool operator==(const ThisType &left, const ThisType &right)
|
||||
{
|
||||
return (m_components == other.m_components);
|
||||
return (left.m_components == right.m_components);
|
||||
}
|
||||
|
||||
constexpr bool operator<(const ThisType &other) const
|
||||
friend bool operator<(const ThisType &left, const ThisType &right)
|
||||
{
|
||||
return (m_components < other.m_components);
|
||||
}
|
||||
|
||||
constexpr bool operator>(const ThisType &other) const
|
||||
{
|
||||
return (m_components > other.m_components);
|
||||
return (left.m_components < right.m_components);
|
||||
}
|
||||
|
||||
template <typename StringClassWithSplitMethod>
|
||||
@@ -198,6 +194,12 @@ namespace Utils
|
||||
return !(left == right);
|
||||
}
|
||||
|
||||
template <typename T, std::size_t N, std::size_t Mandatory>
|
||||
constexpr bool operator>(const Version<T, N, Mandatory> &left, const Version<T, N, Mandatory> &right)
|
||||
{
|
||||
return (right < left);
|
||||
}
|
||||
|
||||
template <typename T, std::size_t N, std::size_t Mandatory>
|
||||
constexpr bool operator<=(const Version<T, N, Mandatory> &left, const Version<T, N, Mandatory> &right)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user