| 560 | } |
| 561 | |
| 562 | td::Result<td::int64> get_integer() { |
| 563 | switch (mode) { |
| 564 | case Mode::Form: |
| 565 | return td::Status::Error(ton::ErrorCode::protoviolation, PSTRING() << path << " must be an integer"); |
| 566 | case Mode::Slice: { |
| 567 | auto R = td::to_integer_safe<td::int64>(field->value); |
| 568 | if (R.is_error()) { |
| 569 | return td::Status::Error(ton::ErrorCode::protoviolation, PSTRING() << path << " must be an integer"); |
| 570 | } else { |
| 571 | return R.move_as_ok(); |
| 572 | } |
| 573 | } |
| 574 | case Mode::Json: { |
| 575 | auto e = obj; |
| 576 | if (!e || !e->is_number_integer()) { |
| 577 | return td::Status::Error(ton::ErrorCode::protoviolation, PSTRING() << path << " must be an integer"); |
| 578 | } |
| 579 | return e->get<td::int64>(); |
| 580 | } |
| 581 | default: |
| 582 | return td::Status::Error(ton::ErrorCode::protoviolation, PSTRING() << path << " must be an integer"); |
| 583 | } |
| 584 | } |
| 585 | |
| 586 | bool is_boolean() { |
| 587 | switch (mode) { |
nothing calls this directly
no outgoing calls
no test coverage detected