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

Method GetAt

src/NodeRTLib/ProjectFiles/CollectionsWrap.h:574–610  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

572 }
573
574 static void GetAt(Nan::NAN_METHOD_ARGS_TYPE info) {
575 HandleScope scope;
576
577 if (!NodeRT::Utils::IsWinRtWrapperOf<
578 ::Windows::Foundation::Collections::IVectorView<T> ^>(
579 info.This())) {
580 return;
581 }
582
583 VectorViewWrapper<T>* wrapper =
584 VectorViewWrapper<T>::Unwrap<VectorViewWrapper<T>>(info.This());
585
586 if (info.Length() == 1 && info[0]->IsUint32()) {
587 try {
588 unsigned int index = info[0]->Uint32Value();
589
590 if (index >= wrapper->_instance->Size) {
591 return;
592 }
593 T result;
594 result = wrapper->_instance->GetAt(index);
595
596 if (wrapper->_getterFunc) {
597 info.GetReturnValue().Set(wrapper->_getterFunc(result));
598 }
599 } catch (Platform::Exception ^ exception) {
600 NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
601 return;
602 }
603 } else {
604 Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(
605 L"Bad arguments: no suitable overload found")));
606 return;
607 }
608
609 return;
610 }
611
612 static void GetMany(Nan::NAN_METHOD_ARGS_TYPE info) {
613 HandleScope scope;

Callers

nothing calls this directly

Calls 3

NewStringFunction · 0.85
GetAtMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected