Demonstrates the fix for https://github.com/p-ranav/tabulate/issues/111: clean Unicode box-drawing borders/corners instead of the default ASCII "+"/"-"/"|", without having to manually set each row's corners/borders.
| 6 | // clean Unicode box-drawing borders/corners instead of the default ASCII |
| 7 | // "+"/"-"/"|", without having to manually set each row's corners/borders. |
| 8 | int main() { |
| 9 | Table outer_box_only; |
| 10 | outer_box_only.add_row(Row_t{"Quantity", "Value"}); |
| 11 | outer_box_only.add_row(Row_t{"A", "1"}); |
| 12 | outer_box_only.add_row(Row_t{"B", "2"}); |
| 13 | outer_box_only.use_unicode_borders(); |
| 14 | std::cout << "Outer box only:\n" << outer_box_only << "\n\n"; |
| 15 | |
| 16 | Table with_row_separators; |
| 17 | with_row_separators.add_row(Row_t{"Quantity", "Value"}); |
| 18 | with_row_separators.add_row(Row_t{"A", "1"}); |
| 19 | with_row_separators.add_row(Row_t{"B", "2"}); |
| 20 | with_row_separators.use_unicode_borders(true); |
| 21 | std::cout << "With row separators:\n" << with_row_separators << "\n\n"; |
| 22 | |
| 23 | Table heavy; |
| 24 | heavy.add_row(Row_t{"col1", "col2"}); |
| 25 | heavy.add_row(Row_t{"val1", "val2"}); |
| 26 | heavy.use_unicode_borders(true, BorderStyle::Heavy); |
| 27 | std::cout << "Heavy style:\n" << heavy << "\n\n"; |
| 28 | |
| 29 | Table double_line; |
| 30 | double_line.add_row(Row_t{"col1", "col2"}); |
| 31 | double_line.add_row(Row_t{"val1", "val2"}); |
| 32 | double_line.use_unicode_borders(true, BorderStyle::Double); |
| 33 | std::cout << "Double style:\n" << double_line << std::endl; |
| 34 | } |