V8 Project
v8::External Class Reference

A JavaScript value that wraps a C++ void*. More...

#include <v8.h>

+ Inheritance diagram for v8::External:
+ Collaboration diagram for v8::External:

Public Member Functions

void * Value () const
 
- Public Member Functions inherited from v8::Value
bool IsUndefined () const
 Returns true if this value is the undefined value. More...
 
bool IsNull () const
 Returns true if this value is the null value. More...
 
bool IsTrue () const
 Returns true if this value is true. More...
 
bool IsFalse () const
 Returns true if this value is false. More...
 
bool IsName () const
 Returns true if this value is a symbol or a string. More...
 
bool IsString () const
 Returns true if this value is an instance of the String type. More...
 
bool IsSymbol () const
 Returns true if this value is a symbol. More...
 
bool IsFunction () const
 Returns true if this value is a function. More...
 
bool IsArray () const
 Returns true if this value is an array. More...
 
bool IsObject () const
 Returns true if this value is an object. More...
 
bool IsBoolean () const
 Returns true if this value is boolean. More...
 
bool IsNumber () const
 Returns true if this value is a number. More...
 
bool IsExternal () const
 Returns true if this value is external. More...
 
bool IsInt32 () const
 Returns true if this value is a 32-bit signed integer. More...
 
bool IsUint32 () const
 Returns true if this value is a 32-bit unsigned integer. More...
 
bool IsDate () const
 Returns true if this value is a Date. More...
 
bool IsArgumentsObject () const
 Returns true if this value is an Arguments object. More...
 
bool IsBooleanObject () const
 Returns true if this value is a Boolean object. More...
 
bool IsNumberObject () const
 Returns true if this value is a Number object. More...
 
bool IsStringObject () const
 Returns true if this value is a String object. More...
 
bool IsSymbolObject () const
 Returns true if this value is a Symbol object. More...
 
bool IsNativeError () const
 Returns true if this value is a NativeError. More...
 
bool IsRegExp () const
 Returns true if this value is a RegExp. More...
 
bool IsGeneratorFunction () const
 Returns true if this value is a Generator function. More...
 
bool IsGeneratorObject () const
 Returns true if this value is a Generator object (iterator). More...
 
bool IsPromise () const
 Returns true if this value is a Promise. More...
 
bool IsMap () const
 Returns true if this value is a Map. More...
 
bool IsSet () const
 Returns true if this value is a Set. More...
 
bool IsWeakMap () const
 Returns true if this value is a WeakMap. More...
 
bool IsWeakSet () const
 Returns true if this value is a WeakSet. More...
 
bool IsArrayBuffer () const
 Returns true if this value is an ArrayBuffer. More...
 
bool IsArrayBufferView () const
 Returns true if this value is an ArrayBufferView. More...
 
bool IsTypedArray () const
 Returns true if this value is one of TypedArrays. More...
 
bool IsUint8Array () const
 Returns true if this value is an Uint8Array. More...
 
bool IsUint8ClampedArray () const
 Returns true if this value is an Uint8ClampedArray. More...
 
bool IsInt8Array () const
 Returns true if this value is an Int8Array. More...
 
bool IsUint16Array () const
 Returns true if this value is an Uint16Array. More...
 
bool IsInt16Array () const
 Returns true if this value is an Int16Array. More...
 
bool IsUint32Array () const
 Returns true if this value is an Uint32Array. More...
 
bool IsInt32Array () const
 Returns true if this value is an Int32Array. More...
 
bool IsFloat32Array () const
 Returns true if this value is a Float32Array. More...
 
bool IsFloat64Array () const
 Returns true if this value is a Float64Array. More...
 
bool IsDataView () const
 Returns true if this value is a DataView. More...
 
Local< BooleanToBoolean () const
 
Local< NumberToNumber () const
 
Local< StringToString () const
 
Local< StringToDetailString () const
 
Local< ObjectToObject () const
 
Local< IntegerToInteger () const
 
Local< Uint32ToUint32 () const
 
Local< Int32ToInt32 () const
 
Local< Uint32ToArrayIndex () const
 Attempts to convert a string to an array index. More...
 
bool BooleanValue () const
 
double NumberValue () const
 
int64_t IntegerValue () const
 
uint32_t Uint32Value () const
 
int32_t Int32Value () const
 
bool Equals (Handle< Value > that) const
 JS ==. More...
 
bool StrictEquals (Handle< Value > that) const
 
bool SameValue (Handle< Value > that) const
 

Static Public Member Functions

static Local< ExternalNew (Isolate *isolate, void *value)
 
static ExternalCast (Value *obj)
 
- Static Public Member Functions inherited from v8::Value
template<class T >
static ValueCast (T *value)
 

Static Private Member Functions

static void CheckCast (v8::Value *obj)
 

Detailed Description

A JavaScript value that wraps a C++ void*.

This type of value is mainly used to associate C++ data structures with JavaScript objects.

Definition at line 3331 of file v8.h.

Member Function Documentation

◆ Cast()

External * v8::External::Cast ( v8::Value value)
inlinestatic

Definition at line 6798 of file v8.h.

6798  {
6799 #ifdef V8_ENABLE_CHECKS
6800  CheckCast(value);
6801 #endif
6802  return static_cast<External*>(value);
6803 }
static void CheckCast(v8::Value *obj)
Definition: api.cc:2699

◆ CheckCast()

void v8::External::CheckCast ( v8::Value obj)
staticprivate

Definition at line 2699 of file api.cc.

2699  {
2701  "v8::External::Cast()",
2702  "Could not convert to external");
2703 }
static bool ApiCheck(bool condition, const char *location, const char *message)
Definition: api.h:177
static v8::internal::Handle< To > OpenHandle(v8::Local< From > handle)
Definition: api.h:288
bool IsExternal() const
Returns true if this value is external.
Definition: api.cc:2505

References v8::Utils::ApiCheck(), v8::Value::IsExternal(), and v8::Utils::OpenHandle().

+ Here is the call graph for this function:

◆ New()

Local< External > v8::External::New ( Isolate isolate,
void *  value 
)
static

Definition at line 5350 of file api.cc.

5350  {
5351  STATIC_ASSERT(sizeof(value) == sizeof(i::Address));
5352  i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
5353  LOG_API(i_isolate, "External::New");
5354  ENTER_V8(i_isolate);
5355  i::Handle<i::JSObject> external = i_isolate->factory()->NewExternal(value);
5356  return Utils::ExternalToLocal(external);
5357 }
#define LOG_API(isolate, expr)
Definition: api.cc:52
#define ENTER_V8(isolate)
Definition: api.cc:54
static Local< External > ExternalToLocal(v8::internal::Handle< v8::internal::JSObject > obj)
Factory * factory()
Definition: isolate.h:982
#define STATIC_ASSERT(test)
Definition: macros.h:311
byte * Address
Definition: globals.h:101

References ENTER_V8, v8::Utils::ExternalToLocal(), v8::internal::Isolate::factory(), LOG_API, and STATIC_ASSERT.

+ Here is the call graph for this function:

◆ Value()

void * v8::External::Value ( ) const

Definition at line 5360 of file api.cc.

5360  {
5361  return ExternalValue(*Utils::OpenHandle(this));
5362 }
static void * ExternalValue(i::Object *obj)
Definition: api.cc:5037

References v8::ExternalValue(), and v8::Utils::OpenHandle().

+ Here is the call graph for this function:

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