1#ifndef PACEMAKER_IO_CSVLEXER_HPP_
2#define PACEMAKER_IO_CSVLEXER_HPP_
50 CSVLexer(std::istream *in) : yyFlexLexer(in) {}
57 using FlexLexer::yylex;
73 auto yylex(std::string *
const yyval) -> int;
82 auto newline() ->
void { this->m_content.emplace_back(std::vector<std::string>{}); }
91 auto append(
const std::string &field) ->
void { this->m_content.back().emplace_back(field); }
98 auto data() const & -> const std::vector<std::vector<std::
string>> & {
return this->m_content; }
105 auto data() && -> std::vector<std::vector<std::string>> {
return std::move(this->m_content); }
114 auto reset() ->
void { this->m_content.clear(); }
123 std::vector<std::vector<std::string>> m_content;
Tokenizer and record accumulator for CSV parsing.
CSVLexer(std::istream *in)
Constructs a lexer bound to the given input stream.
auto data() &&-> std::vector< std::vector< std::string > >
Moves all records accumulated so far.
auto data() const &-> const std::vector< std::vector< std::string > > &
Returns a copy of all records accumulated so far.
auto reset() -> void
Clears all accumulated records.
auto newline() -> void
Begins a new record by appending an empty row to the result.
virtual ~CSVLexer()=default
Virtual destructor; no additional cleanup beyond the base class.
auto yylex(std::string *const yyval) -> int
Scans the next token from the input stream.
auto append(const std::string &field) -> void
Appends a field value to the current (last) record.