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

Method toDouble

valdi_core/src/valdi_core/cpp/Utils/Value.cpp:686–696  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

684}
685
686double Value::toDouble() const noexcept {
687 switch (getType()) {
688 case ValueType::Double:
689 return _data.d;
690 case ValueType::InternedString:
691 case ValueType::StaticString:
692 return atof(toStringBox().getCStr()); // NOLINT(cert-err34-c)
693 default:
694 return static_cast<double>(toLong());
695 }
696}
697
698float Value::toFloat() const noexcept {
699 return static_cast<float>(toDouble());

Callers 8

operator==Method · 0.45
operator<Method · 0.45
writeValueToJSONWriterFunction · 0.45
toJavaObjectFunction · 0.45
measureStringsMethod · 0.45
measureStringMapsMethod · 0.45
getFontForNameMethod · 0.45

Calls 3

getTypeFunction · 0.85
toStringBoxFunction · 0.85
getCStrMethod · 0.45

Tested by

no test coverage detected