in src/pipemode_op/RecordReader/TextLineRecordReader.cpp [47:76]
bool TextLineRecordReader::ReadRecord(std::string* data) {
data->resize(0);
static const std::size_t STEP_SIZE = 1024;
while (true) {
if (!volume_) {
FillBuffer();
}
if (!volume_) {
if (data->size() == 0) {
return false;
} else {
data->shrink_to_fit();
return true;
}
}
while (volume_) {
data->reserve(data->size() + STEP_SIZE);
for (int i = 0; i < STEP_SIZE && volume_; ++i) {
const char next_char = buffer_[offset_++];
--volume_;
if (next_char == delim_) {
data->shrink_to_fit();
return true;
} else {
data->push_back(next_char);
}
}
}
}
}