Left: | ||
Right: |
LEFT | RIGHT |
---|---|
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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
49 typedef StringSet SitekeySet; | 49 typedef StringSet SitekeySet; |
50 void ParseDomains(const String& domains, String::value_type separator) const; | 50 void ParseDomains(const String& domains, String::value_type separator) const; |
51 void AddSitekey(const String& sitekey) const; | 51 void AddSitekey(const String& sitekey) const; |
52 virtual DomainMap* GetDomains() const; | 52 virtual DomainMap* GetDomains() const; |
53 virtual SitekeySet* GetSitekeys() const; | 53 virtual SitekeySet* GetSitekeys() const; |
54 mutable std::unique_ptr<DomainMap> mDomains; | 54 mutable std::unique_ptr<DomainMap> mDomains; |
55 mutable std::unique_ptr<SitekeySet> mSitekeys; | 55 mutable std::unique_ptr<SitekeySet> mSitekeys; |
56 private: | 56 private: |
57 bool mIgnoreTrailingDot; | 57 bool mIgnoreTrailingDot; |
58 public: | 58 public: |
59 static constexpr Type classType = Type::ACTIVE; | |
59 explicit ActiveFilter(Type type, const String& text, bool ignoreTrailingDot); | 60 explicit ActiveFilter(Type type, const String& text, bool ignoreTrailingDot); |
60 FILTER_PROPERTY(bool, mDisabled, FILTER_DISABLED, GetDisabled, SetDisabled); | 61 FILTER_PROPERTY(bool, mDisabled, FILTER_DISABLED, GetDisabled, SetDisabled); |
61 FILTER_PROPERTY(unsigned int, mHitCount, FILTER_HITCOUNT, | 62 FILTER_PROPERTY(unsigned int, mHitCount, FILTER_HITCOUNT, |
62 GetHitCount, SetHitCount); | 63 GetHitCount, SetHitCount); |
63 FILTER_PROPERTY(unsigned int, mLastHit, FILTER_LASTHIT, | 64 FILTER_PROPERTY(unsigned int, mLastHit, FILTER_LASTHIT, |
64 GetLastHit, SetLastHit); | 65 GetLastHit, SetLastHit); |
65 bool BINDINGS_EXPORTED IsActiveOnDomain(DependentString& docDomain, | 66 bool BINDINGS_EXPORTED IsActiveOnDomain(DependentString& docDomain, |
66 const String& sitekey) const; | 67 const String& sitekey) const; |
67 bool BINDINGS_EXPORTED IsActiveOnlyOnDomain(DependentString& docDomain) const; | 68 bool BINDINGS_EXPORTED IsActiveOnlyOnDomain(DependentString& docDomain) const; |
68 bool BINDINGS_EXPORTED IsGeneric() const; | 69 bool BINDINGS_EXPORTED IsGeneric() const; |
69 OwnedString BINDINGS_EXPORTED Serialize() const; | 70 OwnedString BINDINGS_EXPORTED Serialize() const; |
70 }; | 71 }; |
71 | |
72 template<> | |
73 inline ActiveFilter* Filter::As<ActiveFilter>() | |
74 { | |
75 if ((mType & Type::ACTIVE) == Type::ACTIVE) | |
sergei
2017/10/12 12:24:34
I wonder whether concrete type value can be a clas
hub
2017/10/12 13:51:33
You can have static const, but then for linkage pu
sergei
2017/10/12 13:57:31
A method is also fine for me, can we use constexpr
hub
2017/10/12 14:03:01
Yes you can. I recommend doing so.
Wladimir Palant
2017/10/13 11:43:28
Done.
| |
76 return nullptr; | |
77 | |
78 return static_cast<ActiveFilter*>(this); | |
79 } | |
LEFT | RIGHT |