update documentation

This commit is contained in:
ado
2022-03-28 19:11:41 +02:00
parent 8fb3f68be3
commit 2c1fe9be9f
4 changed files with 216 additions and 30 deletions

View File

@@ -27,6 +27,8 @@ class parser {
constexpr static bool ignore_header = setup<Matchers...>::ignore_header;
constexpr static bool ignore_empty = setup<Matchers...>::ignore_empty;
public:
parser(const std::string& file_name,
const std::string& delim = ss::default_delimiter)
@@ -558,16 +560,27 @@ private:
reader& operator=(const reader& other) = delete;
bool read_next() {
++line_number_;
memset(next_line_buffer_, '\0', next_line_size_);
ssize_t ssize =
get_line(&next_line_buffer_, &next_line_size_, file_);
if (ssize == -1) {
return false;
ssize_t ssize;
size_t size = 0;
while (size == 0) {
++line_number_;
if (next_line_size_ > 0) {
next_line_buffer_[0] = '\0';
}
ssize = get_line(&next_line_buffer_, &next_line_size_, file_);
if (ssize == -1) {
return false;
}
size = remove_eol(next_line_buffer_, ssize);
if constexpr (!ignore_empty) {
break;
}
}
size_t size = remove_eol(next_line_buffer_, ssize);
size_t limit = 0;
if constexpr (escaped_multiline_enabled) {

View File

@@ -173,6 +173,12 @@ class string_error;
class ignore_header;
////////////////
// ignore_empty
////////////////
class ignore_empty;
////////////////
// setup implementation
////////////////
@@ -194,16 +200,24 @@ private:
template <typename T>
struct is_ignore_header : std::is_same<T, ignore_header> {};
template <typename T>
struct is_ignore_empty : std::is_same<T, ignore_empty> {};
constexpr static auto count_matcher = count_v<is_matcher, Ts...>;
constexpr static auto count_multiline =
count_v<is_instance_of_multiline, Ts...>;
constexpr static auto count_string_error = count_v<is_string_error, Ts...>;
constexpr static auto count_ignore_header =
count_v<is_ignore_header, Ts...>;
constexpr static auto count_ignore_empty = count_v<is_ignore_empty, Ts...>;
constexpr static auto number_of_valid_setup_types =
count_matcher + count_multiline + count_string_error +
count_ignore_header;
count_ignore_header + count_ignore_empty;
using trim_left_only = get_matcher_t<trim_left, Ts...>;
using trim_right_only = get_matcher_t<trim_right, Ts...>;
@@ -219,6 +233,7 @@ public:
using multiline = get_multiline_t<Ts...>;
constexpr static bool string_error = (count_string_error == 1);
constexpr static bool ignore_header = (count_ignore_header == 1);
constexpr static bool ignore_empty = (count_ignore_empty == 1);
private:
#define ASSERT_MSG "cannot have the same match character in multiple matchers"