MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/TriangleMeshDistance / Column

Class Column

tests/catch.hpp:6384–6548  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6382class Columns;
6383
6384class Column {
6385 std::vector<std::string> m_strings;
6386 size_t m_width = CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH;
6387 size_t m_indent = 0;
6388 size_t m_initialIndent = std::string::npos;
6389
6390public:
6391 class iterator {
6392 friend Column;
6393
6394 Column const& m_column;
6395 size_t m_stringIndex = 0;
6396 size_t m_pos = 0;
6397
6398 size_t m_len = 0;
6399 size_t m_end = 0;
6400 bool m_suffix = false;
6401
6402 iterator(Column const& column, size_t stringIndex)
6403 : m_column(column),
6404 m_stringIndex(stringIndex) {}
6405
6406 auto line() const -> std::string const& { return m_column.m_strings[m_stringIndex]; }
6407
6408 auto isBoundary(size_t at) const -> bool {
6409 assert(at > 0);
6410 assert(at <= line().size());
6411
6412 return at == line().size() ||
6413 (isWhitespace(line()[at]) && !isWhitespace(line()[at - 1])) ||
6414 isBreakableBefore(line()[at]) ||
6415 isBreakableAfter(line()[at - 1]);
6416 }
6417
6418 void calcLength() {
6419 assert(m_stringIndex < m_column.m_strings.size());
6420
6421 m_suffix = false;
6422 auto width = m_column.m_width - indent();
6423 m_end = m_pos;
6424 while (m_end < line().size() && line()[m_end] != '\n')
6425 ++m_end;
6426
6427 if (m_end < m_pos + width) {
6428 m_len = m_end - m_pos;
6429 } else {
6430 size_t len = width;
6431 while (len > 0 && !isBoundary(m_pos + len))
6432 --len;
6433 while (len > 0 && isWhitespace(line()[m_pos + len - 1]))
6434 --len;
6435
6436 if (len > 0) {
6437 m_len = len;
6438 } else {
6439 m_suffix = true;
6440 m_len = width - 1;
6441 }

Callers 10

writeToStreamMethod · 0.85
listTestsFunction · 0.85
listTagsFunction · 0.85
listReportersFunction · 0.85
catch.hppFile · 0.85
applyCommandLineMethod · 0.85
printMessageMethod · 0.85
benchmarkStartingMethod · 0.85
printHeaderStringMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected