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

Method Set

src/NodeRTLib/ProjectFiles/CollectionsWrap.h:835–864  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

833 }
834
835 static void Set(uint32 index,
836 Local<Value> value,
837 const Nan::PropertyCallbackInfo<v8::Value>& info) {
838 HandleScope scope;
839
840 if (!NodeRT::Utils::IsWinRtWrapperOf<
841 ::Windows::Foundation::Collections::IVector<T> ^>(info.This())) {
842 return;
843 }
844
845 VectorWrapper<T>* wrapper =
846 VectorWrapper<T>::Unwrap<VectorWrapper<T>>(info.This());
847
848 if (!wrapper->_checkTypeFunc(value)) {
849 Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(
850 L"The value to set isn't of the expected type")));
851 return;
852 }
853
854 try {
855 T item = wrapper->_convertToTypeFunc(value);
856
857 wrapper->_instance->SetAt(index, item);
858 } catch (Platform::Exception ^ exception) {
859 NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
860 return;
861 }
862
863 return;
864 }
865
866 static void Append(Nan::NAN_METHOD_ARGS_TYPE info) {
867 HandleScope scope;

Callers

nothing calls this directly

Calls 2

NewStringFunction · 0.85
SetAtMethod · 0.80

Tested by

no test coverage detected