OLD | NEW |
1 #ifndef ADBLOCKPLUS_FILTER_ENGINE_H | 1 #ifndef ADBLOCKPLUS_FILTER_ENGINE_H |
2 #define ADBLOCKPLUS_FILTER_ENGINE_H | 2 #define ADBLOCKPLUS_FILTER_ENGINE_H |
3 | 3 |
4 #include <vector> | 4 #include <vector> |
5 #include <map> | 5 #include <map> |
6 #include <string> | 6 #include <string> |
7 #ifdef _MSC_VER | 7 #ifdef _MSC_VER |
8 #include <memory> | 8 #include <memory> |
9 #else | 9 #else |
10 #include <tr1/memory> | 10 #include <tr1/memory> |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 typedef std::tr1::shared_ptr<Filter> FilterPtr; | 90 typedef std::tr1::shared_ptr<Filter> FilterPtr; |
91 typedef std::tr1::shared_ptr<Subscription> SubscriptionPtr; | 91 typedef std::tr1::shared_ptr<Subscription> SubscriptionPtr; |
92 typedef void (*SubscriptionsCallback)(const std::vector<SubscriptionPtr>&); | 92 typedef void (*SubscriptionsCallback)(const std::vector<SubscriptionPtr>&); |
93 | 93 |
94 class FilterEngine | 94 class FilterEngine |
95 { | 95 { |
96 friend class Filter; | 96 friend class Filter; |
97 friend class Subscription; | 97 friend class Subscription; |
98 public: | 98 public: |
99 explicit FilterEngine(JsEngine& jsEngine); | 99 explicit FilterEngine(JsEngine& jsEngine); |
100 Filter& GetFilter(const std::string& text); | 100 FilterPtr GetFilter(const std::string& text); |
101 Subscription& GetSubscription(const std::string& url); | 101 SubscriptionPtr GetSubscription(const std::string& url); |
102 const std::vector<FilterPtr>& GetListedFilters() const; | 102 const std::vector<FilterPtr>& GetListedFilters() const; |
103 const std::vector<SubscriptionPtr>& GetListedSubscriptions() const; | 103 const std::vector<SubscriptionPtr>& GetListedSubscriptions() const; |
104 void FetchAvailableSubscriptions(SubscriptionsCallback callback); | 104 void FetchAvailableSubscriptions(SubscriptionsCallback callback); |
105 FilterPtr Matches(const std::string& url, | 105 FilterPtr Matches(const std::string& url, |
106 const std::string& contentType, | 106 const std::string& contentType, |
107 const std::string& documentUrl); | 107 const std::string& documentUrl); |
108 std::vector<std::string> GetElementHidingSelectors(const std::string& domain
) const; | 108 std::vector<std::string> GetElementHidingSelectors(const std::string& domain
) const; |
109 | 109 |
110 private: | 110 private: |
111 JsEngine& jsEngine; | 111 JsEngine& jsEngine; |
112 #if FILTER_ENGINE_STUBS | 112 #if FILTER_ENGINE_STUBS |
113 std::map<std::string, FilterPtr> knownFilters; | 113 std::map<std::string, FilterPtr> knownFilters; |
114 std::vector<FilterPtr> listedFilters; | 114 std::vector<FilterPtr> listedFilters; |
115 std::map<std::string, SubscriptionPtr> knownSubscriptions; | 115 std::map<std::string, SubscriptionPtr> knownSubscriptions; |
116 std::vector<SubscriptionPtr> listedSubscriptions; | 116 std::vector<SubscriptionPtr> listedSubscriptions; |
117 #endif | 117 #endif |
118 }; | 118 }; |
119 } | 119 } |
120 | 120 |
121 #endif | 121 #endif |
OLD | NEW |