14 #include <hipipe/core/dataframe.hpp>
16 #include <range/v3/iterator/default_sentinel.hpp>
18 #include <experimental/filesystem>
40 class csv_istream_range :
public ranges::view_facade<csv_istream_range> {
43 friend ranges::range_access;
45 using single_pass = std::true_type;
46 enum class RowPosition{Normal, Last, End};
53 std::vector<std::string> row_;
54 RowPosition row_position_ = RowPosition::Normal;
58 csv_istream_range* rng_;
62 explicit cursor(csv_istream_range& rng) noexcept
71 std::vector<std::string>& read() const noexcept
76 std::vector<std::string>&& move() const noexcept
78 return std::move(rng_->row_);
81 bool equal(ranges::default_sentinel_t)
const noexcept
83 return rng_->row_position_ == RowPosition::End;
88 std::tuple<std::string, bool> parse_field();
93 cursor begin_cursor() {
return cursor{*
this}; }
96 csv_istream_range() =
default;
98 explicit csv_istream_range(std::istream& in,
118 bool has_header =
true,
119 char separator =
',',
128 const std::experimental::filesystem::path& file,
131 char separator =
',',
144 const std::vector<std::string>& row,
145 char separator =
',',
159 char separator =
',',
168 const std::experimental::filesystem::path& file,
170 char separator =
',',