/* * This file is part of smolbote. It's copyrighted by the contributors recorded * in the version control history of the file, available from its original * location: https://library.iserlohn-fortress.net/aqua/smolbote.git * * SPDX-License-Identifier: GPL-3.0 */ #include "rule.h" #include #include #include #include #include #include namespace AdblockPlus { class FilterList : public Filter { public: explicit FilterList(QIODevice &from); ~FilterList() { qDeleteAll(m_rules); } bool filter(QWebEngineUrlRequestInfo &info) const override; bool isUpToDate() const override { const auto current = QDateTime::currentDateTime(); return expires > current; } QDateTime modified() const { return lastModified; } QDateTime expiresOn() const { return expires; } [[nodiscard]] static Rule *parseRule(const QByteArray &line); private: void parseComment(const QString &line); QDateTime lastModified; QDateTime expires; QVector m_rules; }; } // namespace AdblockPlus