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

Method GetIntegerRobust

library/cpp/json/writer/json_value.cpp:536–563  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

534 }
535
536 long long TJsonValue::GetIntegerRobust() const noexcept {
537 switch (Type) {
538 case JSON_ARRAY:
539 return Value.Array->size();
540 case JSON_MAP:
541 return Value.Map->size();
542 case JSON_BOOLEAN:
543 return Value.Boolean;
544 case JSON_DOUBLE:
545 return GetDoubleRobust();
546 case JSON_STRING:
547 try {
548 i64 res = 0;
549 if (Value.String && TryFromString(Value.String, res)) {
550 return res;
551 }
552 } catch (const yexception&) {
553 }
554 return 0;
555 case JSON_NULL:
556 case JSON_UNDEFINED:
557 default:
558 return 0;
559 case JSON_INTEGER:
560 case JSON_UINTEGER:
561 return Value.Integer;
562 }
563 }
564
565 unsigned long long TJsonValue::GetUIntegerRobust() const noexcept {
566 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