diff options
| Commit | 01a6f816ddea3508b4b696214ba543a8e60658f4 (patch) | |
|---|---|---|
| Author | 2022-05-30 18:57:51 +0300 | |
| Committer | 2022-05-30 18:57:51 +0300 | |
| Files | 20ed1c6b178a73dd48566298538f01a61da6e0d4 /src | |
| FMI-OOP-P2_Tables-01a6f816ddea3508b4b696214ba543a8e60658f4.tar FMI-OOP-P2_Tables-01a6f816ddea3508b4b696214ba543a8e60658f4.tar.gz FMI-OOP-P2_Tables-01a6f816ddea3508b4b696214ba543a8e60658f4.zip | ||
| Parent | 37d6c0ffdd0dd8f99b094f5012316e98ae60b8df (diff) | |
Autocommit at 30.05.2022 @ 18:57
3 files changed, 16 insertions, 0 deletions
| -rw-r--r-- | src/Models/Table.cpp | 9 | ||||
| -rw-r--r-- | src/Models/Table.h | 2 | ||||
| -rw-r--r-- | src/UserInterface/UserInterface.cpp | 5 |
diff --git a/src/Models/Table.cpp b/src/Models/Table.cpp index 132559f..9403696 100644 --- a/src/Models/Table.cpp +++ b/src/Models/Table.cpp @@ -4,6 +4,15 @@ #include "CellString.h" #include "CellFormula.h" #include <cstring> +#include <fstream> +#include <exception> + +Table::Table(const char* filePath) { + std::ifstream inFile(filePath); + if (inFile.is_open()) + throw new std::logic_error("Could now open file!"); + cells = List<List<Cell*>>(); +} Table::Table(unsigned rows, unsigned cols) { if (rows == 0 || cols == 0) diff --git a/src/Models/Table.h b/src/Models/Table.h index 6da817c..e15ee37 100644 --- a/src/Models/Table.h +++ b/src/Models/Table.h @@ -3,9 +3,11 @@ #include "Cell.h" #include "../Generic/List/List.hpp" +#include <fstream> class Table { List<List<Cell*>> cells; + void readFromFile(std::ifstream); public: Table(const char* filePath); diff --git a/src/UserInterface/UserInterface.cpp b/src/UserInterface/UserInterface.cpp index 8445d0b..c8b672e 100644 --- a/src/UserInterface/UserInterface.cpp +++ b/src/UserInterface/UserInterface.cpp @@ -94,7 +94,12 @@ UserInterface::UserInterface(Table* inTable) : menu() { if (table == nullptr) table = inTable; + menu.addCommand(Command("open", com_open)); + menu.addCommand(Command("close", com_close)); + menu.addCommand(Command("save", com_save)); + menu.addCommand(Command("saveas", com_saveas)); menu.addCommand(Command("help", com_help)); + menu.addCommand(Command("exit", com_exit)); menu.addCommand(Command("print", com_print)); menu.addCommand(Command("edit", com_edit)); } |
