| Left: | ||
| Right: |
| LEFT | RIGHT |
|---|---|
| 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 _WIN32 || _WIN64 | 7 #ifdef WIN32 |
|
Wladimir Palant
2013/04/09 05:47:07
I would prefer #if _MSC_VER_ here - it's cleaner,
| |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <cctype> | |
| 10 #include <functional> | |
|
Wladimir Palant
2013/04/09 05:47:07
Are these two headers really required on Windows?
Oleksandr
2013/04/09 05:54:21
<cctype> - for isspace
<functional> - for not1 and
Wladimir Palant
2013/04/09 06:43:48
Then they should be added at the top of FilterEngi
Felix Dahlke
2013/04/09 08:18:06
If it compiles on Linux/Android without them, they
Wladimir Palant
2013/04/09 08:38:32
We are using functions from these headers. It mere
| |
| 11 #else | 9 #else |
| 12 #include <tr1/memory> | 10 #include <tr1/memory> |
| 13 #endif | 11 #endif |
| 14 | |
| 15 namespace AdblockPlus | 12 namespace AdblockPlus |
| 16 { | 13 { |
| 17 class JsEngine; | 14 class JsEngine; |
| 18 class FilterEngine; | 15 class FilterEngine; |
| 19 | 16 |
| 20 class JsObject | 17 class JsObject |
| 21 { | 18 { |
| 22 public: | 19 public: |
| 23 std::string GetProperty(const std::string& name, const std::string& defaultV alue) const; | 20 std::string GetProperty(const std::string& name, const std::string& defaultV alue) const; |
| 24 int GetProperty(const std::string& name, int defaultValue) const; | 21 int GetProperty(const std::string& name, int defaultValue) const; |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 42 | 39 |
| 43 FilterEngine& filterEngine; | 40 FilterEngine& filterEngine; |
| 44 std::map<std::string, std::string> stringProperties; | 41 std::map<std::string, std::string> stringProperties; |
| 45 std::map<std::string, int> intProperties; | 42 std::map<std::string, int> intProperties; |
| 46 std::map<std::string, bool> boolProperties; | 43 std::map<std::string, bool> boolProperties; |
| 47 #else | 44 #else |
| 48 JsObject(); | 45 JsObject(); |
| 49 #endif | 46 #endif |
| 50 }; | 47 }; |
| 51 | 48 |
| 52 enum FilterType {BLOCKING_RULE, EXCEPTION_RULE, | |
| 53 ELEMHIDE_RULE, ELEMHIDE_EXCEPTION_RULE, | |
| 54 COMMENT_RULE, INVALID_RULE}; | |
| 55 | |
| 56 class Filter : public JsObject, | 49 class Filter : public JsObject, |
| 57 public std::tr1::enable_shared_from_this<Filter> | 50 public std::tr1::enable_shared_from_this<Filter> |
| 58 { | 51 { |
| 59 friend class FilterEngine; | 52 friend class FilterEngine; |
| 60 | 53 |
| 61 public: | 54 public: |
| 55 enum Type {TYPE_BLOCKING, TYPE_EXCEPTION, | |
| 56 TYPE_ELEMHIDE, TYPE_ELEMHIDE_EXCEPTION, | |
| 57 TYPE_COMMENT, TYPE_INVALID}; | |
| 58 | |
| 62 bool IsListed() const; | 59 bool IsListed() const; |
| 63 void AddToList(); | 60 void AddToList(); |
| 64 void RemoveFromList(); | 61 void RemoveFromList(); |
| 65 | 62 |
| 66 private: | 63 private: |
| 67 #if FILTER_ENGINE_STUBS | 64 #if FILTER_ENGINE_STUBS |
| 68 Filter(FilterEngine& filterEngine, const std::string& text); | 65 Filter(FilterEngine& filterEngine, const std::string& text); |
| 69 #else | 66 #else |
| 70 Filter(); | 67 Filter(); |
| 71 #endif | 68 #endif |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 115 #if FILTER_ENGINE_STUBS | 112 #if FILTER_ENGINE_STUBS |
| 116 std::map<std::string, FilterPtr> knownFilters; | 113 std::map<std::string, FilterPtr> knownFilters; |
| 117 std::vector<FilterPtr> listedFilters; | 114 std::vector<FilterPtr> listedFilters; |
| 118 std::map<std::string, SubscriptionPtr> knownSubscriptions; | 115 std::map<std::string, SubscriptionPtr> knownSubscriptions; |
| 119 std::vector<SubscriptionPtr> listedSubscriptions; | 116 std::vector<SubscriptionPtr> listedSubscriptions; |
| 120 #endif | 117 #endif |
| 121 }; | 118 }; |
| 122 } | 119 } |
| 123 | 120 |
| 124 #endif | 121 #endif |
| LEFT | RIGHT |