From 1af90c083d0a98e520a6295fd18be63f35abacd6 Mon Sep 17 00:00:00 2001 From: Alan de Freitas Date: Wed, 13 May 2026 16:13:59 -0500 Subject: [PATCH 1/3] docs: declare u1 as url in set_host example fix #996 --- doc/modules/ROOT/pages/quicklook.adoc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/modules/ROOT/pages/quicklook.adoc b/doc/modules/ROOT/pages/quicklook.adoc index f26cfdb0d..484f26a23 100644 --- a/doc/modules/ROOT/pages/quicklook.adoc +++ b/doc/modules/ROOT/pages/quicklook.adoc @@ -242,6 +242,8 @@ This is also useful when manipulating URLs: [source,cpp] ---- +url u1 = parse_uri( "http://www.example.com" ).value(); +url_view u2 = parse_uri( "http://other.example.com" ).value(); u1.set_host(u2.host()); ---- From be52d5d41d2b9ce1aa0a823f8a459169aae8b513 Mon Sep 17 00:00:00 2001 From: Alan de Freitas Date: Wed, 13 May 2026 16:14:17 -0500 Subject: [PATCH 2/3] docs: fix encoded segments output block fix #997 --- doc/modules/ROOT/pages/quicklook.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/modules/ROOT/pages/quicklook.adoc b/doc/modules/ROOT/pages/quicklook.adoc index 484f26a23..b6f9ab9f8 100644 --- a/doc/modules/ROOT/pages/quicklook.adoc +++ b/doc/modules/ROOT/pages/quicklook.adoc @@ -315,7 +315,7 @@ Output:: ---- path to -my-file.txt +my%2dfile.txt ---- -- ==== From 65afa4ac94a4550af35943cb0b362739d0e59bdd Mon Sep 17 00:00:00 2001 From: Alan de Freitas Date: Wed, 13 May 2026 16:15:48 -0500 Subject: [PATCH 3/3] docs: restructure parsing intro with correct snippets fix #998 --- doc/modules/ROOT/pages/urls/parsing.adoc | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/doc/modules/ROOT/pages/urls/parsing.adoc b/doc/modules/ROOT/pages/urls/parsing.adoc index 9156db874..3c790d3f9 100644 --- a/doc/modules/ROOT/pages/urls/parsing.adoc +++ b/doc/modules/ROOT/pages/urls/parsing.adoc @@ -104,6 +104,8 @@ https://datatracker.ietf.org/doc/html/rfc3986#section-3[__URI__,window=blank_]: [source,cpp] ---- include::example$unit/snippets.cpp[tag=code_urls_parsing_1,indent=0] + +include::example$unit/snippets.cpp[tag=code_urls_parsing_2,indent=0] ---- The function returns a cpp:result[] which holds a cpp:url_view[] @@ -117,15 +119,19 @@ The caller is responsible for ensuring that the lifetime of the character buffer These are the same semantics as that of cpp:std::string_view[]. ==== -For convenience, a URL view can be constructed directly from the character buffer in a cpp:string_view[]. -In this case, it parses the string according to the -https://datatracker.ietf.org/doc/html/rfc3986#section-4.1[__URI-reference__,window=blank_] -grammar, throwing an exception upon failure. -The following two statements are equivalent: +We can immediately call cpp:result::value[] to obtain a cpp:url_view[]: [source,cpp] ---- -include::example$unit/snippets.cpp[tag=code_urls_parsing_2,indent=0] +include::example$unit/snippets.cpp[tag=snippet_parsing_3,indent=0] +---- + +Or, on a result that is known to hold a value, the shorter +cpp:result::operator*[]: + +[source,cpp] +---- +include::example$unit/snippets.cpp[tag=snippet_parsing_4,indent=0] ---- In this library, free functions which parse things are named with the word "parse" followed by the name of the grammar used to match the string.