diff --git a/include/ada/url_pattern.h b/include/ada/url_pattern.h index aa891d7f3..079c917a2 100644 --- a/include/ada/url_pattern.h +++ b/include/ada/url_pattern.h @@ -211,7 +211,7 @@ class url_pattern_component { // @see https://urlpattern.spec.whatwg.org/#compile-a-component template static tl::expected compile( - std::string_view input, F encoding_callback, + std::string_view input, F& encoding_callback, url_pattern_compile_component_options& options); // @see https://urlpattern.spec.whatwg.org/#create-a-component-match-result diff --git a/include/ada/url_pattern_helpers-inl.h b/include/ada/url_pattern_helpers-inl.h index 63d161a08..61126abe9 100644 --- a/include/ada/url_pattern_helpers-inl.h +++ b/include/ada/url_pattern_helpers-inl.h @@ -654,7 +654,7 @@ template tl::expected, url_pattern_errors> parse_pattern_string(std::string_view input, url_pattern_compile_component_options& options, - F&& encoding_callback) { + F& encoding_callback) { ada_log("parse_pattern_string input=", input); // Let parser be a new pattern parser whose encoding callback is encoding // callback and segment wildcard regexp is the result of running generate a @@ -706,7 +706,7 @@ parse_pattern_string(std::string_view input, // Run add a part given parser, prefix, name token, regexp or wildcard // token, the empty string, and modifier token. if (auto error = - parser.add_part(prefix, name_token, regexp_or_wildcard_token, {}, + parser.add_part(prefix, name_token, regexp_or_wildcard_token, "", modifier_token)) { ada_log("parser.add_part failed"); return tl::unexpected(*error); diff --git a/include/ada/url_pattern_helpers.h b/include/ada/url_pattern_helpers.h index a2f685992..4c4bdb29c 100644 --- a/include/ada/url_pattern_helpers.h +++ b/include/ada/url_pattern_helpers.h @@ -54,7 +54,7 @@ struct Token { template class url_pattern_parser { public: - url_pattern_parser(F&& encoding_callback_, + url_pattern_parser(F& encoding_callback_, std::string_view segment_wildcard_regexp_) : encoding_callback(encoding_callback_), segment_wildcard_regexp(std::string(segment_wildcard_regexp_)) {} @@ -84,7 +84,7 @@ class url_pattern_parser { bool is_duplicate_name(std::string_view name); std::vector tokens{}; - F encoding_callback; + F& encoding_callback; std::string segment_wildcard_regexp; std::vector parts{}; std::string pending_fixed_value{}; @@ -310,7 +310,7 @@ template tl::expected, url_pattern_errors> parse_pattern_string(std::string_view input, url_pattern_compile_component_options& options, - F&& encoding_callback); + F& encoding_callback); // @see https://urlpattern.spec.whatwg.org/#generate-a-pattern-string std::string generate_pattern_string( diff --git a/src/url_pattern.cpp b/src/url_pattern.cpp index 68de19967..a468cf32c 100644 --- a/src/url_pattern.cpp +++ b/src/url_pattern.cpp @@ -481,7 +481,7 @@ std::string url_pattern_init::to_string() const { template tl::expected -url_pattern_component::compile(std::string_view input, F encoding_callback, +url_pattern_component::compile(std::string_view input, F& encoding_callback, url_pattern_compile_component_options& options) { ada_log("url_pattern_component::compile input: ", input); // Let part list be the result of running parse a pattern string given input,