Website Summary Files Commits Branches @commit @diff @stats
path: root / src / Models / Table.cpp
diff options
context:
space:
mode:
Commitce0db88d4bc4b0e1f8ee4268dec61a0b1c881596 (patch)
Author
 Syndamia <kamen@syndamia.com>
2022-05-30 19:28:02 +0300
Committer
 Syndamia <kamen@syndamia.com>
2022-05-30 19:28:02 +0300
Files91e6a01436836344d8ad706bfe6c60c39fc44127 /src/Models/Table.cpp
FMI-OOP-P2_Tables-ce0db88d4bc4b0e1f8ee4268dec61a0b1c881596.tar
FMI-OOP-P2_Tables-ce0db88d4bc4b0e1f8ee4268dec61a0b1c881596.tar.gz
FMI-OOP-P2_Tables-ce0db88d4bc4b0e1f8ee4268dec61a0b1c881596.zip
Parentc04304fc802eb7555ef2dc71b454b8c1fbaa1164 (diff)
Autocommit at 30.05.2022 @ 19:28
1 files changed, 5 insertions, 5 deletions
-rw-r--r--src/Models/Table.cpp10
diff --git a/src/Models/Table.cpp b/src/Models/Table.cpp
index 34719ed..be4c8bc 100644
--- a/src/Models/Table.cpp
+++ b/src/Models/Table.cpp
@@ -17,7 +17,7 @@ unsigned countOfCommas(std::ifstream& file) {
}
#define abs(a) ((a < 0) ? -a : a)
-#define isNumeric(a) (a >= '0' && a <= '9')
+#define isDigit(a) (a >= '0' && a <= '9')
bool containsNumber(const char*& str) {
while (*str == ' ') str++;
@@ -53,11 +53,11 @@ void Table::readFromFile(std::ifstream& inFile) {
colInd = 0;
inFile.get();
}
- else if (inFile.peek() == '-' || inFile.peek() == '+' || isNumeric(inFile.peek())) {
+ else if (inFile.peek() == '-' || inFile.peek() == '+' || isDigit(inFile.peek())) {
unsigned numberStart = inFile.tellg();
if (inFile.peek() == '-' || inFile.peek() == '+') inFile.get();
- if (!isNumeric(inFile.peek()))
- throw std::logic_error("");
+ if (!isDigit(inFile.peek()))
+ throw std::logic_error((((String("Error: Expected digit but got something else at row ") += cells.get_count()) += " and col ") += (unsigned)(inFile.tellg() % cells.get_count())).get_cstr());
}
}
}
@@ -66,7 +66,7 @@ Table::Table(const char* filePath) {
std::ifstream inFile(filePath);
if (inFile.is_open())
throw std::logic_error("Could now open file!");
- cells = List<List<Cell*>>(1);
+ cells = List<List<Cell*>>();
readFromFile(inFile);
inFile.close();
}