| 642 | } |
| 643 | |
| 644 | td::Result<double> get_double() { |
| 645 | switch (mode) { |
| 646 | case Mode::Form: |
| 647 | return td::Status::Error(ton::ErrorCode::protoviolation, PSTRING() << path << " must be a double"); |
| 648 | case Mode::Slice: { |
| 649 | return td::to_double(field->value); |
| 650 | } |
| 651 | case Mode::Json: { |
| 652 | auto e = obj; |
| 653 | if (!e || !e->is_number()) { |
| 654 | return td::Status::Error(ton::ErrorCode::protoviolation, PSTRING() << path << " must be a double"); |
| 655 | } |
| 656 | return e->get<double>(); |
| 657 | } |
| 658 | default: |
| 659 | return td::Status::Error(ton::ErrorCode::protoviolation, PSTRING() << path << " must be a double"); |
| 660 | } |
| 661 | } |
| 662 | }; |
| 663 | |
| 664 | struct Ctx { |
nothing calls this directly
no outgoing calls
no test coverage detected