usql/csvreader.h

36 lines
723 B
C++

#pragma once
#include <cmath>
#include <string>
#include <vector>
#include <regex>
#include <functional>
#include "parser.h"
#include "table.h"
namespace usql {
class CsvReader {
private:
char field_separator;
char line_separator;
char line_separator2;
char quote_character;
bool skip_header;
bool header_skiped;
public:
explicit CsvReader(bool skip_hdr = true, char field_sep = ',', char quote_ch = '"', char line_sep = '\r', char line_sep2 = '\n');
size_t parseCSVFile(const std::string &filename, std::vector<ColDefNode> &cols_def, Table& table);
size_t parseCSVString(const std::string &csvSource, std::vector<ColDefNode> &cols_def, Table& table);
static size_t getConcurrency();
};
} // namespace