Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: compiled/filter/BlockingFilter.h

Issue 29574591: Issue 5258 - Implement Filter::As<>() method to make working with filters easier from C++ code (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore
Patch Set: Created Oct. 12, 2017, 12:13 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: compiled/filter/BlockingFilter.h
===================================================================
--- a/compiled/filter/BlockingFilter.h
+++ b/compiled/filter/BlockingFilter.h
@@ -19,8 +19,18 @@
#include "RegExpFilter.h"
class BlockingFilter : public RegExpFilter
{
public:
explicit BlockingFilter(const String& text, const RegExpFilterData& data);
};
+
+
+template<>
+inline BlockingFilter* Filter::As<BlockingFilter>()
+{
+ if ((mType & Type::BLOCKING) == Type::BLOCKING)
+ return nullptr;
+
+ return static_cast<BlockingFilter*>(this);
+}

Powered by Google App Engine
This is Rietveld