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

Method GetAt

src/NodeRTLib/ProjectFiles/CollectionsWrap.h:1074–1109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1072 }
1073
1074 static void GetAt(Nan::NAN_METHOD_ARGS_TYPE info) {
1075 HandleScope scope;
1076
1077 if (!NodeRT::Utils::IsWinRtWrapperOf<
1078 ::Windows::Foundation::Collections::IVector<T> ^>(info.This())) {
1079 return;
1080 }
1081
1082 VectorWrapper<T>* wrapper =
1083 VectorWrapper<T>::Unwrap<VectorWrapper<T>>(info.This());
1084
1085 if (info.Length() == 1 && info[0]->IsUint32()) {
1086 try {
1087 unsigned int index = info[0]->Uint32Value();
1088
1089 if (index >= wrapper->_instance->Size) {
1090 return;
1091 }
1092 T result;
1093 result = wrapper->_instance->GetAt(index);
1094
1095 if (wrapper->_getterFunc) {
1096 info.GetReturnValue().Set(wrapper->_getterFunc(result));
1097 }
1098 } catch (Platform::Exception ^ exception) {
1099 NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
1100 return;
1101 }
1102 } else {
1103 Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(
1104 L"Bad arguments: no suitable overload found")));
1105 return;
1106 }
1107
1108 return;
1109 }
1110
1111 static void SetAt(Nan::NAN_METHOD_ARGS_TYPE info) {
1112 HandleScope scope;

Callers 3

GetMethod · 0.45
GetAtMethod · 0.45
GetMethod · 0.45

Calls 2

NewStringFunction · 0.85
SetMethod · 0.45

Tested by

no test coverage detected