MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/SPlisHSPlasH / get_arithmetic_value

Function get_arithmetic_value

extern/json/json.hpp:4611–4641  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4609 !std::is_same<ArithmeticType, typename BasicJsonType::boolean_t>::value,
4610 int > = 0 >
4611void get_arithmetic_value(const BasicJsonType& j, ArithmeticType& val)
4612{
4613 switch (static_cast<value_t>(j))
4614 {
4615 case value_t::number_unsigned:
4616 {
4617 val = static_cast<ArithmeticType>(*j.template get_ptr<const typename BasicJsonType::number_unsigned_t*>());
4618 break;
4619 }
4620 case value_t::number_integer:
4621 {
4622 val = static_cast<ArithmeticType>(*j.template get_ptr<const typename BasicJsonType::number_integer_t*>());
4623 break;
4624 }
4625 case value_t::number_float:
4626 {
4627 val = static_cast<ArithmeticType>(*j.template get_ptr<const typename BasicJsonType::number_float_t*>());
4628 break;
4629 }
4630
4631 case value_t::null:
4632 case value_t::object:
4633 case value_t::array:
4634 case value_t::string:
4635 case value_t::boolean:
4636 case value_t::binary:
4637 case value_t::discarded:
4638 default:
4639 JSON_THROW(type_error::create(302, concat("type must be number, but is ", j.type_name()), &j));
4640 }
4641}
4642
4643template<typename BasicJsonType>
4644inline void from_json(const BasicJsonType& j, typename BasicJsonType::boolean_t& b)

Callers 1

from_jsonFunction · 0.85

Calls 2

createFunction · 0.70
concatFunction · 0.70

Tested by

no test coverage detected