From 0dee0e12dc7299e527d675d31054a2cba0f4fd12 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Sat, 12 Mar 2022 00:12:03 +0100 Subject: [PATCH] kraken: csv: move type aliases to 'csv.hh' header As we need to share it with the CSV writing files. --- src/csv/CMakeLists.txt | 1 + src/csv/csv.hh | 14 ++++++++++++++ src/csv/read-csv.hh | 10 ++-------- 3 files changed, 17 insertions(+), 8 deletions(-) create mode 100644 src/csv/csv.hh diff --git a/src/csv/CMakeLists.txt b/src/csv/CMakeLists.txt index c682f51..38e27b5 100644 --- a/src/csv/CMakeLists.txt +++ b/src/csv/CMakeLists.txt @@ -1,4 +1,5 @@ add_library(csv STATIC + csv.hh read-csv.cc read-csv.hh ) diff --git a/src/csv/csv.hh b/src/csv/csv.hh new file mode 100644 index 0000000..bb84782 --- /dev/null +++ b/src/csv/csv.hh @@ -0,0 +1,14 @@ +#pragma once + +#include +#include + +namespace kraken::csv { + +/// Represent a raw CSV line as a vector of strings. +using csv_line_type = std::vector; + +/// Represent a raw CSV file as a vector of raw CSV lines +using csv_type = std::vector; + +} // namespace kraken::csv diff --git a/src/csv/read-csv.hh b/src/csv/read-csv.hh index a1ceab8..674da6a 100644 --- a/src/csv/read-csv.hh +++ b/src/csv/read-csv.hh @@ -1,8 +1,8 @@ #pragma once #include -#include -#include + +#include "csv/csv.hh" namespace kraken::csv { @@ -14,12 +14,6 @@ enum class CsvHeader { KEEP, }; -/// Represent a raw CSV line as a vector of strings. -using csv_line_type = std::vector; - -/// Represent a raw CSV file as a vector of raw CSV lines -using csv_type = std::vector; - /// 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);