LEFT | RIGHT |
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 22 matching lines...) Expand all Loading... |
33 bool IsArray() const; | 33 bool IsArray() const; |
34 bool IsFunction() const; | 34 bool IsFunction() const; |
35 std::string AsString() const; | 35 std::string AsString() const; |
36 int64_t AsInt() const; | 36 int64_t AsInt() const; |
37 bool AsBool() const; | 37 bool AsBool() const; |
38 JsValueList AsList() const; | 38 JsValueList AsList() const; |
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 void inline 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 } |
| 47 inline void SetProperty(const std::string& name, int val) |
| 48 { |
| 49 SetProperty(name, static_cast<int64_t>(val)); |
46 } | 50 } |
47 std::string GetClassName() const; | 51 std::string GetClassName() const; |
48 JsValuePtr Call(const JsValueList& params = JsValueList(), | 52 JsValuePtr Call(const JsValueList& params = JsValueList(), |
49 AdblockPlus::JsValuePtr thisPtr = AdblockPlus::JsValuePtr()) const; | 53 AdblockPlus::JsValuePtr thisPtr = AdblockPlus::JsValuePtr()) const; |
50 protected: | 54 protected: |
51 JsValue(JsEngine& jsEngine, v8::Handle<v8::Value> value); | 55 JsValue(JsEngine& jsEngine, v8::Handle<v8::Value> value); |
52 void SetProperty(const std::string& name, v8::Handle<v8::Value> val); | 56 void SetProperty(const std::string& name, v8::Handle<v8::Value> val); |
53 | 57 |
54 JsEngine& jsEngine; | 58 JsEngine& jsEngine; |
55 v8::Persistent<v8::Value> value; | 59 v8::Persistent<v8::Value> value; |
56 }; | 60 }; |
57 } | 61 } |
58 | 62 |
59 #endif | 63 #endif |
LEFT | RIGHT |