diff --git a/src/csv/read-csv.cc b/src/csv/read-csv.cc index 5274d12..002922b 100644 --- a/src/csv/read-csv.cc +++ b/src/csv/read-csv.cc @@ -4,10 +4,7 @@ namespace kraken::csv { -namespace { - -// for convenience, use a stringstream which does not accept string_view inputs -csv_line_type parse_line(std::string const& line) { +csv_line_type read_csv_line(std::string const& line) { auto parsed = csv_line_type{}; auto input = std::istringstream(line); @@ -18,8 +15,6 @@ csv_line_type parse_line(std::string const& line) { return parsed; } -} // namespace - csv_type read_csv(std::istream& input, CsvHeader header) { auto parsed = std::vector{}; @@ -30,7 +25,7 @@ csv_type read_csv(std::istream& input, CsvHeader header) { continue; } - parsed.emplace_back(parse_line(std::move(line))); + parsed.emplace_back(read_csv_line(std::move(line))); } return parsed; diff --git a/src/csv/read-csv.hh b/src/csv/read-csv.hh index 674da6a..6e0542a 100644 --- a/src/csv/read-csv.hh +++ b/src/csv/read-csv.hh @@ -14,6 +14,9 @@ enum class CsvHeader { KEEP, }; +/// Parse a single CSV line, no error checking. +csv_line_type read_csv_line(std::string const& input); + /// Parse a CSV file from an input-stream, return a vector of parsed lines. csv_type read_csv(std::istream& input, CsvHeader header = CsvHeader::SKIP);