| Index: include/AdblockPlus/JsValue.h |
| =================================================================== |
| --- a/include/AdblockPlus/JsValue.h |
| +++ b/include/AdblockPlus/JsValue.h |
| @@ -38,35 +38,36 @@ |
| class JsEngine; |
| typedef std::shared_ptr<JsEngine> JsEnginePtr; |
| /** |
| * Shared smart pointer to a `JsValue` instance. |
| */ |
| typedef std::shared_ptr<JsValue> JsValuePtr; |
| - typedef std::shared_ptr<const JsValue> JsConstValuePtr; |
| /** |
| * List of JavaScript values. |
| */ |
| - typedef std::vector<AdblockPlus::JsValuePtr> JsValueList; |
| - typedef std::vector<AdblockPlus::JsConstValuePtr> JsConstValueList; |
| + typedef std::vector<AdblockPlus::JsValue> JsValueList; |
| /** |
| * Wrapper for JavaScript values. |
| * See `JsEngine` for creating `JsValue` objects. |
| */ |
| class JsValue |
| { |
| friend class JsEngine; |
| public: |
| JsValue(JsValue&& src); |
| + JsValue(const JsValue& src); |
| virtual ~JsValue(); |
| + JsValue& operator=(const JsValue& src); |
|
sergei
2017/04/19 18:56:52
I think it would be useful to take the comment fro
hub
2017/04/19 21:56:49
I didn't think the assignment operator overload ne
|
| + |
| bool IsUndefined() const; |
| bool IsNull() const; |
| bool IsString() const; |
| bool IsNumber() const; |
| bool IsBool() const; |
| bool IsObject() const; |
| bool IsArray() const; |
| bool IsFunction() const; |
| @@ -119,34 +120,29 @@ |
| std::string GetClass() const; |
| /** |
| * Invokes the value as a function (see `IsFunction()`). |
| * @param params Optional list of parameters. |
| * @param thisPtr Optional `this` value. |
| * @return Value returned by the function. |
| */ |
| - JsValue Call(const JsConstValueList& params = JsConstValueList(), |
| + JsValue Call(const JsValueList& params = JsValueList(), |
| const AdblockPlus::JsValuePtr& thisPtr = AdblockPlus::JsValuePtr()) const; |
| /** |
| * Invokes the value as a function (see `IsFunction()`) with single |
| * parameter. |
| * @param arg A single required parameter. |
| * @return Value returned by the function. |
| */ |
| JsValue Call(const JsValue& arg) const; |
| v8::Local<v8::Value> UnwrapValue() const; |
| - /** |
| - * Creates a new `JsValue` wrapper for the same JavaScript value. |
| - * @return Value new `JsValue` |
| - */ |
| - JsValue Clone() const; |
| protected: |
| JsEnginePtr jsEngine; |
| private: |
| JsValue(JsEnginePtr jsEngine, v8::Handle<v8::Value> value); |
| void SetProperty(const std::string& name, v8::Handle<v8::Value> val); |
| // Parameter args is not const because a pointer to its internal arrays is |
| // passed to v8::Function::Call but the latter does not expect a const pointer. |
| JsValue Call(std::vector<v8::Handle<v8::Value>>& args, v8::Local<v8::Object> thisObj) const; |