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

Side by Side Diff: include/AdblockPlus/JsValue.h

Issue 10213003: Make JsEngine::Evaluate() return a wrapper for v8::Value to accessdifferent variable types easily (Closed)
Patch Set: Created April 12, 2013, 2:55 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/AdblockPlus/JsEngine.h ('k') | libadblockplus.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #ifndef ADBLOCKPLUS_JS_VALUE_H
2 #define ADBLOCKPLUS_JS_VALUE_H
3
4 #include <v8.h>
5
6 namespace AdblockPlus
7 {
8 class JsEngine;
9 class JsValue;
10
11 typedef std::tr1::shared_ptr<JsValue> JsValuePtr;
Wladimir Palant 2013/04/13 20:44:21 I only realized now that I didn't include tr1/memo
12
13 class JsValue
14 {
15 friend class JsEngine;
16 public:
17 virtual ~JsValue();
18
19 bool IsUndefined() const;
20 bool IsNull() const;
21 bool IsString() const;
22 bool IsNumber() const;
23 bool IsBool() const;
24 bool IsObject() const;
25 std::string AsString() const;
26 int64_t AsInt() const;
27 bool AsBool() const;
28 JsValuePtr GetProperty(const std::string& name) const;
29 void SetProperty(const std::string& name, const std::string& val);
30 void SetProperty(const std::string& name, int64_t val);
31 void SetProperty(const std::string& name, bool val);
32 protected:
33 JsValue(v8::Isolate* isolate, v8::Handle<v8::Context> context,
34 v8::Handle<v8::Value> value);
35 void SetProperty(const std::string& name, v8::Handle<v8::Value> val);
36
37 v8::Isolate* isolate;
38 v8::Persistent<v8::Context> context;
39 v8::Persistent<v8::Value> value;
40 };
41 }
42
43 #endif
OLDNEW
« no previous file with comments | « include/AdblockPlus/JsEngine.h ('k') | libadblockplus.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld