| 163 | } |
| 164 | |
| 165 | string PBTxtToMultiline(StringPiece pbtxt, |
| 166 | const std::vector<string>& multi_line_fields) { |
| 167 | string ml; |
| 168 | // Probably big enough, since the input and output are about the |
| 169 | // same size, but just a guess. |
| 170 | ml.reserve(pbtxt.size() * (17. / 16)); |
| 171 | StringPiece line; |
| 172 | while (!pbtxt.empty()) { |
| 173 | // Split pbtxt into its first line and everything after. |
| 174 | SplitAt('\n', &pbtxt, &line); |
| 175 | // Convert line or output it unchanged |
| 176 | if (!ConvertLine(line, multi_line_fields, &ml)) { |
| 177 | strings::StrAppend(&ml, line, "\n"); |
| 178 | } |
| 179 | } |
| 180 | return ml; |
| 181 | } |
| 182 | |
| 183 | // Given a single line of text `line` with first : at `colon`, determine if |
| 184 | // there is an "<<END" expression after the colon and if so return true and set |