From 9ea6dca0c9b3fc0cc5197253b590d31a6041bf46 Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Wed, 18 Aug 2010 02:55:42 +0200 Subject: Remove the method pattern() from AdBlockRule The method pattern imply the rule is implemented with a regexp, which is what we should try to avoid in the future for performance reasons. --- src/adblock/adblockrule.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/adblock/adblockrule.h') diff --git a/src/adblock/adblockrule.h b/src/adblock/adblockrule.h index 28084004..1cd9ea49 100644 --- a/src/adblock/adblockrule.h +++ b/src/adblock/adblockrule.h @@ -73,8 +73,6 @@ public: bool match(const QString &encodedUrl) const; - QString pattern() const; - private: QString convertPatternToRegExp(const QString &wildcardPattern); -- cgit v1.2.1 From d9028baf5c8261cbad540893465965730386a1cf Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Wed, 18 Aug 2010 03:32:50 +0200 Subject: Split AdBlock rule in two classes to move the implementation out of it In order to make special matching rules, we need specialization of the implementation depending on the type of rule. The previous AdBlockRule was entierly based on regexp. The new one is only a factory to a AdBlockRuleImpl, and delegate everything to this implementation. This will allow faster specialization of the ad block rules in the future. --- src/adblock/adblockrule.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/adblock/adblockrule.h') diff --git a/src/adblock/adblockrule.h b/src/adblock/adblockrule.h index 1cd9ea49..04409688 100644 --- a/src/adblock/adblockrule.h +++ b/src/adblock/adblockrule.h @@ -58,25 +58,25 @@ // Rekonq Includes #include "rekonq_defines.h" -// Qt Includes -#include -#include +#include "adblockruleimpl.h" -// Forward Includes -class QUrl; +#include +// Forward Includes +class QString; class AdBlockRule { public: AdBlockRule(const QString &filter); - bool match(const QString &encodedUrl) const; + bool match(const QString &encodedUrl) const + { + return m_implementation->match(encodedUrl); + } private: - QString convertPatternToRegExp(const QString &wildcardPattern); - - QRegExp m_regExp; + QSharedPointer m_implementation; }; -- cgit v1.2.1