Loading...
Searching...
No Matches
v8-primitive-object.h
Go to the documentation of this file.
1// Copyright 2021 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef INCLUDE_V8_PRIMITIVE_OBJECT_H_
6#define INCLUDE_V8_PRIMITIVE_OBJECT_H_
7
8#include "v8-local-handle.h" // NOLINT(build/include_directory)
9#include "v8-object.h" // NOLINT(build/include_directory)
10#include "v8config.h" // NOLINT(build/include_directory)
11
12namespace v8 {
13
14class Isolate;
15
20 public:
21 static Local<Value> New(Isolate* isolate, double value);
22
23 double ValueOf() const;
24
25 V8_INLINE static NumberObject* Cast(Value* value) {
26#ifdef V8_ENABLE_CHECKS
27 CheckCast(value);
28#endif
29 return static_cast<NumberObject*>(value);
30 }
31
32 private:
33 static void CheckCast(Value* obj);
34};
35
40 public:
41 static Local<Value> New(Isolate* isolate, int64_t value);
42
44
45 V8_INLINE static BigIntObject* Cast(Value* value) {
46#ifdef V8_ENABLE_CHECKS
47 CheckCast(value);
48#endif
49 return static_cast<BigIntObject*>(value);
50 }
51
52 private:
53 static void CheckCast(Value* obj);
54};
55
60 public:
61 static Local<Value> New(Isolate* isolate, bool value);
62
63 bool ValueOf() const;
64
66#ifdef V8_ENABLE_CHECKS
67 CheckCast(value);
68#endif
69 return static_cast<BooleanObject*>(value);
70 }
71
72 private:
73 static void CheckCast(Value* obj);
74};
75
80 public:
81 static Local<Value> New(Isolate* isolate, Local<String> value);
82
84
85 V8_INLINE static StringObject* Cast(Value* value) {
86#ifdef V8_ENABLE_CHECKS
87 CheckCast(value);
88#endif
89 return static_cast<StringObject*>(value);
90 }
91
92 private:
93 static void CheckCast(Value* obj);
94};
95
100 public:
101 static Local<Value> New(Isolate* isolate, Local<Symbol> value);
102
104
106#ifdef V8_ENABLE_CHECKS
107 CheckCast(value);
108#endif
109 return static_cast<SymbolObject*>(value);
110 }
111
112 private:
113 static void CheckCast(Value* obj);
114};
115
116} // namespace v8
117
118#endif // INCLUDE_V8_PRIMITIVE_OBJECT_H_
Definition: v8-primitive-object.h:39
Local< BigInt > ValueOf() const
static BigIntObject * Cast(Value *value)
Definition: v8-primitive-object.h:45
static Local< Value > New(Isolate *isolate, int64_t value)
Definition: v8-primitive-object.h:59
bool ValueOf() const
static Local< Value > New(Isolate *isolate, bool value)
static BooleanObject * Cast(Value *value)
Definition: v8-primitive-object.h:65
Definition: v8-isolate.h:261
Definition: v8-local-handle.h:266
Definition: v8-primitive-object.h:19
static NumberObject * Cast(Value *value)
Definition: v8-primitive-object.h:25
static Local< Value > New(Isolate *isolate, double value)
double ValueOf() const
Definition: v8-object.h:233
Definition: v8-primitive-object.h:79
static Local< Value > New(Isolate *isolate, Local< String > value)
Local< String > ValueOf() const
static StringObject * Cast(Value *value)
Definition: v8-primitive-object.h:85
Definition: v8-primitive-object.h:99
static SymbolObject * Cast(Value *value)
Definition: v8-primitive-object.h:105
Local< Symbol > ValueOf() const
static Local< Value > New(Isolate *isolate, Local< Symbol > value)
Definition: v8-value.h:32
Definition: libplatform.h:15
#define V8_EXPORT
Definition: v8config.h:793
#define V8_INLINE
Definition: v8config.h:499