| Index: include/AdblockPlus/JsValue.h |
| =================================================================== |
| new file mode 100644 |
| --- /dev/null |
| +++ b/include/AdblockPlus/JsValue.h |
| @@ -0,0 +1,43 @@ |
| +#ifndef ADBLOCKPLUS_JS_VALUE_H |
| +#define ADBLOCKPLUS_JS_VALUE_H |
| + |
| +#include <v8.h> |
| + |
| +namespace AdblockPlus |
| +{ |
| + class JsEngine; |
| + class JsValue; |
| + |
| + 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
|
| + |
| + class JsValue |
| + { |
| + friend class JsEngine; |
| + public: |
| + virtual ~JsValue(); |
| + |
| + bool IsUndefined() const; |
| + bool IsNull() const; |
| + bool IsString() const; |
| + bool IsNumber() const; |
| + bool IsBool() const; |
| + bool IsObject() const; |
| + std::string AsString() const; |
| + int64_t AsInt() const; |
| + bool AsBool() const; |
| + JsValuePtr GetProperty(const std::string& name) const; |
| + void SetProperty(const std::string& name, const std::string& val); |
| + void SetProperty(const std::string& name, int64_t val); |
| + void SetProperty(const std::string& name, bool val); |
| + protected: |
| + JsValue(v8::Isolate* isolate, v8::Handle<v8::Context> context, |
| + v8::Handle<v8::Value> value); |
| + void SetProperty(const std::string& name, v8::Handle<v8::Value> val); |
| + |
| + v8::Isolate* isolate; |
| + v8::Persistent<v8::Context> context; |
| + v8::Persistent<v8::Value> value; |
| + }; |
| +} |
| + |
| +#endif |