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

Method toInt

valdi_core/src/valdi_core/cpp/Utils/Value.cpp:702–718  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

700}
701
702int32_t Value::toInt() const noexcept {
703 switch (getType()) {
704 case ValueType::Int:
705 return _data.i;
706 case ValueType::Double:
707 return static_cast<int32_t>(toDouble());
708 case ValueType::Long:
709 return static_cast<int32_t>(_data.l);
710 case ValueType::InternedString:
711 case ValueType::StaticString:
712 return atoi(toStringBox().getCStr()); // NOLINT(cert-err34-c)
713 case ValueType::Bool:
714 return static_cast<int32_t>(_data.i);
715 default:
716 return 0;
717 }
718}
719
720int64_t Value::toLong() const noexcept {
721 switch (getType()) {

Callers 6

operator<Method · 0.45
unmarshallMethod · 0.45
toJavaObjectFunction · 0.45
Long.jsFile · 0.45
loadModuleMethod · 0.45

Calls 3

getTypeFunction · 0.85
toStringBoxFunction · 0.85
getCStrMethod · 0.45

Tested by

no test coverage detected