Website Summary Files Commits Branches @commit @diff @stats
path: root / src / Models / Table.cpp
diff options
context:
space:
mode:
Commit0157e5f0ba9b3c62f060322abb34b319104255ad (patch)
Author
 Syndamia <kamen@syndamia.com>
2022-05-30 21:48:52 +0300
Committer
 Syndamia <kamen@syndamia.com>
2022-05-30 21:48:52 +0300
Files716fcfa7d538de4f41b5b4a80b929f796468afe4 /src/Models/Table.cpp
FMI-OOP-P2_Tables-0157e5f0ba9b3c62f060322abb34b319104255ad.tar
FMI-OOP-P2_Tables-0157e5f0ba9b3c62f060322abb34b319104255ad.tar.gz
FMI-OOP-P2_Tables-0157e5f0ba9b3c62f060322abb34b319104255ad.zip
Parent9d3cc59256daa844e3b3d65a9010738bc046b588 (diff)
Autocommit at 30.05.2022 @ 21:48
1 files changed, 4 insertions, 2 deletions
-rw-r--r--src/Models/Table.cpp6
diff --git a/src/Models/Table.cpp b/src/Models/Table.cpp
index 60da314..54c34bd 100644
--- a/src/Models/Table.cpp
+++ b/src/Models/Table.cpp
@@ -37,10 +37,9 @@ void Table::readFromFile(std::ifstream& inFile) {
unsigned colInd = 0;
cells.add(List<Cell*>(commaCount));
- while (!inFile.eof()) {
+ while (inFile.peek() != EOF) {
while (inFile.peek() == ' ') inFile.get();
- std::cout << (char)inFile.peek() << std::endl;
// Entering a new cell on the current row
if (inFile.peek() == ',') {
colInd++;
@@ -91,11 +90,14 @@ void Table::readFromFile(std::ifstream& inFile) {
String res;
inFile.get();
while (inFile.peek() != '"') {
+ if (inFile.peek() == '\n')
+ throw std::logic_error(fileLocationExceptionMsg("Error: Could not find a matching end quote for string at row ", cells.get_count(), inFile.tellg() % commaCount + 1));
if (inFile.peek() == '\\') {
inFile.get();
}
res += inFile.get();
}
+ inFile.get();
if (*res.get_cstr() == '=')
cells[cells.get_count() - 1][colInd++] = new CellFormula(res.get_cstr(), &cells);