15 class IBasicCSVParser;
104 this->no_quote = !use_quote;
110 this->variable_column_policy = policy;
127 this->_column_name_policy = policy;
142 #ifndef DOXYGEN_SHOULD_SKIP_THIS
143 char get_delim()
const {
145 if (this->possible_delimiters.size() > 1) {
146 throw std::runtime_error(
"There is more than one possible delimiter.");
149 return this->possible_delimiters.at(0);
152 CONSTEXPR bool is_quoting_enabled()
const {
return !this->no_quote; }
153 CONSTEXPR char get_quote_char()
const {
return this->quote_char; }
154 CONSTEXPR int get_header()
const {
return this->header; }
155 std::vector<char> get_possible_delims()
const {
return this->possible_delimiters; }
156 std::vector<char> get_trim_chars()
const {
return this->trim_chars; }
157 const std::vector<std::string>&
get_col_names()
const {
return this->col_names; }
160 CONSTEXPR size_t get_chunk_size()
const {
return this->_chunk_size; }
166 format.
delimiter({
',',
'|',
'\t',
';',
'^' })
176 bool guess_delim()
const {
177 return this->possible_delimiters.size() > 1;
181 friend internals::IBasicCSVParser;
185 void assert_no_char_overlap();
188 std::vector<char> possible_delimiters = {
',' };
191 std::vector<char> trim_chars = {};
197 bool header_explicitly_set_ =
false;
200 bool no_quote =
false;
203 char quote_char =
'"';
206 std::vector<std::string> col_names = {};
209 bool col_names_explicitly_set_ =
false;
218 size_t _chunk_size = internals::CSV_CHUNK_SIZE_DEFAULT;
A standalone header file containing shared code.
#define CONSTEXPR
Expands to constexpr in decent compilers and inline otherwise.
#define CSV_INLINE
Helper macro which should be #defined as "inline" in the single header version.
The all encompassing namespace.
ColumnNamePolicy
Determines how column name lookups are performed.
@ CASE_INSENSITIVE
Case-insensitive match.
@ EXACT
Case-sensitive match (default)
VariableColumnPolicy
Determines how to handle rows that are shorter or longer than the majority.
std::vector< std::string > get_col_names(csv::string_view filename, const CSVFormat &format=CSVFormat::guess_csv())
Get the column names of a CSV file using just the first 500KB.
Stores the inferred format of a CSV file.