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 _MSC_VER | |
8 #include <memory> | |
9 #else | |
10 #include <tr1/memory> | |
11 #endif | |
12 #include <AdblockPlus/JsValue.h> | 7 #include <AdblockPlus/JsValue.h> |
| 8 |
| 9 #include "tr1_memory.h" |
13 | 10 |
14 namespace AdblockPlus | 11 namespace AdblockPlus |
15 { | 12 { |
16 class JsEngine; | 13 class JsEngine; |
17 class FilterEngine; | 14 class FilterEngine; |
18 | 15 |
19 #if FILTER_ENGINE_STUBS | 16 #if FILTER_ENGINE_STUBS |
20 class JsObject | 17 class JsObject |
21 #else | 18 #else |
22 class JsObject : public JsValue | 19 class JsObject : public JsValue |
23 #endif | 20 #endif |
24 { | 21 { |
25 public: | 22 public: |
26 std::string GetProperty(const std::string& name, const std::string& defaultV
alue) const; | 23 std::string GetProperty(const std::string& name, const std::string& defaultV
alue) const; |
27 int64_t GetProperty(const std::string& name, int64_t defaultValue) const; | 24 int64_t GetProperty(const std::string& name, int64_t defaultValue) const; |
28 bool GetProperty(const std::string& name, bool defaultValue) const; | 25 bool GetProperty(const std::string& name, bool defaultValue) const; |
29 inline std::string GetProperty(const std::string& name, const char* defaultV
alue) const | 26 inline std::string GetProperty(const std::string& name, const char* defaultV
alue) const |
30 { | 27 { |
31 return GetProperty(name, std::string(defaultValue)); | 28 return GetProperty(name, std::string(defaultValue)); |
32 } | 29 } |
| 30 inline int64_t GetProperty(const std::string& name, int defaultValue) const |
| 31 { |
| 32 return GetProperty(name, static_cast<int64_t>(defaultValue)); |
| 33 } |
33 | 34 |
34 #if FILTER_ENGINE_STUBS | 35 #if FILTER_ENGINE_STUBS |
35 void SetProperty(const std::string& name, const std::string& value); | 36 void SetProperty(const std::string& name, const std::string& value); |
36 void SetProperty(const std::string& name, int64_t value); | 37 void SetProperty(const std::string& name, int64_t value); |
37 void SetProperty(const std::string& name, bool value); | 38 void SetProperty(const std::string& name, bool value); |
38 inline void SetProperty(const std::string& name, const char* value) | 39 inline void SetProperty(const std::string& name, const char* value) |
39 { | 40 { |
40 SetProperty(name, std::string(value)); | 41 SetProperty(name, std::string(value)); |
| 42 } |
| 43 inline void SetProperty(const std::string& name, int value) |
| 44 { |
| 45 SetProperty(name, static_cast<int64_t>(value)); |
41 } | 46 } |
42 #endif | 47 #endif |
43 | 48 |
44 protected: | 49 protected: |
45 #if FILTER_ENGINE_STUBS | 50 #if FILTER_ENGINE_STUBS |
46 JsObject(FilterEngine& filterEngine); | 51 JsObject(FilterEngine& filterEngine); |
47 | 52 |
48 FilterEngine& filterEngine; | 53 FilterEngine& filterEngine; |
49 std::map<std::string, std::string> stringProperties; | 54 std::map<std::string, std::string> stringProperties; |
50 std::map<std::string, int64_t> intProperties; | 55 std::map<std::string, int64_t> intProperties; |
(...skipping 26 matching lines...) Expand all Loading... |
77 }; | 82 }; |
78 | 83 |
79 class Subscription : public JsObject, | 84 class Subscription : public JsObject, |
80 public std::tr1::enable_shared_from_this<Subscription> | 85 public std::tr1::enable_shared_from_this<Subscription> |
81 { | 86 { |
82 public: | 87 public: |
83 bool IsListed(); | 88 bool IsListed(); |
84 void AddToList(); | 89 void AddToList(); |
85 void RemoveFromList(); | 90 void RemoveFromList(); |
86 void UpdateFilters(); | 91 void UpdateFilters(); |
| 92 bool IsUpdating(); |
87 bool operator==(const Subscription& subscription) const; | 93 bool operator==(const Subscription& subscription) const; |
88 | 94 |
89 #if FILTER_ENGINE_STUBS | 95 #if FILTER_ENGINE_STUBS |
90 private: | 96 private: |
91 friend class FilterEngine; | 97 friend class FilterEngine; |
92 Subscription(FilterEngine& filterEngine, const std::string& url); | 98 Subscription(FilterEngine& filterEngine, const std::string& url); |
93 #else | 99 #else |
94 Subscription(JsValuePtr value); | 100 Subscription(JsValuePtr value); |
95 #endif | 101 #endif |
96 }; | 102 }; |
(...skipping 26 matching lines...) Expand all Loading... |
123 #if FILTER_ENGINE_STUBS | 129 #if FILTER_ENGINE_STUBS |
124 std::map<std::string, FilterPtr> knownFilters; | 130 std::map<std::string, FilterPtr> knownFilters; |
125 std::vector<FilterPtr> listedFilters; | 131 std::vector<FilterPtr> listedFilters; |
126 std::map<std::string, SubscriptionPtr> knownSubscriptions; | 132 std::map<std::string, SubscriptionPtr> knownSubscriptions; |
127 std::vector<SubscriptionPtr> listedSubscriptions; | 133 std::vector<SubscriptionPtr> listedSubscriptions; |
128 #endif | 134 #endif |
129 }; | 135 }; |
130 } | 136 } |
131 | 137 |
132 #endif | 138 #endif |
LEFT | RIGHT |