diff options
3 files changed, 6 insertions, 5 deletions
| -rw-r--r-- | src/Models/Table.h | 1 | ||||
| -rw-r--r-- | src/UserInterface/UserInterface.cpp | 9 | ||||
| -rw-r--r-- | src/UserInterface/UserInterface.h | 1 |
diff --git a/src/Models/Table.h b/src/Models/Table.h index 136cd92..6fb516a 100644 --- a/src/Models/Table.h +++ b/src/Models/Table.h @@ -9,7 +9,6 @@ class Table { public: Table(unsigned rows, unsigned cols); - unsigned getCellCount(); void putCell(unsigned row, unsigned col, const char* rawValue); List<String> getAllCells() const; diff --git a/src/UserInterface/UserInterface.cpp b/src/UserInterface/UserInterface.cpp index f9d7d87..8698a71 100644 --- a/src/UserInterface/UserInterface.cpp +++ b/src/UserInterface/UserInterface.cpp @@ -6,16 +6,17 @@ /* Private (static) */ void UserInterface::com_print(const char* params) { - List<String> cells = this->table.getAllCells(); + List<String> cells = table.getAllCells(); } /* Public */ UserInterface::UserInterface(Table& table) : menu() { - if (this->table.getCellCount() > 0) - throw new std::logic_error("Singleton instance!"); + if (!instantiated) { + this->table = table; + instantiated = true; + } - this->table = table; menu.addCommand(Command("print", com_print)); menu.addCommand(Command("edit", com_edit)); } diff --git a/src/UserInterface/UserInterface.h b/src/UserInterface/UserInterface.h index 69a97ce..1455ce4 100644 --- a/src/UserInterface/UserInterface.h +++ b/src/UserInterface/UserInterface.h @@ -7,6 +7,7 @@ class UserInterface { Menu menu; + static bool instantiated; static Table& table; static void com_open(const char* params); |
