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

Side by Side Diff: include/AdblockPlus/FilterEngine.h

Issue 10236010: Always work with pointers to filters and subscriptions, drop the references for API consistency (Closed)
Patch Set: Created April 11, 2013, 7:24 a.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 | « no previous file | shell/src/FiltersCommand.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « no previous file | shell/src/FiltersCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld