MCPcopy Create free account
hub / github.com/NodeRT/NodeRT / OpaqueWrapper

Class OpaqueWrapper

src/NodeRTLib/ProjectFiles/OpaqueWrapper.h:31–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29v8::Local<v8::Value> CreateOpaqueWrapper(::Platform::Object ^ wintRtHandle);
30
31class OpaqueWrapper : public WrapperBase {
32 public:
33 virtual ::Platform::Object ^ GetObjectInstance() const override {
34 return _instance;
35 }
36
37 static bool IsOpaqueWrapper(v8::Handle<v8::Value> value) {
38 if (value.IsEmpty() || !value->IsObject()) {
39 return false;
40 }
41
42 v8::Handle<v8::Value> hiddenVal = NodeRT::Utils::GetHiddenValue(
43 value.As<v8::Object>(),
44 Nan::New<v8::String>("__winrtOpaqueWrapper__").ToLocalChecked());
45
46 if (hiddenVal.IsEmpty() || !hiddenVal->IsBoolean()) {
47 return false;
48 }
49
50 return hiddenVal->Equals(Nan::True());
51 }
52
53 private:
54 OpaqueWrapper(::Platform::Object ^ instance) : _instance(instance) {}
55
56 static void New(Nan::NAN_METHOD_ARGS_TYPE info);
57 static void Init();
58
59 private:
60 ::Platform::Object ^ _instance;
61 static Nan::Persistent<v8::FunctionTemplate> s_constructorTemplate;
62
63 friend OpaqueWrapperInitializer;
64 friend v8::Local<v8::Value> CreateOpaqueWrapper(::Platform::Object ^
65 wintRtInstance);
66};
67} // namespace NodeRT

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected