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

Method GetIntegerRobust

library/cpp/json/ordered_maps/json_value_ordered.cpp:579–606  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

577 }
578
579 long long TJsonValue::GetIntegerRobust() const noexcept {
580 switch (Type) {
581 case JSON_ARRAY:
582 return Value.Array->size();
583 case JSON_MAP:
584 return Value.Map->size();
585 case JSON_BOOLEAN:
586 return Value.Boolean;
587 case JSON_DOUBLE:
588 return GetDoubleRobust();
589 case JSON_STRING:
590 try {
591 i64 res = 0;
592 if (Value.String && TryFromString(Value.String, res)) {
593 return res;
594 }
595 } catch (const yexception&) {
596 }
597 return 0;
598 case JSON_NULL:
599 case JSON_UNDEFINED:
600 default:
601 return 0;
602 case JSON_INTEGER:
603 case JSON_UINTEGER:
604 return Value.Integer;
605 }
606 }
607
608 unsigned long long TJsonValue::GetUIntegerRobust() const noexcept {
609 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