Website Summary Files Commits Branches @commit @diff @stats
path: root / src
diff options
context:
space:
mode:
Commitb51956b8f98f6fbfb341df0a81f159a7425fac2b (patch)
Author
 Syndamia <kamen@syndamia.com>
2022-06-13 20:47:39 +0300
Committer
 Syndamia <kamen@syndamia.com>
2022-06-13 20:47:39 +0300
Filesf1fd0bde8da11fa9b42798d0e1819bc182bcb5b9 /src
FMI-OOP-P2_Tables-b51956b8f98f6fbfb341df0a81f159a7425fac2b.tar
FMI-OOP-P2_Tables-b51956b8f98f6fbfb341df0a81f159a7425fac2b.tar.gz
FMI-OOP-P2_Tables-b51956b8f98f6fbfb341df0a81f159a7425fac2b.zip
Parent80274416a43b79d2bce9de2dbd3a5a0b688dad6a (diff)
Autocommit at 13.06.2022 @ 20:47
3 files changed, 16 insertions, 1 deletions
-rw-r--r--src/Models/CellInt.cpp6
-rw-r--r--src/Models/CellInt.h1
-rw-r--r--src/Models/Table.cpp10
diff --git a/src/Models/CellInt.cpp b/src/Models/CellInt.cpp
index 280a3c3..827f346 100644
--- a/src/Models/CellInt.cpp
+++ b/src/Models/CellInt.cpp
@@ -5,6 +5,12 @@ CellInt::CellInt(int value) {
this->value = value;
}
+CellInt::CellInt(const char* str) {
+ value = 0;
+ while (*str != '\0')
+ value = value * 10 + '0' - *(str++);
+}
+
double CellInt::getNumeralValue() const {
return value;
}
diff --git a/src/Models/CellInt.h b/src/Models/CellInt.h
index cc7dab5..8be1022 100644
--- a/src/Models/CellInt.h
+++ b/src/Models/CellInt.h
@@ -9,6 +9,7 @@ class CellInt : public Cell {
public:
CellInt() = default;
CellInt(int value);
+ CellInt(const char* str);
double getNumeralValue() const override;
String getValueForPrint() const override;
diff --git a/src/Models/Table.cpp b/src/Models/Table.cpp
index d19fbed..ddadc45 100644
--- a/src/Models/Table.cpp
+++ b/src/Models/Table.cpp
@@ -42,6 +42,7 @@ void A(std::ifstream& in, List<char>& buffer) {
void Table::readFromFile(std::ifstream& inFile) {
while (inFile.peek() != EOF) {
List<char> buffer;
+
W(inFile);
if (inFile.peek() == '"') {
inFile.get();
@@ -53,7 +54,14 @@ void Table::readFromFile(std::ifstream& inFile) {
: (Cell*)new CellString(buffer.raw_data());
}
else {
-
+ P(inFile, buffer);
+ D(inFile, buffer);
+ if (inFile.peek() == '.') {
+ inFile.get();
+ D(inFile, buffer);
+ }
+ else
+ cells[0][0] = (Cell*)new CellInt(buffer.raw_data());
}
}
}