diff options
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)); } |
