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

Function JsArrayToWinrtMap

src/NodeRTLib/ProjectFiles/CollectionsConverter.h:41–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39
40template <class K, class V>
41 static ::Platform::Collections::Map<K, V> ^
42 JsArrayToWinrtMap(
43 v8::Local<v8::Array> arr,
44 const std::function<bool(v8::Local<v8::Value>)>& checkKeyTypeFunc,
45 const std::function<K(v8::Local<v8::Value>)>& convertToKeyTypeFunc,
46 const std::function<bool(v8::Local<v8::Value>)>& checkValueTypeFunc,
47 const std::function<V(v8::Local<v8::Value>)>& convertToValueTypeFunc) {
48 std::map<K, V> stdMap;
49 if (!FillMapFromJsArray(arr, checkKeyTypeFunc, convertToKeyTypeFunc,
50 checkValueTypeFunc, convertToValueTypeFunc,
51 stdMap)) {
52 return nullptr;
53 }
54
55 // TODO: michfa: consider using std::move (here & everywhere), e.g: return
56 // ref new ::Platform::Collections::Map<K, V>(std::move(stdMap));
57 // std::move will give a more efficient initialization from std::map, will
58 // invalidate stdMap however- some types will throw while moving
59 return ref new ::Platform::Collections::Map<K, V>(stdMap);
60 }
61
62 template <class K, class V>
63 static ::Platform::Collections::MapView<K, V> ^

Callers

nothing calls this directly

Calls 1

FillMapFromJsArrayFunction · 0.85

Tested by

no test coverage detected