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

Method Lookup

src/NodeRTLib/ProjectFiles/CollectionsWrap.h:1866–1895  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1864 }
1865
1866 static void Lookup(Nan::NAN_METHOD_ARGS_TYPE info) {
1867 HandleScope scope;
1868
1869 if (!NodeRT::Utils::IsWinRtWrapperOf<
1870 ::Windows::Foundation::Collections::IMap<K, V> ^>(info.This())) {
1871 return;
1872 }
1873
1874 MapWrapper<K, V>* wrapper =
1875 MapWrapper<K, V>::Unwrap<MapWrapper<K, V>>(info.This());
1876
1877 if (info.Length() == 1 && wrapper->_checkKeyTypeFunc(info[0])) {
1878 try {
1879 K key = wrapper->_convertToKeyTypeFunc(info[0]);
1880
1881 V result = wrapper->_instance->Lookup(key);
1882
1883 info.GetReturnValue().Set(wrapper->_valueGetterFunc(result));
1884 } catch (Platform::Exception ^ exception) {
1885 NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
1886 return;
1887 }
1888 } else {
1889 Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(
1890 L"Bad arguments: no suitable overload found")));
1891 return;
1892 }
1893
1894 return;
1895 }
1896
1897 static void GetView(Nan::NAN_METHOD_ARGS_TYPE info) {
1898 HandleScope scope;

Callers 1

LookupMethod · 0.45

Calls 2

NewStringFunction · 0.85
SetMethod · 0.45

Tested by

no test coverage detected