MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / preprocessEscapeCodes

Function preprocessEscapeCodes

source/core/StarText.cpp:77–94  ·  view source on GitHub ↗

The below two functions aren't used anymore, not bothering with StringView for them

Source from the content-addressed store, hash-verified

75
76 // The below two functions aren't used anymore, not bothering with StringView for them
77 String preprocessEscapeCodes(String const& s) {
78 bool escape = false;
79 std::string result = s.utf8();
80
81 size_t escapeStartIdx = 0;
82 for (size_t i = 0; i < result.size(); i++) {
83 auto& c = result[i];
84 if (isEscapeCode(c)) {
85 escape = true;
86 escapeStartIdx = i;
87 }
88 if ((c <= SpecialCharLimit) && !(c == StartEsc))
89 escape = false;
90 if ((c == EndEsc) && escape)
91 result[escapeStartIdx] = StartEsc;
92 }
93 return {result};
94 }
95
96 String extractCodes(String const& s) {
97 bool escape = false;

Callers 1

extractCodesFunction · 0.85

Calls 2

isEscapeCodeFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected