| 524 | } |
| 525 | |
| 526 | td::Result<std::string> get_string() { |
| 527 | switch (mode) { |
| 528 | case Mode::Form: |
| 529 | return td::Status::Error(ton::ErrorCode::protoviolation, PSTRING() << path << " must be a string"); |
| 530 | case Mode::Json: { |
| 531 | auto e = obj; |
| 532 | if (!e || !e->is_string()) { |
| 533 | return td::Status::Error(ton::ErrorCode::protoviolation, PSTRING() << path << " must be a string"); |
| 534 | } |
| 535 | return e->get<std::string>(); |
| 536 | } |
| 537 | case Mode::Slice: { |
| 538 | return field->value; |
| 539 | } |
| 540 | default: |
| 541 | return td::Status::Error(ton::ErrorCode::protoviolation, PSTRING() << path << " must be a string"); |
| 542 | } |
| 543 | } |
| 544 | |
| 545 | bool is_integer() { |
| 546 | switch (mode) { |