MCPcopy Create free account
hub / github.com/OpenFodder/openfodder / get_arithmetic_value

Function get_arithmetic_value

Source/Utils/json.hpp:3440–3463  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3438 !std::is_same<ArithmeticType, typename BasicJsonType::boolean_t>::value,
3439 int > = 0 >
3440 void get_arithmetic_value(const BasicJsonType& j, ArithmeticType& val)
3441 {
3442 switch (static_cast<value_t>(j))
3443 {
3444 case value_t::number_unsigned:
3445 {
3446 val = static_cast<ArithmeticType>(*j.template get_ptr<const typename BasicJsonType::number_unsigned_t*>());
3447 break;
3448 }
3449 case value_t::number_integer:
3450 {
3451 val = static_cast<ArithmeticType>(*j.template get_ptr<const typename BasicJsonType::number_integer_t*>());
3452 break;
3453 }
3454 case value_t::number_float:
3455 {
3456 val = static_cast<ArithmeticType>(*j.template get_ptr<const typename BasicJsonType::number_float_t*>());
3457 break;
3458 }
3459
3460 default:
3461 JSON_THROW(type_error::create(302, "type must be number, but is " + std::string(j.type_name())));
3462 }
3463 }
3464
3465 template<typename BasicJsonType>
3466 void from_json(const BasicJsonType& j, typename BasicJsonType::boolean_t& b)

Callers 1

from_jsonFunction · 0.85

Calls 2

createFunction · 0.85
type_nameMethod · 0.80

Tested by

no test coverage detected