#ifndef ADBLOCKRULE_H #define ADBLOCKRULE_H #include #include #include #include #include class AdBlockRule { public: enum MatchType { InvalidMatch, RegularExpressionMatch, StringContains, StringStartsWith, StringEndsWith, StringEquals, DomainMatch }; AdBlockRule(const QString &filter); bool isEnabled() const; bool matches(QWebEngineUrlRequestInfo::ResourceType type) const; bool shouldBlock(const QUrl &url) const; private: Q_DISABLE_COPY(AdBlockRule) bool m_isEnabled = false; bool m_isException = false; MatchType matchType = InvalidMatch; QHash m_resourceTypeOptions; QStringList allowedDomains, blockedDomains; QString match; QRegularExpression regexp; QStringMatcher matcher; }; #endif // ADBLOCKRULE_H