OLD | NEW |
(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; |
| 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 |
OLD | NEW |