School Commit Init

This commit is contained in:
2024-08-31 12:07:21 +03:00
commit 0b130ee18c
2801 changed files with 4720552 additions and 0 deletions
@@ -0,0 +1,38 @@
#include "repo.h"
#include <string>
#include <fstream>
Repo::Repo()
{
this->readFromFile();
}
Repo::~Repo()
{
}
void Repo::addTask(Task task)
{
this->tasks.push_back(task);
}
std::vector<Task> Repo::getTasks()
{
return this->tasks;
}
void Repo::readFromFile()
{
std::ifstream file("tasks.txt");
std::string line;
while (std::getline(file, line)) {
std::string description = line.substr(0, line.find("|"));
line.erase(0, line.find("|") + 1);
int duration = std::stoi(line.substr(0, line.find("|")));
line.erase(0, line.find("|") + 1);
std::string date = line.substr(0, line.find("|"));
Task task(description, duration, date);
this->addTask(task);
}
}