| 36 | } |
| 37 | |
| 38 | void ConversionChain::AppendConvertedSegment(const char* segment, |
| 39 | std::string* output) const { |
| 40 | if (conversions.empty()) { |
| 41 | output->append(segment); |
| 42 | return; |
| 43 | } |
| 44 | |
| 45 | auto conversion = conversions.begin(); |
| 46 | auto lastConversion = conversions.end(); |
| 47 | --lastConversion; |
| 48 | if (conversion == lastConversion) { |
| 49 | (*conversion)->AppendConverted(segment, output); |
| 50 | return; |
| 51 | } |
| 52 | |
| 53 | std::string converted; |
| 54 | (*conversion)->AppendConverted(segment, &converted); |
| 55 | ++conversion; |
| 56 | for (; conversion != lastConversion; ++conversion) { |
| 57 | std::string next; |
| 58 | (*conversion)->AppendConverted(converted, &next); |
| 59 | converted.swap(next); |
| 60 | } |
| 61 | (*lastConversion)->AppendConverted(converted, output); |
| 62 | } |
| 63 | |
| 64 | void ConversionChain::AppendConvertedSegment(std::string_view segment, |
| 65 | std::string* output) const { |