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

Delta Between Two Patch Sets: compiled/RegExpFilter.h

Issue 29333474: Issue 4125 - [emscripten] Convert filter classes to C++ (Closed)
Left Patch Set: Split up String class into two, cleaned up RegExpFilter methods Created Feb. 4, 2016, 7:20 p.m.
Right Patch Set: Addressed comments from Patch Set 28 Created March 21, 2017, 10:04 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « compiled/InvalidFilter.cpp ('k') | compiled/RegExpFilter.cpp » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 #ifndef ADBLOCK_PLUS_REG_EXP_FILTER_H 1 #pragma once
2 #define ADBLOCK_PLUS_REG_EXP_FILTER_H
3 2
4 #include "Filter.h" 3 #include "Filter.h"
5 #include "ActiveFilter.h" 4 #include "ActiveFilter.h"
6 5
7 enum class TrippleState {YES, NO, ANY}; 6 enum class TrippleState {YES, NO, ANY};
8 7
9 struct RegExpFilterData 8 struct RegExpFilterData
10 { 9 {
11 mutable String::size_type mPatternStart; 10 mutable String::size_type mPatternStart;
12 union 11 union
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 { 67 {
69 mSitekeysStart = String::npos; 68 mSitekeysStart = String::npos;
70 } 69 }
71 70
72 const DependentString GetSitekeysSource(const String& text) const 71 const DependentString GetSitekeysSource(const String& text) const
73 { 72 {
74 return DependentString(text, mSitekeysStart, mSitekeysEnd - mSitekeysStart); 73 return DependentString(text, mSitekeysStart, mSitekeysEnd - mSitekeysStart);
75 } 74 }
76 }; 75 };
77 76
78 class RegExpFilter : public ActiveFilter, protected RegExpFilterData 77 class RegExpFilter : public ActiveFilter
79 { 78 {
80 private: 79 private:
81 void ParseSitekeys(const String& sitekeys) const; 80 void ParseSitekeys(const String& sitekeys) const;
82 81
83 protected: 82 protected:
84 virtual DomainMap* GetDomains() const; 83 RegExpFilterData mData;
85 virtual SitekeySet* GetSitekeys() const; 84
85 DomainMap* GetDomains() const override;
86 SitekeySet* GetSitekeys() const override;
86 public: 87 public:
87 RegExpFilter(const String& text, const RegExpFilterData& data); 88 explicit RegExpFilter(Type type, const String& text, const RegExpFilterData& d ata);
88 ~RegExpFilter(); 89 ~RegExpFilter();
89 static Type Parse(DependentString& text, OwnedString& error, 90 static Type Parse(DependentString& text, DependentString& error,
90 RegExpFilterData& data); 91 RegExpFilterData& data);
91 EMSCRIPTEN_KEEPALIVE static void InitJSTypes(); 92 EMSCRIPTEN_KEEPALIVE static void InitJSTypes();
92 static OwnedString RegExpFromSource(const String& source); 93 static OwnedString RegExpFromSource(const String& source);
93 Type GetType() const;
94 EMSCRIPTEN_KEEPALIVE bool Matches(const String& location, int typeMask, 94 EMSCRIPTEN_KEEPALIVE bool Matches(const String& location, int typeMask,
95 DependentString& docDomain, bool thirdParty, const String& sitekey) const; 95 DependentString& docDomain, bool thirdParty, const String& sitekey) const;
96 }; 96 };
97
98 #endif
LEFTRIGHT

Powered by Google App Engine
This is Rietveld