v8 10.2.154 (node 18.16.0)
V8 is Google's open source JavaScript engine
Loading...
Searching...
No Matches
v8-container.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_CONTAINER_H_
6#define INCLUDE_V8_CONTAINER_H_
7
8#include <stddef.h>
9#include <stdint.h>
10
11#include "v8-local-handle.h" // NOLINT(build/include_directory)
12#include "v8-object.h" // NOLINT(build/include_directory)
13#include "v8config.h" // NOLINT(build/include_directory)
14
15namespace v8 {
16
17class Context;
18class Isolate;
19
23class V8_EXPORT Array : public Object {
24 public:
25 uint32_t Length() const;
26
31 static Local<Array> New(Isolate* isolate, int length = 0);
32
37 static Local<Array> New(Isolate* isolate, Local<Value>* elements,
38 size_t length);
39 V8_INLINE static Array* Cast(Value* value) {
40#ifdef V8_ENABLE_CHECKS
41 CheckCast(value);
42#endif
43 return static_cast<Array*>(value);
44 }
45
46 private:
47 Array();
48 static void CheckCast(Value* obj);
49};
50
54class V8_EXPORT Map : public Object {
55 public:
56 size_t Size() const;
57 void Clear();
59 Local<Value> key);
61 Local<Value> key,
62 Local<Value> value);
64 Local<Value> key);
66 Local<Value> key);
67
73
77 static Local<Map> New(Isolate* isolate);
78
79 V8_INLINE static Map* Cast(Value* value) {
80#ifdef V8_ENABLE_CHECKS
81 CheckCast(value);
82#endif
83 return static_cast<Map*>(value);
84 }
85
86 private:
87 Map();
88 static void CheckCast(Value* obj);
89};
90
94class V8_EXPORT Set : public Object {
95 public:
96 size_t Size() const;
97 void Clear();
99 Local<Value> key);
101 Local<Value> key);
103 Local<Value> key);
104
109
113 static Local<Set> New(Isolate* isolate);
114
115 V8_INLINE static Set* Cast(Value* value) {
116#ifdef V8_ENABLE_CHECKS
117 CheckCast(value);
118#endif
119 return static_cast<Set*>(value);
120 }
121
122 private:
123 Set();
124 static void CheckCast(Value* obj);
125};
126
127} // namespace v8
128
129#endif // INCLUDE_V8_CONTAINER_H_
static Local< Array > New(Isolate *isolate, Local< Value > *elements, size_t length)
static Local< Array > New(Isolate *isolate, int length=0)
uint32_t Length() const
static V8_INLINE Array * Cast(Value *value)
Local< Array > AsArray() const
V8_WARN_UNUSED_RESULT Maybe< bool > Has(Local< Context > context, Local< Value > key)
V8_WARN_UNUSED_RESULT Maybe< bool > Delete(Local< Context > context, Local< Value > key)
size_t Size() const
static V8_INLINE Map * Cast(Value *value)
void Clear()
V8_WARN_UNUSED_RESULT MaybeLocal< Value > Get(Local< Context > context, Local< Value > key)
static Local< Map > New(Isolate *isolate)
V8_WARN_UNUSED_RESULT MaybeLocal< Map > Set(Local< Context > context, Local< Value > key, Local< Value > value)
Local< Array > AsArray() const
static Local< Set > New(Isolate *isolate)
V8_WARN_UNUSED_RESULT Maybe< bool > Has(Local< Context > context, Local< Value > key)
V8_WARN_UNUSED_RESULT Maybe< bool > Delete(Local< Context > context, Local< Value > key)
size_t Size() const
static V8_INLINE Set * Cast(Value *value)
void Clear()
V8_WARN_UNUSED_RESULT MaybeLocal< Set > Add(Local< Context > context, Local< Value > key)
#define V8_EXPORT
Definition v8config.h:578
#define V8_INLINE
Definition v8config.h:425
#define V8_WARN_UNUSED_RESULT
Definition v8config.h:499