Website Summary Files Commits Branches @commit @diff @stats
path: root / src / Models / Table.cpp
diff options
context:
space:
mode:
Commit99a05dd4bed3c7027005048dca22b3a0efea5a90 (patch)
Author
 Syndamia <kamen@syndamia.com>
2022-05-30 21:33:46 +0300
Committer
 Syndamia <kamen@syndamia.com>
2022-05-30 21:33:46 +0300
Files75c75efa522dbcd843cf99402064b405ea74fc21 /src/Models/Table.cpp
FMI-OOP-P2_Tables-99a05dd4bed3c7027005048dca22b3a0efea5a90.tar
FMI-OOP-P2_Tables-99a05dd4bed3c7027005048dca22b3a0efea5a90.tar.gz
FMI-OOP-P2_Tables-99a05dd4bed3c7027005048dca22b3a0efea5a90.zip
Parentdfed677a8a8e6d0d75d14ed9626c16184ff4f066 (diff)
Autocommit at 30.05.2022 @ 21:33
1 files changed, 4 insertions, 4 deletions
-rw-r--r--src/Models/Table.cpp8
diff --git a/src/Models/Table.cpp b/src/Models/Table.cpp
index 75c5e70..861e2f0 100644
--- a/src/Models/Table.cpp
+++ b/src/Models/Table.cpp
@@ -38,7 +38,6 @@ void Table::readFromFile(std::ifstream& inFile) {
unsigned colInd = 0;
cells.add(List<Cell*>(commaCount));
while (inFile.peek() != EOF) {
- std::cout << inFile.peek() << std::endl;
while (inFile.peek() == ' ') inFile.get();
// Entering a new cell on the current row
@@ -63,7 +62,7 @@ void Table::readFromFile(std::ifstream& inFile) {
}
if (isDigit(inFile.peek()))
- throw std::logic_error(fileLocationExceptionMsg("Error: Expected digit but got something else at row ", cells.get_count(), inFile.tellg() % commaCount));
+ throw std::logic_error(fileLocationExceptionMsg("Error: Expected digit but got something else at row ", cells.get_count(), inFile.tellg() % commaCount + 1));
// Parsing digits of whole number/whole part of floating point number
while (isDigit(inFile.peek())) {
@@ -79,7 +78,7 @@ void Table::readFromFile(std::ifstream& inFile) {
}
if (inFile.peek() != ' ' && inFile.peek() != ',' && inFile.peek() != '\n')
- throw std::logic_error(fileLocationExceptionMsg("Error: Expected space, comma or newline but got something else at row ", cells.get_count(), inFile.tellg() % commaCount));
+ throw std::logic_error(fileLocationExceptionMsg("Error: Expected space, comma or newline but got something else at row ", cells.get_count(), inFile.tellg() % commaCount + 1));
if (exponent == 1)
cells[cells.get_count() - 1][colInd++] = new CellInt(whole);
@@ -103,7 +102,7 @@ void Table::readFromFile(std::ifstream& inFile) {
cells[cells.get_count() - 1][colInd++] = new CellString(res.get_cstr());
}
else
- throw std::logic_error(fileLocationExceptionMsg("Error: Could not determine type of value at row ", cells.get_count(), inFile.tellg() % cells.get_count() + 1));
+ throw std::logic_error(fileLocationExceptionMsg("Error: Could not determine type of value at row ", cells.get_count(), inFile.tellg() % commaCount + 1));
}
}
#include <iostream>
@@ -111,6 +110,7 @@ Table::Table(const char* filePath) {
std::ifstream inFile(filePath);
if (!inFile.is_open())
throw std::logic_error("Could not open file!");
+ std::cout << inFile.peek() << std::endl;
cells = List<List<Cell*>>();
readFromFile(inFile);
inFile.close();