From 09cf3c9fa9f049918fd20a975867d5d3f963fa8f Mon Sep 17 00:00:00 2001 From: Tomasz Sowa Date: Wed, 2 Feb 2022 18:34:56 +0100 Subject: [PATCH] add some comments in AcceptBaseParser --- winixd/utils/acceptbaseparser.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/winixd/utils/acceptbaseparser.h b/winixd/utils/acceptbaseparser.h index b0d2fbf..fc61bfd 100644 --- a/winixd/utils/acceptbaseparser.h +++ b/winixd/utils/acceptbaseparser.h @@ -78,11 +78,38 @@ private: void read_loop(std::vector * header_values, size_t max_len); void read(const wchar_t * str, std::vector * header_values, size_t max_len); + /* + * called one at the beginning of parsing + */ virtual void init() {} ; + + /* + * called when a name was parsed and was not empty + * + * sample: for such string: "text/html ; q = 0.5 ; charset = UTF-8" + * parsed_name will be called with "text/html" argument + */ virtual void parsed_name(const std::wstring & name) {}; + + /* + * called when a param was parsed, param_value can be empty + * parsed_param() is called after parsed_name() + * + * sample: for such string: "text/html ; q = 0.5 ; charset = UTF-8" + * parsed_name will be called twice, first with ("q", "0.5) arguments + * and later with ("charset", "UTF-8") + */ virtual void parsed_param(const std::wstring & param, const std::wstring & param_value) {}; + + /* + * called always when a name was parsed and was not empty + * "q" parameter will be in the range [0.0 - 1.0] + * + * if there was no "q" parameter then "q" will be equal 1.0 + */ virtual void parsed_name_q(const std::wstring & name, double q) {}; + const wchar_t * text; std::wstring name; std::wstring param;