| |
| |
| |
|
|
| #ifndef INCLUDE_V8_CONTAINER_H_ |
| #define INCLUDE_V8_CONTAINER_H_ |
|
|
| #include <stddef.h> |
| #include <stdint.h> |
|
|
| #include "v8-local-handle.h" |
| #include "v8-object.h" |
| #include "v8config.h" |
|
|
| namespace v8 { |
|
|
| class Context; |
| class Isolate; |
|
|
| |
| |
| |
| class V8_EXPORT Array : public Object { |
| public: |
| uint32_t Length() const; |
|
|
| |
| |
| |
| |
| static Local<Array> New(Isolate* isolate, int length = 0); |
|
|
| |
| |
| |
| |
| static Local<Array> New(Isolate* isolate, Local<Value>* elements, |
| size_t length); |
| V8_INLINE static Array* Cast(Value* value) { |
| #ifdef V8_ENABLE_CHECKS |
| CheckCast(value); |
| #endif |
| return static_cast<Array*>(value); |
| } |
|
|
| private: |
| Array(); |
| static void CheckCast(Value* obj); |
| }; |
|
|
| |
| |
| |
| class V8_EXPORT Map : public Object { |
| public: |
| size_t Size() const; |
| void Clear(); |
| V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context, |
| Local<Value> key); |
| V8_WARN_UNUSED_RESULT MaybeLocal<Map> Set(Local<Context> context, |
| Local<Value> key, |
| Local<Value> value); |
| 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); |
|
|
| |
| |
| |
| |
| Local<Array> AsArray() const; |
|
|
| |
| |
| |
| static Local<Map> New(Isolate* isolate); |
|
|
| V8_INLINE static Map* Cast(Value* value) { |
| #ifdef V8_ENABLE_CHECKS |
| CheckCast(value); |
| #endif |
| return static_cast<Map*>(value); |
| } |
|
|
| private: |
| Map(); |
| static void CheckCast(Value* obj); |
| }; |
|
|
| |
| |
| |
| class V8_EXPORT Set : public Object { |
| public: |
| size_t Size() const; |
| void Clear(); |
| V8_WARN_UNUSED_RESULT MaybeLocal<Set> Add(Local<Context> context, |
| Local<Value> key); |
| 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); |
|
|
| |
| |
| |
| Local<Array> AsArray() const; |
|
|
| |
| |
| |
| static Local<Set> New(Isolate* isolate); |
|
|
| V8_INLINE static Set* Cast(Value* value) { |
| #ifdef V8_ENABLE_CHECKS |
| CheckCast(value); |
| #endif |
| return static_cast<Set*>(value); |
| } |
|
|
| private: |
| Set(); |
| static void CheckCast(Value* obj); |
| }; |
|
|
| } |
|
|
| #endif |
|
|