V8: include/v8-container.h Source File (original) (raw)
1
2
3
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
12
14#include "v8-object.h"
15#include "v8config.h"
16
17namespace v8 {
18
19class Context;
20class Isolate;
21
26 public:
28
34
40 size_t length);
42#ifdef V8_ENABLE_CHECKS
43 CheckCast(value);
44#endif
45 return static_cast<Array*>(value);
46 }
47
63
65 kException,
66 kBreak,
67 kContinue,
68 };
71 void* data);
72
98 void* callback_data);
99
100 private:
102 static void CheckCast(Value* obj);
103};
104
109 public:
121
127
132
134#ifdef V8_ENABLE_CHECKS
135 CheckCast(value);
136#endif
137 return static_cast<Map*>(value);
138 }
139
140 private:
142 static void CheckCast(Value* obj);
143};
144
149 public:
158
163
168
170#ifdef V8_ENABLE_CHECKS
171 CheckCast(value);
172#endif
173 return static_cast<Set*>(value);
174 }
175
176 private:
178 static void CheckCast(Value* obj);
179};
180
181}
182
183#endif
Definition: v8-container.h:25
static MaybeLocal< Array > New(Local< Context > context, size_t length, std::function< MaybeLocal< v8::Value >()> next_value_callback)
CallbackResult
Definition: v8-container.h:64
static Local< Array > New(Isolate *isolate, Local< Value > *elements, size_t length)
static Local< Array > New(Isolate *isolate, int length=0)
static Array * Cast(Value *value)
Definition: v8-container.h:41
CallbackResult(*)(uint32_t index, Local< Value > element, void *data) IterationCallback
Definition: v8-container.h:71
Maybe< void > Iterate(Local< Context > context, IterationCallback callback, void *callback_data)
Definition: v8-isolate.h:291
Definition: v8-local-handle.h:366
Definition: v8-container.h:108
Local< Array > AsArray() const
static Local< Map > New(Isolate *isolate)
Maybe< bool > Delete(Local< Context > context, Local< Value > key)
MaybeLocal< Value > Get(Local< Context > context, Local< Value > key)
Maybe< bool > Has(Local< Context > context, Local< Value > key)
MaybeLocal< Map > Set(Local< Context > context, Local< Value > key, Local< Value > value)
static Map * Cast(Value *value)
Definition: v8-container.h:133
Definition: v8-local-handle.h:734
Definition: v8-maybe.h:39
Definition: v8-object.h:262
Definition: v8-container.h:148
static Set * Cast(Value *value)
Definition: v8-container.h:169
static Local< Set > New(Isolate *isolate)
Maybe< bool > Delete(Local< Context > context, Local< Value > key)
Local< Array > AsArray() const
Maybe< bool > Has(Local< Context > context, Local< Value > key)
MaybeLocal< Set > Add(Local< Context > context, Local< Value > key)
Definition: v8-value.h:32
Definition: libplatform.h:15
#define V8_EXPORT
Definition: v8config.h:855
#define V8_INLINE
Definition: v8config.h:508
#define V8_WARN_UNUSED_RESULT
Definition: v8config.h:679