2025-01-28 11:46:16 -07:00
|
|
|
#pragma once
|
2025-01-29 20:55:57 -07:00
|
|
|
#include <vector>
|
2025-01-29 18:58:36 -07:00
|
|
|
#include <fstream>
|
|
|
|
|
|
2025-01-29 20:55:57 -07:00
|
|
|
/*
|
|
|
|
|
* THIS PORTION OF CODE WAS DONATED BY szaszmango from brodie's server!
|
|
|
|
|
*/
|
2025-01-29 18:58:36 -07:00
|
|
|
|
2025-01-29 20:55:57 -07:00
|
|
|
// This magic returns a vector which contain all the objects created using the CPU class
|
|
|
|
|
std::vector<CPU> genCPUclasses() {
|
|
|
|
|
std::vector<CPU> resultCpuList;
|
|
|
|
|
std::ifstream cpuList{"lists/cpulist", std::ifstream::in};
|
2025-01-29 18:58:36 -07:00
|
|
|
|
|
|
|
|
if(cpuList.is_open()) {
|
2025-01-29 20:55:57 -07:00
|
|
|
std::cout << "File opened\n";
|
2025-01-29 18:58:36 -07:00
|
|
|
}
|
2025-01-29 20:55:57 -07:00
|
|
|
else { std::cout << "Failed to open file!\n"; }
|
2025-01-29 18:58:36 -07:00
|
|
|
|
2025-01-29 20:55:57 -07:00
|
|
|
std::string line;
|
|
|
|
|
while (std::getline(cpuList, line)) {
|
|
|
|
|
CPU cpu;
|
|
|
|
|
cpu.HardwareSpecs["model"] = line;
|
|
|
|
|
resultCpuList.push_back(std::move(cpu));
|
|
|
|
|
std::cout << "Loaded CPU: " << line << std::endl;
|
2025-01-29 18:58:36 -07:00
|
|
|
}
|
2025-01-28 11:46:16 -07:00
|
|
|
|
2025-01-29 20:55:57 -07:00
|
|
|
return resultCpuList;
|
|
|
|
|
}
|