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

Method First

src/NodeRTLib/ProjectFiles/CollectionsWrap.h:1488–1530  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1486 }
1487
1488 static void First(Nan::NAN_METHOD_ARGS_TYPE info) {
1489 HandleScope scope;
1490
1491 if (!NodeRT::Utils::IsWinRtWrapperOf<
1492 ::Windows::Foundation::Collections::IMapView<K, V> ^>(
1493 info.This())) {
1494 return;
1495 }
1496
1497 MapViewWrapper<K, V>* wrapper =
1498 MapViewWrapper<K, V>::Unwrap<MapViewWrapper<K, V>>(info.This());
1499
1500 if (info.Length() == 0) {
1501 try {
1502 const std::function<Local<Value>(K)>& keyGetter =
1503 wrapper->_keyGetterFunc;
1504 const std::function<Local<Value>(V)>& valueGetter =
1505 wrapper->_valueGetterFunc;
1506 info.GetReturnValue().Set(
1507 IteratorWrapper<
1508 ::Windows::Foundation::Collections::IKeyValuePair<K, V> ^>::
1509 CreateIteratorWrapper(
1510 wrapper->_instance->First(),
1511 [keyGetter, valueGetter](
1512 ::Windows::Foundation::Collections::IKeyValuePair<K,
1513 V> ^
1514 value) {
1515 return KeyValuePairWrapper<
1516 K, V>::CreateKeyValuePairWrapper(value, keyGetter,
1517 valueGetter);
1518 }));
1519 } catch (Platform::Exception ^ exception) {
1520 NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
1521 return;
1522 }
1523 } else {
1524 Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(
1525 L"Bad arguments: no suitable overload found")));
1526 return;
1527 }
1528
1529 return;
1530 }
1531
1532 static void Lookup(Nan::NAN_METHOD_ARGS_TYPE info) {
1533 HandleScope scope;

Callers

nothing calls this directly

Calls 3

NewStringFunction · 0.85
SetMethod · 0.45
FirstMethod · 0.45

Tested by

no test coverage detected