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

Delta Between Two Patch Sets: include/AdblockPlus/JsValue.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/JsEngine.h ('k') | lib/api.js » ('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_JS_VALUE_H 1 #ifndef ADBLOCKPLUS_JS_VALUE_H
2 #define ADBLOCKPLUS_JS_VALUE_H 2 #define ADBLOCKPLUS_JS_VALUE_H
3 3
4 #include <vector> 4 #include <vector>
5 #include <v8.h> 5 #include <v8.h>
6 #ifdef _MSC_VER 6 #ifdef _MSC_VER
7 #include <memory> 7 #include <memory>
8 #else 8 #else
9 #include <tr1/memory> 9 #include <tr1/memory>
10 #endif 10 #endif
(...skipping 28 matching lines...) Expand all
39 JsValuePtr GetProperty(const std::string& name) const; 39 JsValuePtr GetProperty(const std::string& name) const;
40 void SetProperty(const std::string& name, const std::string& val); 40 void SetProperty(const std::string& name, const std::string& val);
41 void SetProperty(const std::string& name, int64_t val); 41 void SetProperty(const std::string& name, int64_t val);
42 void SetProperty(const std::string& name, bool val); 42 void SetProperty(const std::string& name, bool val);
43 inline void SetProperty(const std::string& name, const char* val) 43 inline void SetProperty(const std::string& name, const char* val)
44 { 44 {
45 SetProperty(name, std::string(val)); 45 SetProperty(name, std::string(val));
46 } 46 }
47 inline void SetProperty(const std::string& name, int val) 47 inline void SetProperty(const std::string& name, int val)
48 { 48 {
49 SetProperty(name, (int64_t)val); 49 SetProperty(name, static_cast<int64_t>(val));
Felix Dahlke 2013/04/16 15:14:33 As above, I'd prefer static_cast.
50 } 50 }
51 std::string GetClassName() const; 51 std::string GetClassName() const;
52 JsValuePtr Call(const JsValueList& params = JsValueList(), 52 JsValuePtr Call(const JsValueList& params = JsValueList(),
53 AdblockPlus::JsValuePtr thisPtr = AdblockPlus::JsValuePtr()) const; 53 AdblockPlus::JsValuePtr thisPtr = AdblockPlus::JsValuePtr()) const;
54 protected: 54 protected:
55 JsValue(JsEngine& jsEngine, v8::Handle<v8::Value> value); 55 JsValue(JsEngine& jsEngine, v8::Handle<v8::Value> value);
56 void SetProperty(const std::string& name, v8::Handle<v8::Value> val); 56 void SetProperty(const std::string& name, v8::Handle<v8::Value> val);
57 57
58 JsEngine& jsEngine; 58 JsEngine& jsEngine;
59 v8::Persistent<v8::Value> value; 59 v8::Persistent<v8::Value> value;
60 }; 60 };
61 } 61 }
62 62
63 #endif 63 #endif
LEFTRIGHT

Powered by Google App Engine
This is Rietveld