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

Side by Side Diff: compiled/filter/ActiveFilter.h

Issue 29587914: Issue 5142 - Convert Element Hiding to C++ (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Added OwnedStringMap to address ownership of keys Created Nov. 25, 2017, 3:22 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « compiled/bindings/main.cpp ('k') | lib/elemHide.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH 3 * Copyright (C) 2006-present eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 26 matching lines...) Expand all
37 name = value;\ 37 name = value;\
38 if (FilterNotifier::Topic::topic != FilterNotifier::Topic::NONE)\ 38 if (FilterNotifier::Topic::topic != FilterNotifier::Topic::NONE)\
39 {\ 39 {\
40 FilterNotifier::FilterChange(FilterNotifier::Topic::topic, *this);\ 40 FilterNotifier::FilterChange(FilterNotifier::Topic::topic, *this);\
41 }\ 41 }\
42 }\ 42 }\
43 } 43 }
44 44
45 class ActiveFilter : public Filter 45 class ActiveFilter : public Filter
46 { 46 {
47 public:
48 typedef StringMap<bool> DomainMap;
49 virtual DomainMap* GetDomains() const;
47 protected: 50 protected:
48 typedef StringMap<bool> DomainMap;
49 typedef StringSet SitekeySet; 51 typedef StringSet SitekeySet;
50 void ParseDomains(const String& domains, String::value_type separator) const; 52 void ParseDomains(const String& domains, String::value_type separator) const;
51 void AddSitekey(const String& sitekey) const; 53 void AddSitekey(const String& sitekey) const;
52 virtual DomainMap* GetDomains() const;
53 virtual SitekeySet* GetSitekeys() const; 54 virtual SitekeySet* GetSitekeys() const;
54 mutable std::unique_ptr<DomainMap> mDomains; 55 mutable std::unique_ptr<DomainMap> mDomains;
55 mutable std::unique_ptr<SitekeySet> mSitekeys; 56 mutable std::unique_ptr<SitekeySet> mSitekeys;
56 private: 57 private:
57 bool mIgnoreTrailingDot; 58 bool mIgnoreTrailingDot;
58 public: 59 public:
59 static constexpr Type classType = Type::ACTIVE; 60 static constexpr Type classType = Type::ACTIVE;
60 explicit ActiveFilter(Type type, const String& text, bool ignoreTrailingDot); 61 explicit ActiveFilter(Type type, const String& text, bool ignoreTrailingDot);
61 FILTER_PROPERTY(bool, mDisabled, FILTER_DISABLED, GetDisabled, SetDisabled); 62 FILTER_PROPERTY(bool, mDisabled, FILTER_DISABLED, GetDisabled, SetDisabled);
62 FILTER_PROPERTY(unsigned int, mHitCount, FILTER_HITCOUNT, 63 FILTER_PROPERTY(unsigned int, mHitCount, FILTER_HITCOUNT,
63 GetHitCount, SetHitCount); 64 GetHitCount, SetHitCount);
64 FILTER_PROPERTY(unsigned int, mLastHit, FILTER_LASTHIT, 65 FILTER_PROPERTY(unsigned int, mLastHit, FILTER_LASTHIT,
65 GetLastHit, SetLastHit); 66 GetLastHit, SetLastHit);
66 bool BINDINGS_EXPORTED IsActiveOnDomain(DependentString& docDomain, 67 bool BINDINGS_EXPORTED IsActiveOnDomain(DependentString& docDomain,
67 const String& sitekey) const; 68 const String& sitekey) const;
68 bool BINDINGS_EXPORTED IsActiveOnlyOnDomain(DependentString& docDomain) const; 69 bool BINDINGS_EXPORTED IsActiveOnlyOnDomain(DependentString& docDomain) const;
69 bool BINDINGS_EXPORTED IsGeneric() const; 70 bool BINDINGS_EXPORTED IsGeneric() const;
70 OwnedString BINDINGS_EXPORTED Serialize() const; 71 OwnedString BINDINGS_EXPORTED Serialize() const;
71 }; 72 };
72 73
73 typedef intrusive_ptr<ActiveFilter> ActiveFilterPtr; 74 typedef intrusive_ptr<ActiveFilter> ActiveFilterPtr;
OLDNEW
« no previous file with comments | « compiled/bindings/main.cpp ('k') | lib/elemHide.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld