update to c++17 and bug fixes

This commit is contained in:
black
2025-07-08 10:52:42 +02:00
parent 462dedbe72
commit aa04d6177e
5 changed files with 31 additions and 13 deletions

View File

@@ -4,12 +4,26 @@
#include "Manager.h"
#include <iostream>
#include <utility>
#include <filesystem>
#include "components/Alu.h"
namespace fs = std::filesystem;
Manager::Manager(std::string path): m_path(std::move(path)) {
m_programFile.open(path);
std::cout << "Öffne Quellcode Datei: '" << m_path << "'" << "\n" << std::flush;
if (!fs::exists(m_path)) {
std::cerr << "Datei existiert nicht: " << m_path << "\n" << std::flush;
return;
}
m_programFile.open(m_path);
if (!m_programFile.is_open()) {
std::cerr << "Datei konnte nicht geöffnet werden: " << m_path << "\n" << std::flush;
std::cerr << "fail (z.B. Zugriffsrechte): " << m_programFile.fail() << "\n" << std::flush;
std::cerr << "bad (schwerwiegender Fehler): " << m_programFile.bad() << "\n" << std::flush;
return;
}
}
Manager::~Manager() {
@@ -24,6 +38,8 @@ Manager *Manager::getInstance(const std::string &program_path) {
int Manager::run() {
std::string line;
ProgramLoader::getInstance()->indexFile(m_programFile);
m_programFile.clear();
m_programFile.seekg(0);
while (std::getline(m_programFile, line)) {
auto lineVector = ProgramLoader::parseLine(line);
Alu::calculate(lineVector);