-
-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathReference.h
More file actions
40 lines (32 loc) · 1.83 KB
/
Reference.h
File metadata and controls
40 lines (32 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef Reference_h
#define Reference_h
#include "DataWrapper.h"
#include "Common.h"
namespace tns {
class Reference {
public:
static void Register(v8::Local<v8::Context> context, v8::Local<v8::Object> interop);
static v8::Local<v8::Value> FromPointer(v8::Local<v8::Context> context, v8::Local<v8::Value> type, void* handle);
static v8::Local<v8::Function> GetInteropReferenceCtorFunc(v8::Local<v8::Context> context);
static void* GetWrappedPointer(v8::Local<v8::Context> context, v8::Local<v8::Value> reference, const TypeEncoding* typeEncoding);
private:
struct DataPair {
DataPair(BaseDataWrapper* typeWrapper, const TypeEncoding* typeEncoding, void* data, size_t size): typeWrapper_(typeWrapper), typeEncoding_(typeEncoding), data_(data), size_(size) {
}
BaseDataWrapper* typeWrapper_;
const TypeEncoding* typeEncoding_;
void* data_;
size_t size_;
};
static v8::Local<v8::Value> GetReferredValue(v8::Local<v8::Context> context, v8::Local<v8::Value> value);
static void ReferenceConstructorCallback(const v8::FunctionCallbackInfo<v8::Value>& info);
static void IndexedPropertyGetCallback(uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info);
static void IndexedPropertySetCallback(uint32_t index, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<v8::Value>& info);
static void GetValueCallback(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Value>& info);
static void SetValueCallback(v8::Local<v8::Name> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info);
static void RegisterToStringMethod(v8::Local<v8::Context> context, v8::Local<v8::Object> prototype);
static DataPair GetDataPair(v8::Local<v8::Object> obj);
static bool IsSupportedType(WrapperType type);
};
}
#endif /* Reference_h */