| Index: include/AdblockPlus/JsValue.h |
| =================================================================== |
| --- a/include/AdblockPlus/JsValue.h |
| +++ b/include/AdblockPlus/JsValue.h |
| @@ -18,31 +18,35 @@ |
| #ifndef ADBLOCK_PLUS_JS_VALUE_H |
| #define ADBLOCK_PLUS_JS_VALUE_H |
| #include <stdint.h> |
| #include <string> |
| #include <vector> |
| #include <memory> |
| +#include <AdblockPlus/IFileSystem.h> |
| + |
| namespace v8 |
| { |
| class Value; |
| class Object; |
| template<class T> class Local; |
| template<class T> class Global; |
| } |
| namespace AdblockPlus |
| { |
| class JsValue; |
| class JsEngine; |
| typedef std::shared_ptr<JsEngine> JsEnginePtr; |
| + typedef IFileSystem::IOBuffer StringBuffer; |
| + |
| /** |
| * List of JavaScript values. |
| */ |
| typedef std::vector<AdblockPlus::JsValue> JsValueList; |
| /** |
| * Wrapper for JavaScript values. |
| * See `JsEngine` for creating `JsValue` objects. |
| @@ -62,16 +66,17 @@ |
| bool IsNull() const; |
| bool IsString() const; |
| bool IsNumber() const; |
| bool IsBool() const; |
| bool IsObject() const; |
| bool IsArray() const; |
| bool IsFunction() const; |
| std::string AsString() const; |
| + StringBuffer AsStringBuffer() const; |
| int64_t AsInt() const; |
| bool AsBool() const; |
| JsValueList AsList() const; |
| /** |
| * Returns a list of property names if this is an object (see `IsObject()`). |
| * @return List of property names. |
| */ |
| @@ -87,28 +92,35 @@ |
| //@{ |
| /** |
| * Sets a property value if this is an object (see `IsObject()`). |
| * @param name Property name. |
| * @param val Property value. |
| */ |
| void SetProperty(const std::string& name, const std::string& val); |
| + void SetProperty(const std::string& name, const StringBuffer& val); |
| void SetProperty(const std::string& name, int64_t val); |
| void SetProperty(const std::string& name, bool val); |
| void SetProperty(const std::string& name, const JsValue& value); |
| inline void SetProperty(const std::string& name, const char* val) |
| { |
| SetProperty(name, std::string(val)); |
| } |
| inline void SetProperty(const std::string& name, int val) |
| { |
| SetProperty(name, static_cast<int64_t>(val)); |
| } |
| //@} |
| + /** |
| + * Sets a property value string if this is an object (see `IsObject()`). |
| + * @param name Property name. |
| + * @param val Property value as a StringBuffer. |
| + */ |
| + void SetStringBufferProperty(const std::string& name, const StringBuffer& val); |
| /** |
| * Returns the value's class name, e.g.\ _Array_ for arrays |
| * (see `IsArray()`). |
| * Technically, this is the name of the function that was used as a |
| * constructor. |
| * @return Class name of the value. |
| */ |