From 7b141af08628069241ed7d1ac30b5f544e62bc82 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Mon, 30 May 2022 18:32:47 +0300 Subject: Autocommit at 30.05.2022 @ 18:32 --- src/UserInterface/UserInterface.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/UserInterface/UserInterface.cpp') diff --git a/src/UserInterface/UserInterface.cpp b/src/UserInterface/UserInterface.cpp index 3fd51a7..3272f0d 100644 --- a/src/UserInterface/UserInterface.cpp +++ b/src/UserInterface/UserInterface.cpp @@ -7,6 +7,7 @@ /* Private (static) */ Table* UserInterface::table = nullptr; +String fileName = String(); void UserInterface::com_open(const char* params) { if (table != nullptr) { @@ -16,16 +17,28 @@ void UserInterface::com_open(const char* params) { try { table = new Table(params); + fileName = params; } catch (std::logic_error err) { printLine(err.what()); } } void UserInterface::com_close(const char* params) { + if (table == nullptr) { + printLine("No file has been opened!"); + return; + } + + delete table; } void UserInterface::com_save(const char* params) { + com_saveas(fileName.get_cstr()); } void UserInterface::com_saveas(const char* params) { + if (table == nullptr) { + printLine("No file has been opened!"); + return; + } } void UserInterface::com_help(const char* params) { -- cgit v1.3.1-23-gd82d