| 353 | } |
| 354 | |
| 355 | bool ParseExample(protobuf::io::CodedInputStream* stream, |
| 356 | parsed::Example* example) { |
| 357 | DCHECK(stream != nullptr); |
| 358 | DCHECK(example != nullptr); |
| 359 | // Loop over the input stream which may contain multiple serialized Example |
| 360 | // protos merged together as strings. This behavior is consistent with Proto's |
| 361 | // ParseFromString when string representations are concatenated. |
| 362 | while (!stream->ExpectAtEnd()) { |
| 363 | if (!stream->ExpectTag(kDelimitedTag(1))) { |
| 364 | if (!SkipExtraneousTag(stream)) return false; |
| 365 | } else { |
| 366 | if (!ParseFeatures(stream, example)) return false; |
| 367 | } |
| 368 | } |
| 369 | return true; |
| 370 | } |
| 371 | |
| 372 | bool ParseExample(StringPiece serialized, parsed::Example* example) { |
| 373 | DCHECK(example != nullptr); |