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

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

Issue 10213003: Make JsEngine::Evaluate() return a wrapper for v8::Value to accessdifferent variable types easily (Closed)
Left Patch Set: Added tests, resolved type conversion ambiguities, implemented some missing API calls Created April 15, 2013, 6:23 a.m.
Right Patch Set: Addressed review comments Created April 17, 2013, 7:56 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 | « include/AdblockPlus.h ('k') | include/AdblockPlus/JsEngine.h » ('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 #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 }
33 inline int64_t GetProperty(const std::string& name, int defaultValue) const 30 inline int64_t GetProperty(const std::string& name, int defaultValue) const
34 { 31 {
35 return GetProperty(name, (int64_t)defaultValue); 32 return GetProperty(name, static_cast<int64_t>(defaultValue));
36 } 33 }
37 34
38 #if FILTER_ENGINE_STUBS 35 #if FILTER_ENGINE_STUBS
39 void SetProperty(const std::string& name, const std::string& value); 36 void SetProperty(const std::string& name, const std::string& value);
40 void SetProperty(const std::string& name, int64_t value); 37 void SetProperty(const std::string& name, int64_t value);
41 void SetProperty(const std::string& name, bool value); 38 void SetProperty(const std::string& name, bool value);
42 inline void SetProperty(const std::string& name, const char* value) 39 inline void SetProperty(const std::string& name, const char* value)
43 { 40 {
44 SetProperty(name, std::string(value)); 41 SetProperty(name, std::string(value));
45 } 42 }
46 inline void SetProperty(const std::string& name, int value) 43 inline void SetProperty(const std::string& name, int value)
47 { 44 {
48 SetProperty(name, (int64_t)value); 45 SetProperty(name, static_cast<int64_t>(value));
49 } 46 }
50 #endif 47 #endif
51 48
52 protected: 49 protected:
53 #if FILTER_ENGINE_STUBS 50 #if FILTER_ENGINE_STUBS
54 JsObject(FilterEngine& filterEngine); 51 JsObject(FilterEngine& filterEngine);
55 52
56 FilterEngine& filterEngine; 53 FilterEngine& filterEngine;
57 std::map<std::string, std::string> stringProperties; 54 std::map<std::string, std::string> stringProperties;
58 std::map<std::string, int64_t> intProperties; 55 std::map<std::string, int64_t> intProperties;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 #if FILTER_ENGINE_STUBS 129 #if FILTER_ENGINE_STUBS
133 std::map<std::string, FilterPtr> knownFilters; 130 std::map<std::string, FilterPtr> knownFilters;
134 std::vector<FilterPtr> listedFilters; 131 std::vector<FilterPtr> listedFilters;
135 std::map<std::string, SubscriptionPtr> knownSubscriptions; 132 std::map<std::string, SubscriptionPtr> knownSubscriptions;
136 std::vector<SubscriptionPtr> listedSubscriptions; 133 std::vector<SubscriptionPtr> listedSubscriptions;
137 #endif 134 #endif
138 }; 135 };
139 } 136 }
140 137
141 #endif 138 #endif
LEFTRIGHT

Powered by Google App Engine
This is Rietveld