MCPcopy Create free account
hub / github.com/catboost/catboost / AppendTextWrappedString

Function AppendTextWrappedString

contrib/libs/flatbuffers/src/flatc.cpp:266–283  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

264static std::set<FlatCOption, decltype(cmp)> language_options(cmp);
265
266static void AppendTextWrappedString(std::stringstream &ss, std::string &text,
267 size_t max_col, size_t start_col) {
268 size_t max_line_length = max_col - start_col;
269
270 if (text.length() > max_line_length) {
271 size_t ideal_break_location = text.rfind(' ', max_line_length);
272 size_t length = std::min(max_line_length, ideal_break_location);
273 ss << text.substr(0, length) << "\n";
274 ss << std::string(start_col, ' ');
275 std::string rest_of_description = text.substr(
276 ((ideal_break_location < max_line_length || text.at(length) == ' ')
277 ? length + 1
278 : length));
279 AppendTextWrappedString(ss, rest_of_description, max_col, start_col);
280 } else {
281 ss << text;
282 }
283}
284
285static void AppendOption(std::stringstream &ss, const FlatCOption &option,
286 size_t max_col, size_t min_col_for_description) {

Callers 3

AppendOptionFunction · 0.85
GetShortUsageStringMethod · 0.85
GetUsageStringMethod · 0.85

Calls 6

minFunction · 0.50
stringClass · 0.50
lengthMethod · 0.45
rfindMethod · 0.45
substrMethod · 0.45
atMethod · 0.45

Tested by

no test coverage detected