Website Summary Files Commits Branches @commit @diff @stats
path: root / src
diff options
context:
space:
mode:
Commit553111770e5f3df085130378e249e6cf52859a4d (patch)
Author
 Syndamia <kamen@syndamia.com>
2022-06-14 14:34:33 +0300
Committer
 Syndamia <kamen@syndamia.com>
2022-06-14 14:34:33 +0300
Files9e15b3ca98b88df3bb381872decc138ebcace947 /src
FMI-OOP-P2_Tables-553111770e5f3df085130378e249e6cf52859a4d.tar
FMI-OOP-P2_Tables-553111770e5f3df085130378e249e6cf52859a4d.tar.gz
FMI-OOP-P2_Tables-553111770e5f3df085130378e249e6cf52859a4d.zip
Parent7cf7145c28babd1bacc36153db6273c627ef8669 (diff)
Autocommit at 14.06.2022 @ 14:34
3 files changed, 13 insertions, 7 deletions
-rw-r--r--src/Models/CellString.cpp5
-rw-r--r--src/UserInterface/UserInterface.cpp13
-rw-r--r--src/test.table2
diff --git a/src/Models/CellString.cpp b/src/Models/CellString.cpp
index f323a7c..2a105ef 100644
--- a/src/Models/CellString.cpp
+++ b/src/Models/CellString.cpp
@@ -20,4 +20,9 @@ void CellString::parseAndSetValue(const char* str) {
void CellString::writeToFile(std::ofstream& file) {
file << '"';
const char* strCpy = value.get_cstr();
+ while (*strCpy != '\0') {
+ if (*strCpy == '\\' || *strCpy == '"') file << '\\';
+ file << *(strCpy++);
+ }
+ file << '"';
}
diff --git a/src/UserInterface/UserInterface.cpp b/src/UserInterface/UserInterface.cpp
index 99b1d2f..c3ecbe3 100644
--- a/src/UserInterface/UserInterface.cpp
+++ b/src/UserInterface/UserInterface.cpp
@@ -56,12 +56,13 @@ void UserInterface::com_saveas(const char* params) {
void UserInterface::com_help(const char* params) {
std::cout << "The following commands are supported:" << std::endl
- << "open <file> opens <file>" << std::endl
- << "close closes currently opened file" << std::endl
- << "save saves the currently open file" << std::endl
- << "saveas <file> saves the currently open file in <file>" << std::endl
- << "help prints this information" << std::endl
- << "exit exists the program" << std::endl;
+
+ << "open <file> opens <file>" << std::endl
+ << "close closes currently opened file" << std::endl
+ << "save saves the currently open file" << std::endl
+ << "saveas <file> saves the currently open file in <file>" << std::endl
+ << "help prints this information" << std::endl
+ << "exit exists the program" << std::endl;
}
void UserInterface::com_exit(const char* params) {
diff --git a/src/test.table b/src/test.table
index 805f6db..96605ff 100644
--- a/src/test.table
+++ b/src/test.table
@@ -1,3 +1,3 @@
8.6,3,"String","= 3 * R1C2 + R1C1 ^ R1C2 * 27 / R1C2 - 2 * 2.5 * 2 * 2 + R1C3 ^ R1C3","",
-"C:\My\File"","Bruh","=R1C0 + R1C1","C:\Doc\"asdf"",-2,,
+"C:\\My\\File\"","Bruh","=R1C0 + R1C1","C:\\Doc\\\"asdf\"",-2,,