From ce0db88d4bc4b0e1f8ee4268dec61a0b1c881596 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Mon, 30 May 2022 19:28:02 +0300 Subject: Autocommit at 30.05.2022 @ 19:28 --- src/Models/Table.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/Models/Table.cpp') 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>(1); + cells = List>(); readFromFile(inFile); inFile.close(); } -- cgit v1.3.1-23-gd82d