12 this->possible_delimiters = { delim };
13 this->assert_no_char_overlap();
18 this->possible_delimiters = delim;
19 this->assert_no_char_overlap();
24 this->no_quote =
false;
25 this->quote_char =
quote;
26 this->assert_no_char_overlap();
31 this->trim_chars = chars;
32 this->assert_no_char_overlap();
37 this->col_names = names;
39 this->col_names_explicitly_set_ =
true;
44 if (row < 0) this->variable_column_policy = VariableColumnPolicy::KEEP;
47 this->header_explicitly_set_ =
true;
49 this->col_names_explicitly_set_ =
false;
54 if (size < internals::CSV_CHUNK_SIZE_FLOOR) {
55 throw std::invalid_argument(internals::make_chunk_size_error(internals::CSV_CHUNK_SIZE_FLOOR, size));
57 const size_t max_chunk_size = internals::CSV_CHUNK_SIZE_MAX;
58 if (size > max_chunk_size) {
59 throw std::invalid_argument(internals::make_chunk_size_ceiling_error(max_chunk_size, size));
61 this->_chunk_size = size;
65 CSV_INLINE void CSVFormat::assert_no_char_overlap()
67 const std::set<char> delims(this->possible_delimiters.begin(), this->possible_delimiters.end());
68 const std::set<char> trims(this->trim_chars.begin(), this->trim_chars.end());
69 std::set<char> offenders;
71 for (std::set<char>::const_iterator it = delims.begin(); it != delims.end(); ++it) {
72 if (trims.find(*it) != trims.end()) {
73 offenders.insert(*it);
79 if (delims.find(this->quote_char) != delims.end() ||
80 trims.find(this->quote_char) != trims.end()) {
81 offenders.insert(this->quote_char);
84 if (!offenders.empty()) {
85 throw std::runtime_error(internals::make_char_overlap_error(offenders));
#define CSV_INLINE
Helper macro which should be #defined as "inline" in the single header version.
The all encompassing namespace.