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

Method toLong

valdi_core/src/valdi_core/cpp/Utils/Value.cpp:720–736  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

718}
719
720int64_t Value::toLong() const noexcept {
721 switch (getType()) {
722 case ValueType::Long:
723 return _data.l;
724 case ValueType::Int:
725 return static_cast<int64_t>(_data.i);
726 case ValueType::Double:
727 return static_cast<int64_t>(toDouble());
728 case ValueType::InternedString:
729 case ValueType::StaticString:
730 return atoll(toStringBox().getCStr()); // NOLINT(cert-err34-c)
731 case ValueType::Bool:
732 return static_cast<int64_t>(_data.b);
733 default:
734 return 0;
735 }
736}
737
738ValueType Value::getType() const noexcept {
739 return _type;

Callers 15

operator<Method · 0.80
writeValueToJSONWriterFunction · 0.80
toJavaObjectFunction · 0.80
TEST_PFunction · 0.80
valueToLongMethod · 0.80
valueObjectToLongMethod · 0.80
dumpMemoryStatisticsMethod · 0.80
nativeGetLongFunction · 0.80
onApplyMethod · 0.80
valueToJSValueFunction · 0.80
loadModuleMethod · 0.80

Calls 3

getTypeFunction · 0.85
toStringBoxFunction · 0.85
getCStrMethod · 0.45

Tested by 3

TEST_PFunction · 0.64
valueToLongMethod · 0.64
valueObjectToLongMethod · 0.64