Jerryscript::Callable Class Reference

Callable object represent functions. More...

#include <Types.h>

Inheritance diagram for Jerryscript::Callable:
Collaboration diagram for Jerryscript::Callable:

Public Types

using List = Vector< Callable >
 
- Public Types inherited from Jerryscript::Object
using List = Vector< Object >
 
- Public Types inherited from Jerryscript::Value
using List = Vector< Value >
 

Public Member Functions

Value call (const Object &thisValue, const Value &arg)
 Call with one argument. More...
 
Value call (const Object &thisValue, std::initializer_list< Value > args={})
 Call with zero or multiple arguments. More...
 
FunctionType functionType () const
 Get specific type of callable object. More...
 
 Object ()
 Default constructor creates a new, empty object. More...
 
 Object (const Value &value)
 
 Object (Value &&value)
 
- Public Member Functions inherited from Jerryscript::Object
 Object ()
 Default constructor creates a new, empty object. More...
 
 Object (const Value &value)
 
 Object (Value &&value)
 
Array keys () const
 Get list of property names. More...
 
Value runFunction (const String &name, Value &arg)
 Call a specified JavaScript function with exactly one argument. More...
 
Value runFunction (const String &name, std::initializer_list< Value > args={})
 Call a specified JavaScript function with zero or more arguments. More...
 
bool registerFunction (const String &name, jerry_external_handler_t handler)
 Register an external function so it may be called from javascript. More...
 
bool unregisterFunction (const String &name)
 Unregister an external function. More...
 
Callable getFunction (const String &name)
 Retrieve the given property as a function. More...
 
 Value ()
 Construct An empty (unused) value. More...
 
 Value (const OwnedValue &value)
 Construct a Value and take ownership of the given native value. More...
 
 Value (const CopyValue &value)
 Construct a Value using a copy (or reference to) the given native value. More...
 
 Value (const StringValue &value)
 Construct a string Value from the given native value. More...
 
 Value (const Undefined &value)
 
 Value (const Null &value)
 
 Value (const Value &value)
 Copy constructor. More...
 
 Value (Value &&value)
 Move constructor. More...
 
 Value (int value)
 Integer. More...
 
 Value (unsigned value)
 Unsigned integer. More...
 
 Value (double value)
 floating-point More...
 
 Value (bool value)
 Boolean. More...
 
 Value (const String &s)
 Wiring String. More...
 
 Value (const char *s)
 NUL-terminated 'C' string. More...
 
 Value (const FSTR::String &s)
 Flash String. More...
 
NamedItem operator[] (const String &name)
 operator[] uses NamedItem proxy object so value can be assigned or read More...
 
const Value operator[] (const String &name) const
 const operator[] returns Value directly More...
 
Value setProperty (const Value &name, const Value &value)
 Set a property value. More...
 
Value getProperty (const Value &name) const
 Get a property value. More...
 
bool hasProperty (const Value &name) const
 Determine if a property exists. More...
 
bool removeProperty (const Value &name)
 Remove a property. More...
 
- Public Member Functions inherited from Jerryscript::Value
 Value ()
 Construct An empty (unused) value. More...
 
 Value (const OwnedValue &value)
 Construct a Value and take ownership of the given native value. More...
 
 Value (const CopyValue &value)
 Construct a Value using a copy (or reference to) the given native value. More...
 
 Value (const StringValue &value)
 Construct a string Value from the given native value. More...
 
 Value (const Undefined &value)
 
 Value (const Null &value)
 
 Value (const Value &value)
 Copy constructor. More...
 
 Value (Value &&value)
 Move constructor. More...
 
 ~Value ()
 
Valueoperator= (const Value &value)
 Assignment copy operator. More...
 
Valueoperator= (Value &&value)
 Assignment move operator. More...
 
Valuereset (jerry_value_t value=jerry_value_t(Ecma::VALUE_EMPTY))
 Reset contents of object to new value (default is unassigned) More...
 
jerry_value_t release ()
 Get raw/native value and release ownership. More...
 
Type type () const
 Get value type. More...
 
Object toObject () const
 Create a new object from this value. More...
 
Value toString () const
 Create a new string value from this value. More...
 
size_t readString (unsigned offset, char *buffer, size_t length) const
 Get content from within a string value. More...
 
String subString (unsigned offset, size_t length) const
 Get content from within a string value. More...
 
 operator String () const
 Support intrinsic cast to Wiring String. More...
 
template<typename T >
as () const
 Get value of object with specific type. e.g. value.as<int>(). More...
 
 Value (int value)
 Integer. More...
 
 Value (unsigned value)
 Unsigned integer. More...
 
 Value (double value)
 floating-point More...
 
 Value (bool value)
 Boolean. More...
 
 Value (const String &s)
 Wiring String. More...
 
 Value (const char *s)
 NUL-terminated 'C' string. More...
 
 Value (const FSTR::String &s)
 Flash String. More...
 
const jerry_value_t & get () const
 const get() More...
 
jerry_value_t & get ()
 get() More...
 
bool isCallable () const
 Is this object a function? If so, can cast to Callable type. More...
 
bool isArray () const
 Can this object be accessed as an array? If so, can cast to Array type. More...
 
bool isError () const
 Determine if value represents an error. If so, can cast to Error type. More...
 
bool isEmpty () const
 An empty Value contains nothing, i.e. no javascript type has been assigned. This gets interpreted as 'undefined' if any attempt is made to use it in javascript. More...
 
bool isDefined () const
 Contains a javascript value, but contents undefined. More...
 
bool isBoolean () const
 A true/false value type. More...
 
bool isFalse () const
 Is this a Boolean type set to False? More...
 
bool isTrue () const
 Is this a Boolean type set to True? More...
 
bool isNull () const
 Is this a NULL value? More...
 
bool isString () const
 Is this a String? More...
 
bool isObject () const
 Is this an Object type? If so, can cast to Object class. More...
 
bool isNumber () const
 Does this value contain a Number? More...
 

Detailed Description

Callable object represent functions.

Member Typedef Documentation

◆ List

Member Function Documentation

◆ call() [1/2]

Value Jerryscript::Callable::call ( const Object thisValue,
const Value arg 
)

Call with one argument.

◆ call() [2/2]

Value Jerryscript::Callable::call ( const Object thisValue,
std::initializer_list< Value args = {} 
)

Call with zero or multiple arguments.

e.g. call(myObject, {1, 2, 3});

◆ functionType()

FunctionType Jerryscript::Callable::functionType ( ) const
inline

Get specific type of callable object.

◆ Object() [1/3]

Jerryscript::Object::Object
inline

Default constructor creates a new, empty object.

◆ Object() [2/3]

Jerryscript::Object::Object
inline

◆ Object() [3/3]

Jerryscript::Object::Object
inline

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