5#ifndef IDOL_PARSE_DELIMITED_H
6#define IDOL_PARSE_DELIMITED_H
14 std::vector<std::vector<std::string>> parse_delimited(
const std::string &t_filename,
char t_delimiter) {
15 std::vector<std::vector<std::string>> result;
17 std::ifstream file(t_filename);
19 if (!file.is_open()) {
20 throw std::runtime_error(
"Could not open file.");
25 if (!getline(file, line)) {
break; }
27 std::istringstream line_stream(line);
29 std::vector<std::string> line_cells;
31 std::string cell_content;
32 if (!getline(line_stream, cell_content, t_delimiter))
break;
33 line_cells.push_back(cell_content);
36 result.emplace_back(std::move(line_cells));