mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-19 23:17:21 -06:00
Move comparison operator out of class
This commit is contained in:
@@ -144,24 +144,35 @@ namespace RSS
|
||||
mutable QStringList lastComputedEpisodes;
|
||||
mutable QHash<QString, QRegularExpression> cachedRegexes;
|
||||
|
||||
bool operator==(const AutoDownloadRuleData &other) const
|
||||
friend bool operator==(const AutoDownloadRuleData &left, const AutoDownloadRuleData &right)
|
||||
{
|
||||
return (name == other.name)
|
||||
&& (enabled == other.enabled)
|
||||
&& (mustContain == other.mustContain)
|
||||
&& (mustNotContain == other.mustNotContain)
|
||||
&& (episodeFilter == other.episodeFilter)
|
||||
&& (feedURLs == other.feedURLs)
|
||||
&& (useRegex == other.useRegex)
|
||||
&& (ignoreDays == other.ignoreDays)
|
||||
&& (lastMatch == other.lastMatch)
|
||||
&& (savePath == other.savePath)
|
||||
&& (category == other.category)
|
||||
&& (addPaused == other.addPaused)
|
||||
&& (contentLayout == other.contentLayout)
|
||||
&& (smartFilter == other.smartFilter);
|
||||
return (left.name == right.name)
|
||||
&& (left.enabled == right.enabled)
|
||||
&& (left.mustContain == right.mustContain)
|
||||
&& (left.mustNotContain == right.mustNotContain)
|
||||
&& (left.episodeFilter == right.episodeFilter)
|
||||
&& (left.feedURLs == right.feedURLs)
|
||||
&& (left.useRegex == right.useRegex)
|
||||
&& (left.ignoreDays == right.ignoreDays)
|
||||
&& (left.lastMatch == right.lastMatch)
|
||||
&& (left.savePath == right.savePath)
|
||||
&& (left.category == right.category)
|
||||
&& (left.addPaused == right.addPaused)
|
||||
&& (left.contentLayout == right.contentLayout)
|
||||
&& (left.smartFilter == right.smartFilter);
|
||||
}
|
||||
};
|
||||
|
||||
bool operator==(const AutoDownloadRule &left, const AutoDownloadRule &right)
|
||||
{
|
||||
return (left.m_dataPtr == right.m_dataPtr) // optimization
|
||||
|| (*(left.m_dataPtr) == *(right.m_dataPtr));
|
||||
}
|
||||
|
||||
bool operator!=(const AutoDownloadRule &left, const AutoDownloadRule &right)
|
||||
{
|
||||
return !(left == right);
|
||||
}
|
||||
}
|
||||
|
||||
using namespace RSS;
|
||||
@@ -448,17 +459,6 @@ AutoDownloadRule &AutoDownloadRule::operator=(const AutoDownloadRule &other)
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool AutoDownloadRule::operator==(const AutoDownloadRule &other) const
|
||||
{
|
||||
return (m_dataPtr == other.m_dataPtr) // optimization
|
||||
|| (*m_dataPtr == *other.m_dataPtr);
|
||||
}
|
||||
|
||||
bool AutoDownloadRule::operator!=(const AutoDownloadRule &other) const
|
||||
{
|
||||
return !operator==(other);
|
||||
}
|
||||
|
||||
QJsonObject AutoDownloadRule::toJsonObject() const
|
||||
{
|
||||
return {{Str_Enabled, isEnabled()}
|
||||
|
||||
@@ -53,6 +53,8 @@ namespace RSS
|
||||
AutoDownloadRule(const AutoDownloadRule &other);
|
||||
~AutoDownloadRule();
|
||||
|
||||
AutoDownloadRule &operator=(const AutoDownloadRule &other);
|
||||
|
||||
QString name() const;
|
||||
void setName(const QString &name);
|
||||
|
||||
@@ -91,9 +93,7 @@ namespace RSS
|
||||
bool matches(const QVariantHash &articleData) const;
|
||||
bool accepts(const QVariantHash &articleData);
|
||||
|
||||
AutoDownloadRule &operator=(const AutoDownloadRule &other);
|
||||
bool operator==(const AutoDownloadRule &other) const;
|
||||
bool operator!=(const AutoDownloadRule &other) const;
|
||||
friend bool operator==(const AutoDownloadRule &left, const AutoDownloadRule &right);
|
||||
|
||||
QJsonObject toJsonObject() const;
|
||||
static AutoDownloadRule fromJsonObject(const QJsonObject &jsonObj, const QString &name = u""_qs);
|
||||
@@ -111,4 +111,6 @@ namespace RSS
|
||||
|
||||
QSharedDataPointer<AutoDownloadRuleData> m_dataPtr;
|
||||
};
|
||||
|
||||
bool operator!=(const AutoDownloadRule &left, const AutoDownloadRule &right);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user