18 #ifndef ADBLOCK_PLUS_JS_VALUE_H
19 #define ADBLOCK_PLUS_JS_VALUE_H
26 #include <AdblockPlus/IFileSystem.h>
65 bool IsUndefined()
const;
67 bool IsString()
const;
68 bool IsNumber()
const;
70 bool IsObject()
const;
72 bool IsFunction()
const;
73 std::string AsString()
const;
74 StringBuffer AsStringBuffer()
const;
75 int64_t AsInt()
const;
77 JsValueList AsList()
const;
99 void SetProperty(
const std::string& name,
const std::string& val);
100 void SetProperty(
const std::string& name,
const StringBuffer& val);
101 void SetProperty(
const std::string& name, int64_t val);
102 void SetProperty(
const std::string& name,
bool val);
155 JsEnginePtr jsEngine;
164 std::unique_ptr<v8::Global<v8::Value>> value;
void SetProperty(const std::string &name, const char *val)
Sets a property value if this is an object (see IsObject()).
Definition: JsValue.h:104
void SetStringBufferProperty(const std::string &name, const StringBuffer &val)
Sets a property value string if this is an object (see IsObject()).
std::vector< std::string > GetOwnPropertyNames() const
Returns a list of property names if this is an object (see IsObject()).
JavaScript engine used by FilterEngine, wraps v8.
Definition: JsEngine.h:73
std::vector< AdblockPlus::JsValue > JsValueList
List of JavaScript values.
Definition: JsValue.h:48
void SetProperty(const std::string &name, int val)
Sets a property value if this is an object (see IsObject()).
Definition: JsValue.h:108
Wrapper for JavaScript values.
Definition: JsValue.h:54
JsValue GetProperty(const std::string &name) const
Returns a property value if this is an object (see IsObject()).
void SetProperty(const std::string &name, const std::string &val)
Sets a property value if this is an object (see IsObject()).
Main namespace of libadblockplus.
Definition: ActiveObject.h:23
Definition: JsEngine.h:36
std::string GetClass() const
Returns the value's class name, e.g. Array for arrays (see IsArray()).
std::vector< uint8_t > IOBuffer
Type for the buffer used for IO.
Definition: IFileSystem.h:61
JsValue Call(const JsValueList ¶ms=JsValueList()) const
Invokes the value as a function (see IsFunction()).
std::shared_ptr< JsEngine > JsEnginePtr
Shared smart pointer to a JsEngine instance.
Definition: JsEngine.h:48