libadblockplus
 All Classes Namespaces Functions Variables Typedefs Enumerations Pages
Public Member Functions | Protected Attributes | Friends | List of all members
AdblockPlus::JsValue Class Reference

Wrapper for JavaScript values. More...

#include <JsValue.h>

Inheritance diagram for AdblockPlus::JsValue:
Inheritance graph
[legend]

Public Member Functions

 JsValue (JsValue &&src)
 
 JsValue (const JsValue &src)
 
JsValueoperator= (const JsValue &src)
 
JsValueoperator= (JsValue &&src)
 
bool IsUndefined () const
 
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
 
std::vector< std::string > GetOwnPropertyNames () const
 Returns a list of property names if this is an object (see IsObject()). More...
 
JsValue GetProperty (const std::string &name) const
 Returns a property value if this is an object (see IsObject()). More...
 
void SetStringBufferProperty (const std::string &name, const StringBuffer &val)
 Sets a property value string if this is an object (see IsObject()). More...
 
std::string GetClass () const
 Returns the value's class name, e.g. Array for arrays (see IsArray()). More...
 
JsValue Call (const JsValueList &params=JsValueList()) const
 Invokes the value as a function (see IsFunction()). More...
 
JsValue Call (const JsValueList &params, const AdblockPlus::JsValue &thisValue) const
 Invokes the value as a method (see IsFunction()). More...
 
JsValue Call (const JsValue &arg) const
 Invokes the value as a function (see IsFunction()) with single parameter. More...
 
v8::Local< v8::Value > UnwrapValue () const
 
void SetProperty (const std::string &name, const std::string &val)
 Sets a property value if this is an object (see IsObject()). More...
 
void SetProperty (const std::string &name, const StringBuffer &val)
 Sets a property value if this is an object (see IsObject()). More...
 
void SetProperty (const std::string &name, int64_t val)
 Sets a property value if this is an object (see IsObject()). More...
 
void SetProperty (const std::string &name, bool val)
 Sets a property value if this is an object (see IsObject()). More...
 
void SetProperty (const std::string &name, const JsValue &value)
 Sets a property value if this is an object (see IsObject()). More...
 
void SetProperty (const std::string &name, const char *val)
 Sets a property value if this is an object (see IsObject()). More...
 
void SetProperty (const std::string &name, int val)
 Sets a property value if this is an object (see IsObject()). More...
 

Protected Attributes

JsEnginePtr jsEngine
 

Friends

class JsEngine
 

Detailed Description

Wrapper for JavaScript values.

See JsEngine for creating JsValue objects.

Member Function Documentation

JsValue AdblockPlus::JsValue::Call ( const JsValueList params = JsValueList()) const

Invokes the value as a function (see IsFunction()).

Parameters
paramsOptional list of parameters.
Returns
Value returned by the function.
JsValue AdblockPlus::JsValue::Call ( const JsValueList params,
const AdblockPlus::JsValue thisValue 
) const

Invokes the value as a method (see IsFunction()).

Parameters
paramslist of parameters.
thisPtrthis value.
Returns
Value returned by the function.
JsValue AdblockPlus::JsValue::Call ( const JsValue arg) const

Invokes the value as a function (see IsFunction()) with single parameter.

Parameters
argA single required parameter.
Returns
Value returned by the function.
std::string AdblockPlus::JsValue::GetClass ( ) const

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.

Returns
Class name of the value.
std::vector<std::string> AdblockPlus::JsValue::GetOwnPropertyNames ( ) const

Returns a list of property names if this is an object (see IsObject()).

Returns
List of property names.
JsValue AdblockPlus::JsValue::GetProperty ( const std::string &  name) const

Returns a property value if this is an object (see IsObject()).

Parameters
nameProperty name.
Returns
Property value, undefined (see IsUndefined()) if the property does not exist.
void AdblockPlus::JsValue::SetProperty ( const std::string &  name,
const std::string &  val 
)

Sets a property value if this is an object (see IsObject()).

Parameters
nameProperty name.
valProperty value.
void AdblockPlus::JsValue::SetProperty ( const std::string &  name,
const StringBuffer &  val 
)

Sets a property value if this is an object (see IsObject()).

Parameters
nameProperty name.
valProperty value.
void AdblockPlus::JsValue::SetProperty ( const std::string &  name,
int64_t  val 
)

Sets a property value if this is an object (see IsObject()).

Parameters
nameProperty name.
valProperty value.
void AdblockPlus::JsValue::SetProperty ( const std::string &  name,
bool  val 
)

Sets a property value if this is an object (see IsObject()).

Parameters
nameProperty name.
valProperty value.
void AdblockPlus::JsValue::SetProperty ( const std::string &  name,
const JsValue value 
)

Sets a property value if this is an object (see IsObject()).

Parameters
nameProperty name.
valProperty value.
void AdblockPlus::JsValue::SetProperty ( const std::string &  name,
const char *  val 
)
inline

Sets a property value if this is an object (see IsObject()).

Parameters
nameProperty name.
valProperty value.
void AdblockPlus::JsValue::SetProperty ( const std::string &  name,
int  val 
)
inline

Sets a property value if this is an object (see IsObject()).

Parameters
nameProperty name.
valProperty value.
void AdblockPlus::JsValue::SetStringBufferProperty ( const std::string &  name,
const StringBuffer &  val 
)

Sets a property value string if this is an object (see IsObject()).

Parameters
nameProperty name.
valProperty value as a StringBuffer.

The documentation for this class was generated from the following file: