32 lines
615 B
C++
32 lines
615 B
C++
|
|
#pragma once
|
|
|
|
#include <cmath>
|
|
#include <string>
|
|
#include <vector>
|
|
#include <regex>
|
|
|
|
namespace usql {
|
|
|
|
class CsvReader {
|
|
|
|
private:
|
|
char field_separator;
|
|
char line_separator;
|
|
char line_separator2;
|
|
char quote_character;
|
|
|
|
bool skip_header;
|
|
bool header_skiped;
|
|
|
|
public:
|
|
CsvReader(bool skip_hdr = false, char field_sep = ',', char quote_ch = '"', char line_sep = '\r',
|
|
char line_sep2 = '\n');
|
|
|
|
std::vector<std::vector<std::string>> parseCSV(const std::string &csvSource);
|
|
|
|
private:
|
|
void add_line(const std::vector<std::string> &line, std::vector<std::vector<std::string>> &lines);
|
|
};
|
|
}
|