From b913344722bbe76055d45466d334347ef3796151 Mon Sep 17 00:00:00 2001 From: ado Date: Sun, 6 Aug 2023 20:02:08 +0200 Subject: [PATCH] Update README and ssp.hpp --- README.md | 3 +++ ssp.hpp | 13 ++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 898f14b..4bfc1be 100644 --- a/README.md +++ b/README.md @@ -451,10 +451,13 @@ The **`eof`** method can be used to detect if the end of the file was reached. Detailed error messages can be accessed via the **`error_msg`** method, and to enable them **`ss::string_error`** needs to be included in the setup. If **`ss::string_error`** is not defined, the **`error_msg`** method will not be defined either. +The line number can be fetched using the **`line`** method. + ```cpp const std::string& parser::error_msg(); bool parser::valid(); bool parser::eof(); +size_t parser::line(); // ... ss::parser parser; diff --git a/ssp.hpp b/ssp.hpp index d1d0158..de0b8ba 100644 --- a/ssp.hpp +++ b/ssp.hpp @@ -2495,7 +2495,7 @@ public: reader_.next_line_converter_.set_column_mapping(column_mappings, header_.size()); - if (line() == 0) { + if (line() == 1) { ignore_next(); } } @@ -2924,12 +2924,11 @@ private: void decorate_rethrow(const ss::exception& e) const { static_assert(throw_on_error, "throw_on_error needs to be enabled to use this method"); - throw ss::exception{ - std::string{file_name_} - .append(" ") - .append(std::to_string(line())) - .append(": ") - .append(e.what())}; + throw ss::exception{std::string{file_name_} + .append(" ") + .append(std::to_string(line())) + .append(": ") + .append(e.what())}; } ////////////////