| 601 | } |
| 602 | |
| 603 | td::Result<bool> get_boolean() { |
| 604 | switch (mode) { |
| 605 | case Mode::Form: |
| 606 | return td::Status::Error(ton::ErrorCode::protoviolation, PSTRING() << path << " must be a boolean"); |
| 607 | case Mode::Slice: { |
| 608 | auto R = td::to_integer_safe<td::int64>(field->value); |
| 609 | if (R.is_error()) { |
| 610 | return td::Status::Error(ton::ErrorCode::protoviolation, PSTRING() << path << " must be a boolean"); |
| 611 | } else { |
| 612 | return (bool)R.move_as_ok(); |
| 613 | } |
| 614 | } |
| 615 | case Mode::Json: { |
| 616 | auto e = obj; |
| 617 | if (!e || !e->is_boolean()) { |
| 618 | return td::Status::Error(ton::ErrorCode::protoviolation, PSTRING() << path << " must be a boolean"); |
| 619 | } |
| 620 | return e->get<bool>(); |
| 621 | } |
| 622 | default: |
| 623 | return td::Status::Error(ton::ErrorCode::protoviolation, PSTRING() << path << " must be an integer"); |
| 624 | } |
| 625 | } |
| 626 | |
| 627 | bool is_double() { |
| 628 | switch (mode) { |
nothing calls this directly
no test coverage detected