OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-2017 eyeo GmbH | 3 * Copyright (C) 2006-2017 eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 | 60 |
61 bool IsUndefined() const; | 61 bool IsUndefined() const; |
62 bool IsNull() const; | 62 bool IsNull() const; |
63 bool IsString() const; | 63 bool IsString() const; |
64 bool IsNumber() const; | 64 bool IsNumber() const; |
65 bool IsBool() const; | 65 bool IsBool() const; |
66 bool IsObject() const; | 66 bool IsObject() const; |
67 bool IsArray() const; | 67 bool IsArray() const; |
68 bool IsFunction() const; | 68 bool IsFunction() const; |
69 std::string AsString() const; | 69 std::string AsString() const; |
| 70 std::vector<char> AsBuffer() const; |
70 int64_t AsInt() const; | 71 int64_t AsInt() const; |
71 bool AsBool() const; | 72 bool AsBool() const; |
72 JsValueList AsList() const; | 73 JsValueList AsList() const; |
73 | 74 |
74 /** | 75 /** |
75 * Returns a list of property names if this is an object (see `IsObject()`). | 76 * Returns a list of property names if this is an object (see `IsObject()`). |
76 * @return List of property names. | 77 * @return List of property names. |
77 */ | 78 */ |
78 std::vector<std::string> GetOwnPropertyNames() const; | 79 std::vector<std::string> GetOwnPropertyNames() const; |
79 | 80 |
80 /** | 81 /** |
81 * Returns a property value if this is an object (see `IsObject()`). | 82 * Returns a property value if this is an object (see `IsObject()`). |
82 * @param name Property name. | 83 * @param name Property name. |
83 * @return Property value, undefined (see `IsUndefined()`) if the property | 84 * @return Property value, undefined (see `IsUndefined()`) if the property |
84 * does not exist. | 85 * does not exist. |
85 */ | 86 */ |
86 JsValue GetProperty(const std::string& name) const; | 87 JsValue GetProperty(const std::string& name) const; |
87 | 88 |
88 //@{ | 89 //@{ |
89 /** | 90 /** |
90 * Sets a property value if this is an object (see `IsObject()`). | 91 * Sets a property value if this is an object (see `IsObject()`). |
91 * @param name Property name. | 92 * @param name Property name. |
92 * @param val Property value. | 93 * @param val Property value. |
93 */ | 94 */ |
94 void SetProperty(const std::string& name, const std::string& val); | 95 void SetProperty(const std::string& name, const std::string& val); |
| 96 void SetProperty(const std::string& name, const std::vector<char>& val); |
95 void SetProperty(const std::string& name, int64_t val); | 97 void SetProperty(const std::string& name, int64_t val); |
96 void SetProperty(const std::string& name, bool val); | 98 void SetProperty(const std::string& name, bool val); |
97 void SetProperty(const std::string& name, const JsValue& value); | 99 void SetProperty(const std::string& name, const JsValue& value); |
98 inline void SetProperty(const std::string& name, const char* val) | 100 inline void SetProperty(const std::string& name, const char* val) |
99 { | 101 { |
100 SetProperty(name, std::string(val)); | 102 SetProperty(name, std::string(val)); |
101 } | 103 } |
102 inline void SetProperty(const std::string& name, int val) | 104 inline void SetProperty(const std::string& name, int val) |
103 { | 105 { |
104 SetProperty(name, static_cast<int64_t>(val)); | 106 SetProperty(name, static_cast<int64_t>(val)); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 | 149 |
148 // Parameter args is not const because a pointer to its internal arrays is | 150 // Parameter args is not const because a pointer to its internal arrays is |
149 // passed to v8::Function::Call but the latter does not expect a const point
er. | 151 // passed to v8::Function::Call but the latter does not expect a const point
er. |
150 JsValue Call(std::vector<v8::Local<v8::Value>>& args, v8::Local<v8::Object>
thisObj) const; | 152 JsValue Call(std::vector<v8::Local<v8::Value>>& args, v8::Local<v8::Object>
thisObj) const; |
151 | 153 |
152 std::unique_ptr<v8::Global<v8::Value>> value; | 154 std::unique_ptr<v8::Global<v8::Value>> value; |
153 }; | 155 }; |
154 } | 156 } |
155 | 157 |
156 #endif | 158 #endif |
OLD | NEW |