diff options
| Commit | bc007452c38bed6ab4f1cf3286990a9a3d6e100c (patch) | |
|---|---|---|
| Author | 2022-05-29 08:49:04 +0300 | |
| Committer | 2022-05-29 08:49:04 +0300 | |
| Files | f1989971c63e8d4c72364ced52ffbd5cdc0b2464 /src | |
| FMI-OOP-P2_Tables-bc007452c38bed6ab4f1cf3286990a9a3d6e100c.tar FMI-OOP-P2_Tables-bc007452c38bed6ab4f1cf3286990a9a3d6e100c.tar.gz FMI-OOP-P2_Tables-bc007452c38bed6ab4f1cf3286990a9a3d6e100c.zip | ||
| Parent | 291ecb302cc7281c254542543a065aec3ba13bb9 (diff) | |
Autocommit at 29.05.2022 @ 08:49
2 files changed, 8 insertions, 2 deletions
| -rw-r--r-- | src/Generic/ConsoleInterface/Toolbox.cpp | 8 | ||||
| -rw-r--r-- | src/Models/Table.cpp | 2 |
diff --git a/src/Generic/ConsoleInterface/Toolbox.cpp b/src/Generic/ConsoleInterface/Toolbox.cpp index af336fe..33f71b3 100644 --- a/src/Generic/ConsoleInterface/Toolbox.cpp +++ b/src/Generic/ConsoleInterface/Toolbox.cpp @@ -50,7 +50,7 @@ void __printPadded(const String& str, unsigned width) { width--; print(" "); } - std::cout << str.get_cstr(); + print(str.get_cstr()); } /*! \param startNumber The number by which column and row enumeration begins @@ -64,11 +64,17 @@ void __printPadded(const String& str, unsigned width) { * The rows are "calculated" from the columns count and the items length. */ void printTable(const List<String>& items, unsigned columns) { + printLine(""); + unsigned *colWidths = new unsigned[columns]; + for (unsigned i = 0; i < columns; i++) + colWidths[i] = 0; + for (unsigned i = 0; i < items.get_count(); i++) { if (colWidths[i % columns] < items[i].get_length()) colWidths[i % columns] = items[i].get_length(); } + std::cout << colWidths[0] << std::endl; // __printTableColumnHeader(columns); diff --git a/src/Models/Table.cpp b/src/Models/Table.cpp index 0d3264e..1a36bd0 100644 --- a/src/Models/Table.cpp +++ b/src/Models/Table.cpp @@ -15,7 +15,7 @@ Table::Table(unsigned rows, unsigned cols) { } unsigned Table::get_cols() const { - return cells[0].get_count(); + return cells[0].get_length(); } bool containsNumber(const char*& str) { |
