mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-03 14:12:30 -06:00
Cache rule regular expressions for performance
--HG-- branch : magao-dev
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
#include <QSharedPointer>
|
||||
#include <QStringList>
|
||||
|
||||
template <class T, class U> class QHash;
|
||||
class QRegularExpression;
|
||||
|
||||
namespace Rss
|
||||
@@ -57,6 +58,7 @@ namespace Rss
|
||||
};
|
||||
|
||||
DownloadRule();
|
||||
~DownloadRule();
|
||||
|
||||
static DownloadRulePtr fromVariantHash(const QVariantHash &ruleHash);
|
||||
QVariantHash toVariantHash() const;
|
||||
@@ -91,6 +93,7 @@ namespace Rss
|
||||
|
||||
private:
|
||||
bool matches(const QString &articleTitle, const QString &expression) const;
|
||||
QRegularExpression getRegex(const QString &expression, bool isRegex = true) const;
|
||||
|
||||
QString m_name;
|
||||
QStringList m_mustContain;
|
||||
@@ -104,6 +107,7 @@ namespace Rss
|
||||
AddPausedState m_apstate;
|
||||
QDateTime m_lastMatch;
|
||||
int m_ignoreDays;
|
||||
mutable QHash<QString, QRegularExpression> *m_cachedRegexes;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user