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

Unified Diff: compiled/matcher/Matcher.h

Issue 29581602: Issue 5141 - [emscripten] Convert filter matcher to C++ Base URL: https://hg.adblockplus.org/adblockpluscore
Patch Set: Created Oct. 17, 2017, 12:31 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/matcher/Matcher.h
===================================================================
new file mode 100644
--- /dev/null
+++ b/compiled/matcher/Matcher.h
@@ -0,0 +1,42 @@
+/*
+ * This file is part of Adblock Plus <https://adblockplus.org/>,
+ * Copyright (C) 2006-present eyeo GmbH
+ *
+ * Adblock Plus is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3 as
+ * published by the Free Software Foundation.
+ *
+ * Adblock Plus is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#pragma once
+
+#include <vector>
+
+#include "../intrusive_ptr.h"
+#include "../IntMap.h"
+#include "../String.h"
+#include "../filter/Filter.h"
+#include "../filter/RegExpFilter.h"
+
+class Matcher : public ref_counted
+{
+private:
+ Uint32Map<RegExpFilterPtr> mFilters;
+ std::vector<RegExpFilterPtr> mUnoptimizedFilters;
sergei 2017/10/18 10:58:43 IMO, prefix Non would be better in comparison with
+
+public:
+ static Matcher* BINDINGS_EXPORTED Create();
+
+ void BINDINGS_EXPORTED Add(Filter& filter);
sergei 2017/10/18 10:58:43 Since Matcher works only with RegExpFilter-based f
+ void BINDINGS_EXPORTED Remove(const Filter& filter);
+ RegExpFilter* BINDINGS_EXPORTED MatchesAny(const String& location,
+ int typeMask, DependentString& docDomain, bool thirdParty,
sergei 2017/10/18 10:58:43 Just for reference, I see how docDomain is used in
+ const String& siteKey, bool specificOnly);
Wladimir Palant 2017/10/17 12:51:22 Would be nice if this method could be const, it ca
sergei 2017/10/18 10:58:43 Yeah, since ref_counted is non-const it cannot be
+};

Powered by Google App Engine
This is Rietveld