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: Addressed Sergei`s comments again Created Feb. 23, 2016, 9:29 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 #pragma once 1 #pragma once
2 2
3 #include "Filter.h" 3 #include "Filter.h"
4 #include "ActiveFilter.h" 4 #include "ActiveFilter.h"
5 5
6 enum class TrippleState {YES, NO, ANY}; 6 enum class TrippleState {YES, NO, ANY};
7 7
8 struct RegExpFilterData 8 struct RegExpFilterData
9 { 9 {
10 mutable String::size_type mPatternStart; 10 mutable String::size_type mPatternStart;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 { 67 {
68 mSitekeysStart = String::npos; 68 mSitekeysStart = String::npos;
69 } 69 }
70 70
71 const DependentString GetSitekeysSource(const String& text) const 71 const DependentString GetSitekeysSource(const String& text) const
72 { 72 {
73 return DependentString(text, mSitekeysStart, mSitekeysEnd - mSitekeysStart); 73 return DependentString(text, mSitekeysStart, mSitekeysEnd - mSitekeysStart);
74 } 74 }
75 }; 75 };
76 76
77 class RegExpFilter : public ActiveFilter, protected RegExpFilterData 77 class RegExpFilter : public ActiveFilter
78 { 78 {
79 private: 79 private:
80 void ParseSitekeys(const String& sitekeys) const; 80 void ParseSitekeys(const String& sitekeys) const;
81 81
82 protected: 82 protected:
83 RegExpFilterData mData;
84
83 DomainMap* GetDomains() const override; 85 DomainMap* GetDomains() const override;
84 SitekeySet* GetSitekeys() const override; 86 SitekeySet* GetSitekeys() const override;
85 public: 87 public:
86 RegExpFilter(const String& text, const RegExpFilterData& data); 88 explicit RegExpFilter(Type type, const String& text, const RegExpFilterData& d ata);
87 ~RegExpFilter(); 89 ~RegExpFilter();
88 static Type Parse(DependentString& text, DependentString& error, 90 static Type Parse(DependentString& text, DependentString& error,
89 RegExpFilterData& data); 91 RegExpFilterData& data);
90 EMSCRIPTEN_KEEPALIVE static void InitJSTypes(); 92 EMSCRIPTEN_KEEPALIVE static void InitJSTypes();
91 static OwnedString RegExpFromSource(const String& source); 93 static OwnedString RegExpFromSource(const String& source);
92 EMSCRIPTEN_KEEPALIVE bool Matches(const String& location, int typeMask, 94 EMSCRIPTEN_KEEPALIVE bool Matches(const String& location, int typeMask,
93 DependentString& docDomain, bool thirdParty, const String& sitekey) const; 95 DependentString& docDomain, bool thirdParty, const String& sitekey) const;
94 }; 96 };
LEFTRIGHT

Powered by Google App Engine
This is Rietveld