MCPcopy Create free account
hub / github.com/catboost/catboost / GetUIntegerRobust

Method GetUIntegerRobust

library/cpp/json/ordered_maps/json_value_ordered.cpp:608–635  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

606 }
607
608 unsigned long long TJsonValue::GetUIntegerRobust() const noexcept {
609 switch (Type) {
610 case JSON_ARRAY:
611 return Value.Array->size();
612 case JSON_MAP:
613 return Value.Map->size();
614 case JSON_BOOLEAN:
615 return Value.Boolean;
616 case JSON_DOUBLE:
617 return GetDoubleRobust();
618 case JSON_STRING:
619 try {
620 ui64 res = 0;
621 if (Value.String && TryFromString(Value.String, res)) {
622 return res;
623 }
624 } catch (const yexception&) {
625 }
626 return 0;
627 case JSON_NULL:
628 case JSON_UNDEFINED:
629 default:
630 return 0;
631 case JSON_INTEGER:
632 case JSON_UINTEGER:
633 return Value.UInteger;
634 }
635 }
636
637 double TJsonValue::GetDoubleRobust() const noexcept {
638 switch (Type) {

Callers 2

Y_UNIT_TESTFunction · 0.45
Y_UNIT_TESTFunction · 0.45

Calls 2

TryFromStringFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected