Vince's CSV Parser
Loading...
Searching...
No Matches
csv_reader_iterator.cpp
Go to the documentation of this file.
1
5#include "csv_reader.hpp"
6
7namespace csv {
8#if CSV_EXCEPTIONS_ENABLED
11 CSVRow row;
12 if (!this->read_row(row)) {
13 return this->end();
14 }
15 return CSVReader::iterator(this, std::move(row));
16 }
17
21 CSV_CONST CSVReader::iterator CSVReader::end() const noexcept {
22 return CSVReader::iterator();
23 }
24
25 CSVReader::iterator::iterator(CSVReader* _daddy, CSVRow&& _row) :
26 daddy(_daddy) {
27 row = std::move(_row);
28 }
29
38 if (!daddy->read_row(this->row)) {
39 this->daddy = nullptr; // this == end()
40 }
41
42 return *this;
43 }
44
47 auto temp = *this;
48 if (!daddy->read_row(this->row)) {
49 this->daddy = nullptr; // this == end()
50 }
51
52 return temp;
53 }
54#endif
55}
An input iterator capable of handling large files.
iterator & operator++()
Pre-increment iterator.
Main class for parsing CSVs from files and in-memory sources.
CSV_CONST iterator end() const noexcept
A placeholder for the imaginary past-the-end row in a CSV.
bool read_row(CSVRow &row)
Retrieve the next CSV row, returning true while more rows are available.
iterator begin()
Return an iterator to the first row in the reader.
Data structure for representing CSV rows.
Definition csv_row.hpp:533
Defines functionality needed for basic CSV parsing.
The all encompassing namespace.