add converter tests with quote trim and escape, enable resplit on converter, make parser handle multi-line csv, add unit tests

This commit is contained in:
ado
2021-01-31 23:08:46 +01:00
parent 1bf6b9d595
commit 035e27c5ab
5 changed files with 249 additions and 37 deletions

View File

@@ -5,9 +5,6 @@
#include <string>
#include <vector>
// TODO remove
#include <iostream>
namespace ss {
template <char... Cs>
struct matcher {
@@ -99,16 +96,17 @@ private:
using escape = typename setup<Ts...>::escape;
constexpr static auto is_const_line = !quote::enabled && !escape::enabled;
public:
using line_ptr_type =
typename ternary<is_const_line, const char*, char*>::type;
public:
bool valid() const {
return (error_mode_ == error_mode::error_string) ? string_error_.empty()
: bool_error_ == false;
}
bool unterminated_quote() {
bool unterminated_quote() const {
return unterminated_quote_;
}
@@ -120,7 +118,7 @@ public:
error_mode_ = mode;
}
split_input& split(line_ptr_type new_line,
const split_input& split(line_ptr_type new_line,
const std::string& delimiter = default_delimiter) {
output_.clear();
return resplit(new_line, -1, delimiter);
@@ -133,7 +131,7 @@ public:
}
}
split_input& resplit(line_ptr_type new_line, ssize_t new_size,
const split_input& resplit(line_ptr_type new_line, ssize_t new_size,
const std::string& delimiter = default_delimiter) {
line_ = new_line;