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

Method GetUIntegerRobust

library/cpp/json/writer/json_value.cpp:565–592  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

563 }
564
565 unsigned long long TJsonValue::GetUIntegerRobust() const noexcept {
566 switch (Type) {
567 case JSON_ARRAY:
568 return Value.Array->size();
569 case JSON_MAP:
570 return Value.Map->size();
571 case JSON_BOOLEAN:
572 return Value.Boolean;
573 case JSON_DOUBLE:
574 return GetDoubleRobust();
575 case JSON_STRING:
576 try {
577 ui64 res = 0;
578 if (Value.String && TryFromString(Value.String, res)) {
579 return res;
580 }
581 } catch (const yexception&) {
582 }
583 return 0;
584 case JSON_NULL:
585 case JSON_UNDEFINED:
586 default:
587 return 0;
588 case JSON_INTEGER:
589 case JSON_UINTEGER:
590 return Value.UInteger;
591 }
592 }
593
594 double TJsonValue::GetDoubleRobust() const noexcept {
595 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