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

Method Lookup

src/NodeRTLib/ProjectFiles/CollectionsWrap.h:1532–1562  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1530 }
1531
1532 static void Lookup(Nan::NAN_METHOD_ARGS_TYPE info) {
1533 HandleScope scope;
1534
1535 if (!NodeRT::Utils::IsWinRtWrapperOf<
1536 ::Windows::Foundation::Collections::IMapView<K, V> ^>(
1537 info.This())) {
1538 return;
1539 }
1540
1541 MapViewWrapper<K, V>* wrapper =
1542 MapViewWrapper<K, V>::Unwrap<MapViewWrapper<K, V>>(info.This());
1543
1544 if (info.Length() == 1 && wrapper->_checkKeyTypeFunc(info[0])) {
1545 try {
1546 K key = wrapper->_convertToKeyTypeFunc(info[0]);
1547
1548 V result = wrapper->_instance->Lookup(key);
1549
1550 info.GetReturnValue().Set(wrapper->_valueGetterFunc(result));
1551 } catch (Platform::Exception ^ exception) {
1552 NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
1553 return;
1554 }
1555 } else {
1556 Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(
1557 L"Bad arguments: no suitable overload found")));
1558 return;
1559 }
1560
1561 return;
1562 }
1563
1564 static void Split(Nan::NAN_METHOD_ARGS_TYPE info) {
1565 HandleScope scope;

Callers

nothing calls this directly

Calls 3

NewStringFunction · 0.85
LookupMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected