mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-22 20:44:15 +00:00
Use default operators generated/synthesized by compiler
This commit is contained in:
parent
10ee1ab7a2
commit
7612d5d0ef
@ -134,11 +134,6 @@ namespace
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
bool operator==(const QString &arg, const BoolOption &option)
|
|
||||||
{
|
|
||||||
return (option == arg);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Option with string value. May not have a shortcut
|
// Option with string value. May not have a shortcut
|
||||||
struct StringOption : protected Option
|
struct StringOption : protected Option
|
||||||
{
|
{
|
||||||
@ -181,11 +176,6 @@ namespace
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
bool operator==(const QString &arg, const StringOption &option)
|
|
||||||
{
|
|
||||||
return (option == arg);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Option with integer value. May not have a shortcut
|
// Option with integer value. May not have a shortcut
|
||||||
class IntOption : protected StringOption
|
class IntOption : protected StringOption
|
||||||
{
|
{
|
||||||
@ -233,11 +223,6 @@ namespace
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
bool operator==(const QString &arg, const IntOption &option)
|
|
||||||
{
|
|
||||||
return (option == arg);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Option that is explicitly set to true or false, and whose value is undefined when unspecified.
|
// Option that is explicitly set to true or false, and whose value is undefined when unspecified.
|
||||||
// May not have a shortcut.
|
// May not have a shortcut.
|
||||||
class TriStateBoolOption : protected Option
|
class TriStateBoolOption : protected Option
|
||||||
@ -316,11 +301,6 @@ namespace
|
|||||||
bool m_defaultValue;
|
bool m_defaultValue;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool operator==(const QString &arg, const TriStateBoolOption &option)
|
|
||||||
{
|
|
||||||
return (option == arg);
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr const BoolOption SHOW_HELP_OPTION {"help", 'h'};
|
constexpr const BoolOption SHOW_HELP_OPTION {"help", 'h'};
|
||||||
constexpr const BoolOption SHOW_VERSION_OPTION {"version", 'v'};
|
constexpr const BoolOption SHOW_VERSION_OPTION {"version", 'v'};
|
||||||
#if defined(DISABLE_GUI) && !defined(Q_OS_WIN)
|
#if defined(DISABLE_GUI) && !defined(Q_OS_WIN)
|
||||||
|
@ -120,8 +120,3 @@ bool BitTorrent::operator==(const BitTorrent::InfoHash &left, const BitTorrent::
|
|||||||
{
|
{
|
||||||
return (static_cast<InfoHash::WrappedType>(left) == static_cast<InfoHash::WrappedType>(right));
|
return (static_cast<InfoHash::WrappedType>(left) == static_cast<InfoHash::WrappedType>(right));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BitTorrent::operator!=(const BitTorrent::InfoHash &left, const BitTorrent::InfoHash &right)
|
|
||||||
{
|
|
||||||
return !(left == right);
|
|
||||||
}
|
|
||||||
|
@ -90,7 +90,6 @@ namespace BitTorrent
|
|||||||
std::size_t qHash(const TorrentID &key, std::size_t seed = 0);
|
std::size_t qHash(const TorrentID &key, std::size_t seed = 0);
|
||||||
|
|
||||||
bool operator==(const InfoHash &left, const InfoHash &right);
|
bool operator==(const InfoHash &left, const InfoHash &right);
|
||||||
bool operator!=(const InfoHash &left, const InfoHash &right);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(BitTorrent::TorrentID)
|
Q_DECLARE_METATYPE(BitTorrent::TorrentID)
|
||||||
|
@ -135,11 +135,6 @@ namespace BitTorrent
|
|||||||
return (left.uniqueID() == right.uniqueID());
|
return (left.uniqueID() == right.uniqueID());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(const Peer &left, const Peer &right)
|
|
||||||
{
|
|
||||||
return !(left == right);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::size_t qHash(const Peer &key, const std::size_t seed)
|
std::size_t qHash(const Peer &key, const std::size_t seed)
|
||||||
{
|
{
|
||||||
return qHash(key.uniqueID(), seed);
|
return qHash(key.uniqueID(), seed);
|
||||||
|
@ -64,7 +64,6 @@ namespace BitTorrent
|
|||||||
};
|
};
|
||||||
|
|
||||||
bool operator==(const Peer &left, const Peer &right);
|
bool operator==(const Peer &left, const Peer &right);
|
||||||
bool operator!=(const Peer &left, const Peer &right);
|
|
||||||
std::size_t qHash(const Peer &key, std::size_t seed = 0);
|
std::size_t qHash(const Peer &key, std::size_t seed = 0);
|
||||||
|
|
||||||
// *Basic* Bittorrent tracker implementation
|
// *Basic* Bittorrent tracker implementation
|
||||||
|
@ -144,12 +144,6 @@ bool operator==(const Digest32<N> &left, const Digest32<N> &right)
|
|||||||
== static_cast<typename Digest32<N>::UnderlyingType>(right));
|
== static_cast<typename Digest32<N>::UnderlyingType>(right));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <int N>
|
|
||||||
bool operator!=(const Digest32<N> &left, const Digest32<N> &right)
|
|
||||||
{
|
|
||||||
return !(left == right);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <int N>
|
template <int N>
|
||||||
bool operator<(const Digest32<N> &left, const Digest32<N> &right)
|
bool operator<(const Digest32<N> &left, const Digest32<N> &right)
|
||||||
{
|
{
|
||||||
|
@ -107,11 +107,6 @@ public:
|
|||||||
return (*left == *right);
|
return (*left == *right);
|
||||||
}
|
}
|
||||||
|
|
||||||
friend constexpr bool operator!=(const Iterator &left, const Iterator &right)
|
|
||||||
{
|
|
||||||
return !(left == right);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
IndexType m_index;
|
IndexType m_index;
|
||||||
};
|
};
|
||||||
|
@ -41,11 +41,6 @@ bool Net::operator==(const ProxyConfiguration &left, const ProxyConfiguration &r
|
|||||||
&& (left.hostnameLookupEnabled == right.hostnameLookupEnabled);
|
&& (left.hostnameLookupEnabled == right.hostnameLookupEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Net::operator!=(const ProxyConfiguration &left, const ProxyConfiguration &right)
|
|
||||||
{
|
|
||||||
return !(left == right);
|
|
||||||
}
|
|
||||||
|
|
||||||
using namespace Net;
|
using namespace Net;
|
||||||
|
|
||||||
ProxyConfigurationManager *ProxyConfigurationManager::m_instance = nullptr;
|
ProxyConfigurationManager *ProxyConfigurationManager::m_instance = nullptr;
|
||||||
|
@ -57,7 +57,6 @@ namespace Net
|
|||||||
bool hostnameLookupEnabled = true;
|
bool hostnameLookupEnabled = true;
|
||||||
};
|
};
|
||||||
bool operator==(const ProxyConfiguration &left, const ProxyConfiguration &right);
|
bool operator==(const ProxyConfiguration &left, const ProxyConfiguration &right);
|
||||||
bool operator!=(const ProxyConfiguration &left, const ProxyConfiguration &right);
|
|
||||||
|
|
||||||
class ProxyConfigurationManager final : public QObject
|
class ProxyConfigurationManager final : public QObject
|
||||||
{
|
{
|
||||||
|
@ -342,11 +342,6 @@ bool operator==(const Path &lhs, const Path &rhs)
|
|||||||
return (lhs.data().compare(rhs.data(), CASE_SENSITIVITY) == 0);
|
return (lhs.data().compare(rhs.data(), CASE_SENSITIVITY) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(const Path &lhs, const Path &rhs)
|
|
||||||
{
|
|
||||||
return !(lhs == rhs);
|
|
||||||
}
|
|
||||||
|
|
||||||
Path operator/(const Path &lhs, const Path &rhs)
|
Path operator/(const Path &lhs, const Path &rhs)
|
||||||
{
|
{
|
||||||
if (rhs.isEmpty())
|
if (rhs.isEmpty())
|
||||||
|
@ -95,7 +95,6 @@ private:
|
|||||||
Q_DECLARE_METATYPE(Path)
|
Q_DECLARE_METATYPE(Path)
|
||||||
|
|
||||||
bool operator==(const Path &lhs, const Path &rhs);
|
bool operator==(const Path &lhs, const Path &rhs);
|
||||||
bool operator!=(const Path &lhs, const Path &rhs);
|
|
||||||
Path operator+(const Path &lhs, QStringView rhs);
|
Path operator+(const Path &lhs, QStringView rhs);
|
||||||
|
|
||||||
QDataStream &operator<<(QDataStream &out, const Path &path);
|
QDataStream &operator<<(QDataStream &out, const Path &path);
|
||||||
|
@ -167,11 +167,6 @@ namespace RSS
|
|||||||
return (left.m_dataPtr == right.m_dataPtr) // optimization
|
return (left.m_dataPtr == right.m_dataPtr) // optimization
|
||||||
|| (*(left.m_dataPtr) == *(right.m_dataPtr));
|
|| (*(left.m_dataPtr) == *(right.m_dataPtr));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(const AutoDownloadRule &left, const AutoDownloadRule &right)
|
|
||||||
{
|
|
||||||
return !(left == right);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
using namespace RSS;
|
using namespace RSS;
|
||||||
|
@ -108,6 +108,4 @@ namespace RSS
|
|||||||
|
|
||||||
QSharedDataPointer<AutoDownloadRuleData> m_dataPtr;
|
QSharedDataPointer<AutoDownloadRuleData> m_dataPtr;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool operator!=(const AutoDownloadRule &left, const AutoDownloadRule &right);
|
|
||||||
}
|
}
|
||||||
|
@ -124,13 +124,12 @@ namespace Utils
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: remove manually defined operators and use compiler generated `operator<=>()` in C++20
|
friend constexpr bool operator==(const ThisType &left, const ThisType &right)
|
||||||
friend bool operator==(const ThisType &left, const ThisType &right)
|
|
||||||
{
|
{
|
||||||
return (left.m_components == right.m_components);
|
return (left.m_components == right.m_components);
|
||||||
}
|
}
|
||||||
|
|
||||||
friend bool operator<(const ThisType &left, const ThisType &right)
|
friend constexpr bool operator<(const ThisType &left, const ThisType &right)
|
||||||
{
|
{
|
||||||
return (left.m_components < right.m_components);
|
return (left.m_components < right.m_components);
|
||||||
}
|
}
|
||||||
@ -159,12 +158,6 @@ namespace Utils
|
|||||||
std::array<int, N> m_components {{}};
|
std::array<int, N> m_components {{}};
|
||||||
};
|
};
|
||||||
|
|
||||||
template <int N, int Mandatory>
|
|
||||||
constexpr bool operator!=(const Version<N, Mandatory> &left, const Version<N, Mandatory> &right)
|
|
||||||
{
|
|
||||||
return !(left == right);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <int N, int Mandatory>
|
template <int N, int Mandatory>
|
||||||
constexpr bool operator>(const Version<N, Mandatory> &left, const Version<N, Mandatory> &right)
|
constexpr bool operator>(const Version<N, Mandatory> &left, const Version<N, Mandatory> &right)
|
||||||
{
|
{
|
||||||
|
@ -67,12 +67,9 @@ struct PeerEndpoint
|
|||||||
{
|
{
|
||||||
BitTorrent::PeerAddress address;
|
BitTorrent::PeerAddress address;
|
||||||
QString connectionType; // matches return type of `PeerInfo::connectionType()`
|
QString connectionType; // matches return type of `PeerInfo::connectionType()`
|
||||||
};
|
|
||||||
|
|
||||||
bool operator==(const PeerEndpoint &left, const PeerEndpoint &right)
|
friend bool operator==(const PeerEndpoint &left, const PeerEndpoint &right) = default;
|
||||||
{
|
};
|
||||||
return (left.address == right.address) && (left.connectionType == right.connectionType);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::size_t qHash(const PeerEndpoint &peerEndpoint, const std::size_t seed = 0)
|
std::size_t qHash(const PeerEndpoint &peerEndpoint, const std::size_t seed = 0)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user