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

Delta Between Two Patch Sets: include/AdblockPlus/FilterEngine.h

Issue 10100009: FilterEngine API improvements (Closed)
Left Patch Set: Addressed review comments Created April 8, 2013, 1:51 p.m.
Right Patch Set: Changed filter type enum Created April 9, 2013, 5:55 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | shell/src/FiltersCommand.cpp » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 #include <tr1/memory> 7 #include <tr1/memory>
Felix Dahlke 2013/04/08 15:03:59 As of GCC 4.6 (we can assume that on Android with
Wladimir Palant 2013/04/09 05:56:34 Not sure about the NDK but on Linux #include <memo
8 8
9 namespace AdblockPlus 9 namespace AdblockPlus
10 { 10 {
11 class JsEngine; 11 class JsEngine;
12 class FilterEngine; 12 class FilterEngine;
13 13
14 class JsObject 14 class JsObject
15 { 15 {
16 public: 16 public:
17 std::string GetProperty(const std::string& name, const std::string& defaultV alue) const; 17 std::string GetProperty(const std::string& name, const std::string& defaultV alue) const;
(...skipping 18 matching lines...) Expand all
36 36
37 FilterEngine& filterEngine; 37 FilterEngine& filterEngine;
38 std::map<std::string, std::string> stringProperties; 38 std::map<std::string, std::string> stringProperties;
39 std::map<std::string, int> intProperties; 39 std::map<std::string, int> intProperties;
40 std::map<std::string, bool> boolProperties; 40 std::map<std::string, bool> boolProperties;
41 #else 41 #else
42 JsObject(); 42 JsObject();
43 #endif 43 #endif
44 }; 44 };
45 45
46 enum FilterType {BLOCKING_RULE, EXCEPTION_RULE,
Felix Dahlke 2013/04/08 15:03:59 I'd move this into the public section of Filter, s
47 ELEMHIDE_RULE, ELEMHIDE_EXCEPTION_RULE,
48 COMMENT_RULE, INVALID_RULE};
49
50 class Filter : public JsObject, 46 class Filter : public JsObject,
51 public std::tr1::enable_shared_from_this<Filter> 47 public std::tr1::enable_shared_from_this<Filter>
52 { 48 {
53 friend class FilterEngine; 49 friend class FilterEngine;
54 50
55 public: 51 public:
52 enum Type {TYPE_BLOCKING, TYPE_EXCEPTION,
53 TYPE_ELEMHIDE, TYPE_ELEMHIDE_EXCEPTION,
54 TYPE_COMMENT, TYPE_INVALID};
55
56 bool IsListed() const; 56 bool IsListed() const;
57 void AddToList(); 57 void AddToList();
58 void RemoveFromList(); 58 void RemoveFromList();
59 59
60 private: 60 private:
61 #if FILTER_ENGINE_STUBS 61 #if FILTER_ENGINE_STUBS
62 Filter(FilterEngine& filterEngine, const std::string& text); 62 Filter(FilterEngine& filterEngine, const std::string& text);
63 #else 63 #else
64 Filter(); 64 Filter();
65 #endif 65 #endif
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 #if FILTER_ENGINE_STUBS 109 #if FILTER_ENGINE_STUBS
110 std::map<std::string, FilterPtr> knownFilters; 110 std::map<std::string, FilterPtr> knownFilters;
111 std::vector<FilterPtr> listedFilters; 111 std::vector<FilterPtr> listedFilters;
112 std::map<std::string, SubscriptionPtr> knownSubscriptions; 112 std::map<std::string, SubscriptionPtr> knownSubscriptions;
113 std::vector<SubscriptionPtr> listedSubscriptions; 113 std::vector<SubscriptionPtr> listedSubscriptions;
114 #endif 114 #endif
115 }; 115 };
116 } 116 }
117 117
118 #endif 118 #endif
LEFTRIGHT

Powered by Google App Engine
This is Rietveld