MCPcopy Create free account
hub / github.com/TelegramMessenger/cocoon / get_string

Method get_string

runners/helpers/ValidateRequest.cpp:526–543  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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) {

Callers

nothing calls this directly

Calls 1

is_stringMethod · 0.45

Tested by

no test coverage detected