MCPcopy Create free account
hub / github.com/Snapchat/Valdi / unmarshallMap

Function unmarshallMap

valdi_core/src/valdi_core/cpp/Utils/BridgeObject.hpp:184–197  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

182
183template<typename MapKey, typename MapValue, typename ConvertKey, typename ConvertValue>
184std::unordered_map<MapKey, MapValue> unmarshallMap(const Value& value,
185 const Ref<BridgeContext>& /*bridgeContext*/,
186 ConvertKey&& convertKey,
187 ConvertValue&& convertValue) {
188 std::unordered_map<MapKey, MapValue> out;
189
190 if (value.isMap()) {
191 for (const auto& it : *value.getMap()) {
192 out[convertKey(Value(it.first))] = convertValue(it.second);
193 }
194 }
195
196 return out;
197}
198
199template<typename VecValue, typename ConvertValue>
200std::vector<VecValue> unmarshallVector(const Value& value,

Callers

nothing calls this directly

Calls 3

ValueClass · 0.70
getMapMethod · 0.65
isMapMethod · 0.45

Tested by

no test coverage detected