| OLD | NEW | 
|---|
| 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 24 matching lines...) Expand all  Loading... | 
| 35         if (name != value)\ | 35         if (name != value)\ | 
| 36         {\ | 36         {\ | 
| 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 struct ParsedDomains | 
|  | 46 { | 
|  | 47   struct Domain { | 
|  | 48     String::size_type pos; | 
|  | 49     String::size_type len; | 
|  | 50     bool reverse; | 
|  | 51   }; | 
|  | 52   bool hasIncludes; | 
|  | 53   bool hasEmpty; | 
|  | 54   std::vector<Domain> domains; | 
|  | 55 | 
|  | 56   ParsedDomains() | 
|  | 57     : hasIncludes(false), hasEmpty(false) | 
|  | 58   { | 
|  | 59   } | 
|  | 60 }; | 
|  | 61 | 
| 45 class ActiveFilter : public Filter | 62 class ActiveFilter : public Filter | 
| 46 { | 63 { | 
| 47 public: | 64 public: | 
| 48   typedef StringMap<bool> DomainMap; | 65   typedef StringMap<bool> DomainMap; | 
| 49   virtual DomainMap* GetDomains() const; | 66   virtual DomainMap* GetDomains() const; | 
| 50 protected: | 67 protected: | 
| 51   typedef StringSet SitekeySet; | 68   typedef StringSet SitekeySet; | 
| 52   void ParseDomains(const String& domains, String::value_type separator) const; | 69   static ParsedDomains ParseDomainsInternal(const String& domains, | 
|  | 70       String::value_type separator, bool ignoreTrailingDot); | 
|  | 71   void FillDomains(const String& domains, const ParsedDomains& parsed) const; | 
|  | 72   void ParseDomains(const String& domains, | 
|  | 73       String::value_type separator, bool ignoreTrailingDot) const; | 
| 53   void AddSitekey(const String& sitekey) const; | 74   void AddSitekey(const String& sitekey) const; | 
| 54   virtual SitekeySet* GetSitekeys() const; | 75   virtual SitekeySet* GetSitekeys() const; | 
| 55   mutable std::unique_ptr<DomainMap> mDomains; | 76   mutable std::unique_ptr<DomainMap> mDomains; | 
| 56   mutable std::unique_ptr<SitekeySet> mSitekeys; | 77   mutable std::unique_ptr<SitekeySet> mSitekeys; | 
| 57 private: | 78 private: | 
| 58   bool mIgnoreTrailingDot; | 79   bool mIgnoreTrailingDot; | 
| 59 public: | 80 public: | 
| 60   static constexpr Type classType = Type::ACTIVE; | 81   static constexpr Type classType = Type::ACTIVE; | 
| 61   explicit ActiveFilter(Type type, const String& text, bool ignoreTrailingDot); | 82   explicit ActiveFilter(Type type, const String& text, bool ignoreTrailingDot); | 
| 62   FILTER_PROPERTY(bool, mDisabled, FILTER_DISABLED, GetDisabled, SetDisabled); | 83   FILTER_PROPERTY(bool, mDisabled, FILTER_DISABLED, GetDisabled, SetDisabled); | 
| 63   FILTER_PROPERTY(unsigned int, mHitCount, FILTER_HITCOUNT, | 84   FILTER_PROPERTY(unsigned int, mHitCount, FILTER_HITCOUNT, | 
| 64       GetHitCount, SetHitCount); | 85       GetHitCount, SetHitCount); | 
| 65   FILTER_PROPERTY(unsigned int, mLastHit, FILTER_LASTHIT, | 86   FILTER_PROPERTY(unsigned int, mLastHit, FILTER_LASTHIT, | 
| 66       GetLastHit, SetLastHit); | 87       GetLastHit, SetLastHit); | 
| 67   bool BINDINGS_EXPORTED IsActiveOnDomain(DependentString& docDomain, | 88   bool BINDINGS_EXPORTED IsActiveOnDomain(DependentString& docDomain, | 
| 68       const String& sitekey) const; | 89       const String& sitekey) const; | 
| 69   bool BINDINGS_EXPORTED IsActiveOnlyOnDomain(DependentString& docDomain) const; | 90   bool BINDINGS_EXPORTED IsActiveOnlyOnDomain(DependentString& docDomain) const; | 
| 70   bool BINDINGS_EXPORTED IsGeneric() const; | 91   bool BINDINGS_EXPORTED IsGeneric() const; | 
| 71   OwnedString BINDINGS_EXPORTED Serialize() const; | 92   OwnedString BINDINGS_EXPORTED Serialize() const; | 
| 72 }; | 93 }; | 
| 73 | 94 | 
| 74 typedef intrusive_ptr<ActiveFilter> ActiveFilterPtr; | 95 typedef intrusive_ptr<ActiveFilter> ActiveFilterPtr; | 
| OLD | NEW | 
|---|