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

Method Set

src/NodeRTLib/ProjectFiles/CollectionsWrap.h:157–190  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

155 }
156
157 static void Set(uint32_t index,
158 Local<Value> value,
159 const Nan::PropertyCallbackInfo<v8::Value>& info) {
160 HandleScope scope;
161 if (!NodeRT::Utils::IsWinRtWrapperOf<::Platform::Array<T> ^>(info.This())) {
162 return;
163 }
164
165 ArrayWrapper<T>* wrapper =
166 ArrayWrapper<T>::Unwrap<ArrayWrapper<T>>(info.This());
167
168 if (wrapper->_checkTypeFunc && !wrapper->_checkTypeFunc(value)) {
169 Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(
170 L"The argument to set isn't of the expected type or internal WinRt "
171 L"object was disposed")));
172 return;
173 }
174
175 if (wrapper->_instance->Length <= index) {
176 Nan::ThrowError(Nan::Error(
177 NodeRT::Utils::NewString(L"Given index exceeded array length")));
178 return;
179 }
180
181 if (wrapper->_convertToTypeFunc) {
182 try {
183 wrapper->_instance[index] = wrapper->_convertToTypeFunc(value);
184 } catch (::Platform::Exception ^ e) {
185 NodeRT::Utils::ThrowWinRtExceptionInJs(e);
186 }
187 }
188
189 return;
190 }
191
192 private:
193 ::Platform::Array<T> ^ _instance;

Callers 15

NewMethod · 0.45
LengthGetterMethod · 0.45
GetMethod · 0.45
NewMethod · 0.45
MoveNextMethod · 0.45
CurrentGetterMethod · 0.45
HasCurrentGetterMethod · 0.45
NewMethod · 0.45
FirstMethod · 0.45
NewMethod · 0.45
GetMethod · 0.45
GetAtMethod · 0.45

Calls 1

NewStringFunction · 0.85

Tested by

no test coverage detected