| 87 | } |
| 88 | |
| 89 | void TablePrinter::InsertRow(const std::vector<std::string>& row) { |
| 90 | std::vector<std::vector<std::string>> table_row; |
| 91 | size_t max_height = 0; |
| 92 | |
| 93 | for (size_t i = 0; i < row.size(); ++i) { |
| 94 | table_row.emplace_back(); |
| 95 | std::stringstream ss(row[i]); |
| 96 | std::string line; |
| 97 | size_t max_width = 0; |
| 98 | while (std::getline(ss, line, '\n')) { |
| 99 | table_row[i].emplace_back(line); |
| 100 | if (line.length() > max_width) max_width = line.length(); |
| 101 | } |
| 102 | |
| 103 | if (static_cast<float>(max_width) > widths_[i]) |
| 104 | widths_[i] = static_cast<float>(max_width); |
| 105 | |
| 106 | size_t num_lines = table_row[i].size(); |
| 107 | if (num_lines > max_height) max_height = num_lines; |
| 108 | } |
| 109 | |
| 110 | heights_.emplace_back(max_height); |
| 111 | data_.emplace_back(table_row); |
| 112 | } |
| 113 | |
| 114 | void TablePrinter::InsetDivider() { |
| 115 | heights_.emplace_back(1); |
no test coverage detected