MCPcopy Create free account
hub / github.com/BYVoid/OpenCC / AppendConvertedSegment

Method AppendConvertedSegment

src/ConversionChain.cpp:38–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36}
37
38void 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
64void ConversionChain::AppendConvertedSegment(std::string_view segment,
65 std::string* output) const {

Callers 1

ConvertMethod · 0.80

Calls 8

AppendConvertedMethod · 0.80
emptyMethod · 0.45
appendMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
swapMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected