Skip to content
Snippets Groups Projects
Commit 2828a377 authored by Tom Fischer's avatar Tom Fischer
Browse files

[A/IO] Refactor CsvInterface::getColumnNames.

parent 57c3e49f
No related branches found
No related tags found
No related merge requests found
...@@ -30,21 +30,24 @@ std::vector<std::string> CsvInterface::getColumnNames(std::string const& fname, ...@@ -30,21 +30,24 @@ std::vector<std::string> CsvInterface::getColumnNames(std::string const& fname,
if (!in.is_open()) if (!in.is_open())
{ {
ERR("CsvInterface::readPoints(): Could not open file {:s}.", fname); ERR("CsvInterface::getColumnNames(): Could not open file {:s}.", fname);
return std::vector<std::string>(); return std::vector<std::string>();
} }
std::string line; std::string line;
if (!std::getline(in, line)) if (!std::getline(in, line))
{ {
ERR("CsvInterface::getColumnNames(): Could not read line from file "
"{:s}. Is it empty?",
fname);
return {}; return {};
} }
std::list<std::string> fields; if (delim == '\n')
if (delim != '\n')
{ {
fields = BaseLib::splitString(line, delim); return {};
} }
std::list<std::string> fields = BaseLib::splitString(line, delim);
if (fields.size() < 2) if (fields.size() < 2)
{ {
for (char const d : {'\t', ';', ','}) for (char const d : {'\t', ';', ','})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment