MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / ParseTextFormatFromString

Function ParseTextFormatFromString

tensorflow/core/util/proto/proto_utils.cc:72–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70}
71
72Status ParseTextFormatFromString(absl::string_view input,
73 protobuf::Message* output) {
74 DCHECK(output != nullptr) << "output must be non NULL";
75 // When checks are disabled, instead log the error and return an error status.
76 if (output == nullptr) {
77 LOG(ERROR) << "output must be non NULL";
78 return Status(error::INVALID_ARGUMENT, "output must be non NULL");
79 }
80 string err;
81 StringErrorCollector err_collector(&err, /*one-indexing=*/true);
82 protobuf::TextFormat::Parser parser;
83 parser.RecordErrorsTo(&err_collector);
84 if (!parser.ParseFromString(string(input), output)) {
85 return Status(error::INVALID_ARGUMENT, err);
86 }
87 return Status::OK();
88}
89
90StringErrorCollector::StringErrorCollector(string* error_text)
91 : StringErrorCollector(error_text, false) {}

Callers 2

LoadApiDefMethod · 0.85
TESTFunction · 0.85

Calls 2

StatusClass · 0.70
ParseFromStringMethod · 0.45

Tested by 1

TESTFunction · 0.68