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

Method getMapProperty

valdi_core/src/valdi_core/cpp/Utils/Marshaller.cpp:377–398  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

375}
376
377bool Marshaller::getMapProperty(const StringBox& key, int index, Marshaller::GetMapPropertyFlags flags) {
378 auto map = getMap(index);
379 if (!_exceptionTracker) {
380 return false;
381 }
382 const auto& it = map->find(key);
383 if (it == map->end()) {
384 if (flags == GetMapPropertyFlags::PushUndefinedOnMiss) {
385 pushUndefined();
386 return true;
387 }
388
389 return false;
390 }
391
392 if (flags == GetMapPropertyFlags::IgnoreNullOrUndefined && it->second.isNullOrUndefined()) {
393 return false;
394 }
395
396 push(it->second);
397 return true;
398}
399
400void Marshaller::mustGetMapProperty(const StringBox& key, int index, Marshaller::GetMapPropertyFlags flags) {
401 if (!getMapProperty(key, index, flags)) {

Callers 1

Calls 4

pushFunction · 0.85
endMethod · 0.65
findMethod · 0.45
isNullOrUndefinedMethod · 0.45

Tested by

no test coverage detected