From 6832bd57d3189ecadc490ccfd14e61e000ad79df Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Sun, 16 Oct 2016 18:52:32 -0400 Subject: [PATCH] Add basic_parser_v1::reset --- CHANGELOG.md | 1 + include/beast/http/basic_parser_v1.hpp | 17 +++++++++-------- include/beast/http/impl/basic_parser_v1.ipp | 10 ++++++++++ 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index afd31bd0..c0524ebf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ * Add is_Reader trait * Tidy up basic_headers for documentation * Tidy up documentation +* Add basic_parser_v1::reset API Changes: diff --git a/include/beast/http/basic_parser_v1.hpp b/include/beast/http/basic_parser_v1.hpp index 2174f34b..0b056d7d 100644 --- a/include/beast/http/basic_parser_v1.hpp +++ b/include/beast/http/basic_parser_v1.hpp @@ -467,6 +467,15 @@ public: void write_eof(error_code& ec); +protected: + /** Reset the parsing state. + + The state of the parser is reset to expect the beginning of + a new request or response. The old state is discarded. + */ + void + reset(); + private: Derived& impl() @@ -486,14 +495,6 @@ private: s_ = s_res_start; } - void - reset() - { - h_left_ = h_max_; - b_left_ = b_max_; - reset(std::integral_constant{}); - } - void init(std::true_type) { diff --git a/include/beast/http/impl/basic_parser_v1.ipp b/include/beast/http/impl/basic_parser_v1.ipp index c2c98e8f..4793fe75 100644 --- a/include/beast/http/impl/basic_parser_v1.ipp +++ b/include/beast/http/impl/basic_parser_v1.ipp @@ -1175,6 +1175,16 @@ write_eof(error_code& ec) } } +template +void +basic_parser_v1:: +reset() +{ + h_left_ = h_max_; + b_left_ = b_max_; + reset(std::integral_constant{}); +} + template bool basic_parser_v1::