2
0
mirror of https://github.com/boostorg/url.git synced 2026-02-13 12:52:14 +00:00

docs and tidy

This commit is contained in:
Vinnie Falco
2021-10-02 09:58:39 -07:00
parent 9bdde09fe0
commit cdbe24fc7e
39 changed files with 437 additions and 991 deletions

View File

@@ -15,9 +15,10 @@
#include <boost/url/ipv4_address.hpp>
#include <boost/url/ipv6_address.hpp>
#include <boost/url/params.hpp>
#include <boost/url/params_view.hpp>
#include <boost/url/params_encoded.hpp>
#include <boost/url/params_encoded_view.hpp>
#include <boost/url/params_value_type.hpp>
#include <boost/url/params_view.hpp>
#include <boost/url/pct_encoding.hpp>
#include <boost/url/pct_encoding_types.hpp>
#include <boost/url/scheme.hpp>

View File

@@ -12,7 +12,7 @@
#include <boost/url/error.hpp>
#include <boost/url/string.hpp>
#include <boost/url/value_types.hpp>
#include <boost/url/params_value_type.hpp>
#include <cstddef>
namespace boost {

View File

@@ -10,7 +10,7 @@
#ifndef BOOST_URL_DETAIL_IMPL_ANY_QUERY_ITER_HPP
#define BOOST_URL_DETAIL_IMPL_ANY_QUERY_ITER_HPP
#include <boost/url/value_types.hpp>
#include <boost/url/params_value_type.hpp>
namespace boost {
namespace urls {

View File

@@ -21,7 +21,8 @@ namespace urls {
and containers to indicate the type of host
present in a URL.
@see url_view::host, url_base::host
@see
@ref url_view::host.
*/
enum class host_type
{

View File

@@ -252,29 +252,16 @@ find(
//
//------------------------------------------------
params_encoded_view
result<params_encoded_view>
parse_query_params(
string_view s,
error_code& ec) noexcept
{
query_bnf t;
if(! bnf::parse_string(
s, ec, t))
return {};
return params_encoded_view(
t.str, t.count);
}
params_encoded_view
parse_query_params(
string_view s)
string_view s) noexcept
{
error_code ec;
auto qp = parse_query_params(s, ec);
if(ec.failed())
detail::throw_invalid_argument(
BOOST_CURRENT_LOCATION);
return qp;
query_bnf t;
if(! bnf::parse_string(s, ec, t))
return ec;
return params_encoded_view(
t.str, t.count);
}
} // urls

View File

@@ -226,6 +226,15 @@ segments(
{
}
bool
segments::
is_absolute() const noexcept
{
return
u_->len(id_path) != 0 &&
u_->s_[u_->offset(id_path)] == '/';
}
template<class String>
auto
segments::

View File

@@ -213,6 +213,15 @@ segments_encoded(
{
}
bool
segments_encoded::
is_absolute() const noexcept
{
return
u_->len(id_path) != 0 &&
u_->s_[u_->offset(id_path)] == '/';
}
template<class String>
auto
segments_encoded::

View File

@@ -638,21 +638,25 @@ apply(
}
}
//------------------------------------------------
//
// Parsing
//
//------------------------------------------------
url_view
result<url_view>
parse_absolute_uri(
string_view s,
error_code& ec) noexcept
string_view s) noexcept
{
if(s.size() > url_view::max_size())
detail::throw_length_error(
"url_view::max_size exceeded",
BOOST_CURRENT_LOCATION);
error_code ec;
absolute_uri_bnf t;
if(! bnf::parse_string(s, ec, t))
return {};
return ec;
url_view u(s.data());
@@ -672,43 +676,19 @@ parse_absolute_uri(
return u;
}
url_view
parse_absolute_uri(
string_view s,
std::error_code& ec) noexcept
{
error_code ec0;
auto u = parse_absolute_uri(s, ec0);
ec = ec0;
return u;
}
url_view
parse_absolute_uri(
string_view s)
{
error_code ec;
auto u = parse_absolute_uri(s, ec);
detail::maybe_throw(ec,
BOOST_CURRENT_LOCATION);
return u;
}
//------------------------------------------------
url_view
result<url_view>
parse_uri(
string_view s,
error_code& ec) noexcept
string_view s) noexcept
{
if(s.size() > url_view::max_size())
detail::throw_length_error(
"url_view::max_size exceeded",
BOOST_CURRENT_LOCATION);
error_code ec;
uri_bnf t;
if(! bnf::parse_string(s, ec, t))
return {};
return ec;
url_view u(s.data());
@@ -731,44 +711,20 @@ parse_uri(
return u;
}
url_view
parse_uri(
string_view s,
std::error_code& ec) noexcept
{
error_code ec0;
auto u = parse_uri(s, ec0);
ec = ec0;
return u;
}
url_view
parse_uri(
string_view s)
{
error_code ec;
auto u = parse_uri(s, ec);
detail::maybe_throw(ec,
BOOST_CURRENT_LOCATION);
return u;
}
//------------------------------------------------
url_view
result<url_view>
parse_relative_ref(
string_view s,
error_code& ec) noexcept
string_view s) noexcept
{
if(s.size() > url_view::max_size())
detail::throw_length_error(
"url_view::max_size exceeded",
BOOST_CURRENT_LOCATION);
error_code ec;
relative_ref_bnf t;
if(! bnf::parse_string(
s, ec, t))
return {};
return ec;
url_view u(s.data());
@@ -788,43 +744,19 @@ parse_relative_ref(
return u;
}
url_view
parse_relative_ref(
string_view s,
std::error_code& ec) noexcept
{
error_code ec0;
auto u = parse_relative_ref(s, ec0);
ec = ec0;
return u;
}
url_view
parse_relative_ref(
string_view s)
{
error_code ec;
auto u = parse_relative_ref(s, ec);
detail::maybe_throw(ec,
BOOST_CURRENT_LOCATION);
return u;
}
//------------------------------------------------
url_view
result<url_view>
parse_uri_reference(
string_view s,
error_code& ec) noexcept
string_view s) noexcept
{
if(s.size() > url_view::max_size())
detail::throw_length_error(
"url_view::max_size exceeded",
BOOST_CURRENT_LOCATION);
error_code ec;
uri_reference_bnf t;
if(! bnf::parse_string(s, ec, t))
return {};
return ec;
url_view u(s.data());
@@ -847,28 +779,6 @@ parse_uri_reference(
return u;
}
url_view
parse_uri_reference(
string_view s,
std::error_code& ec) noexcept
{
error_code ec0;
auto u = parse_uri_reference(s, ec0);
ec = ec0;
return u;
}
url_view
parse_uri_reference(
string_view s)
{
error_code ec;
auto u = parse_uri_reference(s, ec);
detail::maybe_throw(ec,
BOOST_CURRENT_LOCATION);
return u;
}
//------------------------------------------------
std::ostream&

View File

@@ -11,8 +11,8 @@
#define BOOST_URL_PARAMS_HPP
#include <boost/url/detail/config.hpp>
#include <boost/url/params_value_type.hpp>
#include <boost/url/string.hpp>
#include <boost/url/value_types.hpp>
#include <boost/url/detail/parts_base.hpp>
#include <initializer_list>
#include <iterator>
@@ -25,6 +25,8 @@ namespace urls {
class url;
#endif
/** A random access container of modifiable, percent-decoded query parameters.
*/
class params
: private detail::parts_base
{

View File

@@ -11,8 +11,8 @@
#define BOOST_URL_PARAMS_ENCODED_HPP
#include <boost/url/detail/config.hpp>
#include <boost/url/params_value_type.hpp>
#include <boost/url/string.hpp>
#include <boost/url/value_types.hpp>
#include <boost/url/detail/parts_base.hpp>
#include <initializer_list>
#include <iterator>

View File

@@ -12,8 +12,8 @@
#include <boost/url/detail/config.hpp>
#include <boost/url/string.hpp>
#include <boost/url/params_value_type.hpp>
#include <boost/url/params_view.hpp>
#include <boost/url/value_types.hpp>
#include <boost/url/detail/parts_base.hpp>
#include <iterator>
#include <type_traits>
@@ -191,18 +191,9 @@ public:
//
//--------------------------------------------
BOOST_URL_DECL
friend
params_encoded_view
parse_query_params(
string_view s,
error_code& ec) noexcept;
BOOST_URL_DECL
friend
params_encoded_view
parse_query_params(
string_view s);
BOOST_URL_DECL friend
result<params_encoded_view>
parse_query_params(string_view s) noexcept;
};
//------------------------------------------------
@@ -234,39 +225,9 @@ public:
@see @ref params_encoded_view
*/
BOOST_URL_DECL
params_encoded_view
result<params_encoded_view>
parse_query_params(
string_view s,
error_code& ec) noexcept;
/** Return a query params view from a parsed string, using query-params bnf
This function parses the string and returns the
corresponding query params object if the string
is valid, otherwise throws an exception.
The query string should not include the
leading question mark.
@par BNF
@code
query-params = [ query-param ] *( "&" [ query-param ] )
query-param = key [ "=" value ]
@endcode
@throw system_error Thrown on error
@param s The string to parse
@par Specification
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.4">
3.4. Query (rfc3986)</a>
@see @ref params_encoded_view
*/
BOOST_URL_DECL
params_encoded_view
parse_query_params(
string_view s);
string_view s) noexcept;
} // urls
} // boost

View File

@@ -7,8 +7,8 @@
// Official repository: https://github.com/CPPAlliance/url
//
#ifndef BOOST_URL_VALUE_TYPES_HPP
#define BOOST_URL_VALUE_TYPES_HPP
#ifndef BOOST_URL_PARAMS_VALUE_TYPE_HPP
#define BOOST_URL_PARAMS_VALUE_TYPE_HPP
#include <boost/url/detail/config.hpp>
#include <boost/url/string.hpp>

View File

@@ -12,9 +12,7 @@
#include <boost/url/detail/config.hpp>
#include <boost/url/string.hpp>
#include <boost/url/detail/except.hpp>
#include <boost/url/detail/parts_base.hpp>
#include <boost/assert.hpp>
#include <initializer_list>
#include <iterator>
@@ -120,6 +118,15 @@ public:
//
//--------------------------------------------
/** Returns true if this contains an absolute path.
Absolute paths always start with a
forward slash ('/').
*/
inline
bool
is_absolute() const noexcept;
/** Replace the contents of the container
This function replaces the contents
@@ -128,8 +135,8 @@ public:
Each string must contain a valid
percent-encoding or else an
exception is thrown.
The behavior is undefined any string
refers to the contents of `*this`.
The behavior is undefined if any
string refers to the contents of `*this`.
All iterators and references to elements
of the container are invalidated,
including the @ref end iterator.
@@ -339,13 +346,13 @@ public:
//
//--------------------------------------------
/** Return an iterator to the beginning
/** Return an iterator to the beginning.
*/
inline
iterator
begin() const noexcept;
/** Return an iterator to the end
/** Return an iterator to the end.
*/
inline
iterator

View File

@@ -116,6 +116,15 @@ public:
//
//--------------------------------------------
/** Returns true if this contains an absolute path.
Absolute paths always start with a
forward slash ('/').
*/
inline
bool
is_absolute() const noexcept;
/** Replace the contents of the container
This function replaces the contents

View File

@@ -29,26 +29,56 @@ class url_view;
Objects of this type represent an iterable
range of path segments, where each segment
is represented by a percent-encoded string.
Dereferenced iterators return string views
into the underlying character buffer.
Ownership of the underlying characters is
not transferred; the source of the character
buffer must remain valid until the container
is no longer used.
not transferred; the character buffer used
to construct the container must remain
valid for as long as the container exists.
A view of encoded segments in a URL's path
can be obtained by calling
@ref url_view::encoded_segments.
Alternatively, to obtain encoded segments
from a path stored in a string call one of
the parsing functions:
@ref parse_path_abempty,
@ref parse_path_absolute,
@ref parse_path_noscheme,
@ref parse_path_rootless.
the parsing functions (see below).
@par Example
A path string is parsed into encoded segments:
A path string is parsed into encoded
segments, then each segment is printed to
standard output:
@code
segments_encoded_view sev = parse_path( "/path/to/file.txt" ).value();
for( auto it = sev.begin(); it != sev.end(); ++it )
std::cout << *it << std::endl;
@endcode
A URL containing a path is parsed, then a
view to the encoded segments is obtained
and formatted to standard output:
@code
url_view u = parse_uri( "http://example.com/path/to/file.txt" ).value();
segments_encoded_view sev = u.encoded_segments();
std::cout << sev << std::endl;
@endcode
@par Complexity
Iterator increment or decrement runs in linear
time on the size of the segment.
All other operations run in constant time.
No operations allocate memory.
@see
@ref parse_path,
@ref parse_path_abempty,
@ref parse_path_absolute,
@ref parse_path_noscheme,
@@ -69,7 +99,7 @@ class segments_encoded_view
public:
#ifdef BOOST_URL_DOCS
/** An iterator to a read-only encoded path segment.
/** A bidirectional read-only iterator to an encoded path segment.
*/
using iterator = __see_below__;
#else
@@ -112,17 +142,17 @@ public:
/** Return a view of this container as percent-decoded segments
This function returns a new view over
the same underlying character buffer
where each segment is returned as a
@ref string_value with percent-decoding
applied using the optionally specified
allocator. The decoded view does not take
ownership of the underlying character
buffer; the caller is still responsible
for ensuring that the buffer remains valid
until all views which reference it are
destroyed.
This function returns a new view over the
same underlying character buffer where each
segment is returned as a @ref string_value
with percent-decoding applied using the
optionally specified allocator.
The decoded view does not take ownership of
the underlying character buffer; the caller
is still responsible for ensuring that the
buffer remains valid until all views which
reference it are destroyed.
@par Example
@code

View File

@@ -34,7 +34,7 @@ namespace urls {
owning the character buffer extends until
the string view is no longer referenced.
*/
using string_view = boost::string_view;
typedef boost::string_view string_view;
/** The string alias template return type for allocating member functions.
@@ -47,7 +47,7 @@ using string_type =
std::basic_string<char,
std::char_traits<char>, Allocator>;
/** Alias for `std::true_type` if a `T` can be converted to a @ref string_view
/** Alias for `std::true_type` if a `T` can be converted to a string_view
This metafunction is an alias for `std::true_type` if
@@ -92,7 +92,7 @@ using string_type =
The function @ref to_string_view is used to
generically convert an instance of a type
`T` to @ref string_view when such a conversion
`T` to `string_view` when such a conversion
is possible. This allows the library to
interoperate with various string-like types.

View File

@@ -60,9 +60,9 @@ struct scheme_part_bnf;
@code
url u;
u = parse_uri( "http://www.example.com/index.html" );
u = parse_uri( "http://www.example.com/index.html" ).value();
u = parse_relative_ref( "/path/to/file.txt" );
u = parse_relative_ref( "/path/to/file.txt" ).value();
@endcode
@par BNF
@@ -71,6 +71,8 @@ struct scheme_part_bnf;
URI-reference = URI / relative-ref
absolute-URI = scheme ":" hier-part [ "?" query ]
relative-ref = relative-part [ "?" query ] [ "#" fragment ]
@endcode
@@ -1721,33 +1723,14 @@ public:
//
//--------------------------------------------
BOOST_URL_DECL friend url_view parse_absolute_uri(
string_view s, error_code& ec) noexcept;
BOOST_URL_DECL friend url_view parse_absolute_uri(
string_view s, std::error_code& ec) noexcept;
BOOST_URL_DECL friend url_view parse_absolute_uri(
string_view s);
BOOST_URL_DECL friend url_view parse_uri(
string_view s, error_code& ec) noexcept;
BOOST_URL_DECL friend url_view parse_uri(
string_view s, std::error_code& ec) noexcept;
BOOST_URL_DECL friend url_view parse_uri(
string_view s);
BOOST_URL_DECL friend url_view parse_relative_ref(
string_view s, error_code& ec) noexcept;
BOOST_URL_DECL friend url_view parse_relative_ref(
string_view s, std::error_code& ec) noexcept;
BOOST_URL_DECL friend url_view parse_relative_ref(
string_view s);
BOOST_URL_DECL friend url_view parse_uri_reference(
string_view s, error_code& ec) noexcept;
BOOST_URL_DECL friend url_view parse_uri_reference(
string_view s, std::error_code& ec) noexcept;
BOOST_URL_DECL friend url_view parse_uri_reference(
string_view s);
BOOST_URL_DECL friend result<url_view>
parse_absolute_uri(string_view s) noexcept;
BOOST_URL_DECL friend result<url_view>
parse_uri(string_view s) noexcept;
BOOST_URL_DECL friend result<url_view>
parse_relative_ref(string_view s) noexcept;
BOOST_URL_DECL friend result<url_view>
parse_uri_reference(string_view s) noexcept;
private:
void apply(scheme_part_bnf const& t) noexcept;
@@ -1801,102 +1784,9 @@ private:
@ref url_view.
*/
BOOST_URL_DECL
url_view
result<url_view>
parse_absolute_uri(
string_view s,
error_code& ec) noexcept;
/** Parse an absolute-URI
This function parses a string according
to the absolute-URI grammar below, and
returns a @ref url_view referencing the string.
Ownership of the string is not transferred;
the caller is responsible for ensuring that
the lifetime of the string extends until the
view is no longer being accessed.
@par BNF
@code
absolute-URI = scheme ":" hier-part [ "?" query ]
hier-part = "//" authority path-abempty
/ path-absolute
/ path-rootless
/ path-empty
@endcode
@par Exception Safety
Throws nothing.
@return A view to the parsed URL
@param s The string to parse
@param ec Set to the error, if any occurred
@par Specification
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-4.3"
>4.3. Absolute URI (rfc3986)</a>
@see
@ref parse_absolute_uri,
@ref parse_relative_ref,
@ref parse_uri,
@ref parse_uri_reference,
@ref url_view.
*/
BOOST_URL_DECL
url_view
parse_absolute_uri(
string_view s,
std::error_code& ec) noexcept;
/** Parse an absolute-URI
This function parses a string according
to the absolute-URI grammar below, and
returns a @ref url_view referencing the string.
Ownership of the string is not transferred;
the caller is responsible for ensuring that
the lifetime of the string extends until the
view is no longer being accessed.
@par BNF
@code
absolute-URI = scheme ":" hier-part [ "?" query ]
hier-part = "//" authority path-abempty
/ path-absolute
/ path-rootless
/ path-empty
@endcode
@par Exception Safety
Exceptions thrown on invalid input.
@return A view to the parsed URL
@param s The string to parse
@throw std::invalid_argument parse error
@par Specification
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-4.3"
>4.3. Absolute URI (rfc3986)</a>
@see
@ref parse_absolute_uri,
@ref parse_relative_ref,
@ref parse_uri,
@ref parse_uri_reference,
@ref url_view.
*/
BOOST_URL_DECL
url_view
parse_absolute_uri(string_view s);
//------------------------------------------------
string_view s) noexcept;
/** Parse a URI
@@ -1939,102 +1829,9 @@ parse_absolute_uri(string_view s);
@ref url_view.
*/
BOOST_URL_DECL
url_view
result<url_view>
parse_uri(
string_view s,
error_code& ec) noexcept;
/** Parse a URI
This function parses a string according
to the URI grammar below, and returns a
@ref url_view referencing the string.
Ownership of the string is not transferred;
the caller is responsible for ensuring that
the lifetime of the string extends until the
view is no longer being accessed.
@par BNF
@code
URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
hier-part = "//" authority path-abempty
/ path-absolute
/ path-rootless
/ path-empty
@endcode
@par Exception Safety
Throws nothing.
@return A view to the parsed URL
@param s The string to parse
@param ec Set to the error, if any occurred
@par Specification
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3"
>3. Syntax Components (rfc3986)</a>
@see
@ref parse_absolute_uri,
@ref parse_relative_ref,
@ref parse_uri,
@ref parse_uri_reference,
@ref url_view.
*/
BOOST_URL_DECL
url_view
parse_uri(
string_view s,
std::error_code& ec) noexcept;
/** Parse a URI
This function parses a string according
to the URI grammar below, and returns a
@ref url_view referencing the string.
Ownership of the string is not transferred;
the caller is responsible for ensuring that
the lifetime of the string extends until the
view is no longer being accessed.
@par BNF
@code
URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
hier-part = "//" authority path-abempty
/ path-absolute
/ path-rootless
/ path-empty
@endcode
@par Exception Safety
Exceptions thrown on invalid input.
@return A view to the parsed URL
@param s The string to parse
@throw std::invalid_argument parse error
@par Specification
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3"
>3. Syntax Components (rfc3986)</a>
@see
@ref parse_absolute_uri,
@ref parse_relative_ref,
@ref parse_uri,
@ref parse_uri_reference,
@ref url_view.
*/
BOOST_URL_DECL
url_view
parse_uri(string_view s);
//------------------------------------------------
string_view s) noexcept;
/** Parse a relative-ref
@@ -2077,103 +1874,9 @@ parse_uri(string_view s);
@ref url_view.
*/
BOOST_URL_DECL
url_view
result<url_view>
parse_relative_ref(
string_view s,
error_code& ec) noexcept;
/** Parse a relative-ref
This function parses a string according
to the relative-ref grammar below, and
returns a @ref url_view referencing the string.
Ownership of the string is not transferred;
the caller is responsible for ensuring that
the lifetime of the string extends until the
view is no longer being accessed.
@par BNF
@code
relative-ref = relative-part [ "?" query ] [ "#" fragment ]
relative-part = "//" authority path-abempty
/ path-absolute
/ path-noscheme
/ path-empty
@endcode
@par Exception Safety
Throws nothing.
@return A view to the parsed URL
@param s The string to parse
@param ec Set to the error, if any occurred
@par Specification
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-4.2"
>4.2. Relative Reference (rfc3986)</a>
@see
@ref parse_absolute_uri,
@ref parse_relative_ref,
@ref parse_uri,
@ref parse_uri_reference,
@ref url_view.
*/
BOOST_URL_DECL
url_view
parse_relative_ref(
string_view s,
std::error_code& ec) noexcept;
/** Parse a relative-ref
This function parses a string according
to the relative-ref grammar below, and
returns a @ref url_view referencing the string.
Ownership of the string is not transferred;
the caller is responsible for ensuring that
the lifetime of the string extends until the
view is no longer being accessed.
@par BNF
@code
relative-ref = relative-part [ "?" query ] [ "#" fragment ]
relative-part = "//" authority path-abempty
/ path-absolute
/ path-noscheme
/ path-empty
@endcode
@par Exception Safety
Exceptions thrown on invalid input.
@return A view to the parsed URL
@param s The string to parse
@throw std::invalid_argument parse error
@par Specification
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-4.2"
>4.2. Relative Reference (rfc3986)</a>
@see
@ref parse_absolute_uri,
@ref parse_relative_ref,
@ref parse_uri,
@ref parse_uri_reference,
@ref url_view.
*/
BOOST_URL_DECL
url_view
parse_relative_ref(
string_view s);
//------------------------------------------------
string_view s) noexcept;
/** Parse a URI-reference
@@ -2225,119 +1928,9 @@ parse_relative_ref(
@ref url_view.
*/
BOOST_URL_DECL
url_view
result<url_view>
parse_uri_reference(
string_view s,
error_code& ec) noexcept;
/** Parse a URI-reference
This function parses a string according
to the URI-reference grammar below, and
returns a @ref url_view referencing the string.
Ownership of the string is not transferred;
the caller is responsible for ensuring that
the lifetime of the string extends until the
view is no longer being accessed.
@par BNF
@code
URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
hier-part = "//" authority path-abempty
/ path-absolute
/ path-rootless
/ path-empty
URI-reference = URI / relative-ref
relative-ref = relative-part [ "?" query ] [ "#" fragment ]
relative-part = "//" authority path-abempty
/ path-absolute
/ path-noscheme
/ path-empty
@endcode
@par Exception Safety
Throws nothing.
@return A view to the parsed URL
@param s The string to parse
@param ec Set to the error, if any occurred
@par Specification
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-4.1"
>4.1. URI Reference (rfc3986)</a>
@see
@ref parse_absolute_uri,
@ref parse_relative_ref,
@ref parse_uri,
@ref parse_uri_reference,
@ref url_view.
*/
BOOST_URL_DECL
url_view
parse_uri_reference(
string_view s,
std::error_code& ec) noexcept;
/** Parse a URI-reference
This function parses a string according
to the URI-reference grammar below, and
returns a @ref url_view referencing the string.
Ownership of the string is not transferred;
the caller is responsible for ensuring that
the lifetime of the string extends until the
view is no longer being accessed.
@par BNF
@code
URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
hier-part = "//" authority path-abempty
/ path-absolute
/ path-rootless
/ path-empty
URI-reference = URI / relative-ref
relative-ref = relative-part [ "?" query ] [ "#" fragment ]
relative-part = "//" authority path-abempty
/ path-absolute
/ path-noscheme
/ path-empty
@endcode
@par Exception Safety
Exceptions thrown on invalid input.
@return A view to the parsed URL
@param s The string to parse
@throw std::invalid_argument parse error
@par Specification
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-4.1"
>4.1. URI Reference (rfc3986)</a>
@see
@ref parse_absolute_uri,
@ref parse_relative_ref,
@ref parse_uri,
@ref parse_uri_reference,
@ref url_view.
*/
BOOST_URL_DECL
url_view
parse_uri_reference(
string_view s);
string_view s) noexcept;
//------------------------------------------------

View File

@@ -16,8 +16,8 @@
namespace boost {
using url = urls::url;
using url_view = urls::url_view;
using urls::url;
using urls::url_view;
} // boost