mirror of
https://github.com/boostorg/url.git
synced 2026-01-19 04:42:15 +00:00
committed by
Alan de Freitas
parent
ed7b7c6048
commit
96438f683e
@@ -35,6 +35,7 @@ docca.reference reference.qbk
|
||||
\"BOOST_CONSTEXPR=constexpr\" \\
|
||||
\"BOOST_CXX14_CONSTEXPR=constexpr\" \\
|
||||
\"BOOST_STATIC_ASSERT(x)=\" \\
|
||||
\"BOOST_URL_DEPRECATED(x)=\" \\
|
||||
\"BOOST_URL_STRTOK_TPARAM=class StringToken = string_token::return_string\" \\
|
||||
\"BOOST_URL_STRTOK_RETURN=typename StringToken::result_type\" \\
|
||||
\"BOOST_URL_STRTOK_ARG(name)=StringToken&& name = {}\" \\
|
||||
|
||||
@@ -115,17 +115,17 @@
|
||||
|
||||
<bridgehead renderas="sect3">Types</bridgehead>
|
||||
<simplelist type="vert" columns="1">
|
||||
<member><link linkend="url.ref.boost__urls__errc">errc</link></member>
|
||||
<member><link linkend="url.ref.boost__urls__error_category">error_category</link></member>
|
||||
<member><link linkend="url.ref.boost__urls__error_code">error_code</link></member>
|
||||
<member><link linkend="url.ref.boost__urls__error_condition">error_condition</link></member>
|
||||
<member><link linkend="url.ref.boost__urls__generic_category">generic_category</link></member>
|
||||
<member><link linkend="url.ref.boost__urls__optional">optional</link></member>
|
||||
<member><link linkend="url.ref.boost__urls__result">result</link></member>
|
||||
<member><link linkend="url.ref.boost__urls__string_view">string_view</link></member>
|
||||
<member><link linkend="url.ref.boost__urls__system_category">system_category</link></member>
|
||||
<member><link linkend="url.ref.boost__urls__system_error">system_error</link></member>
|
||||
<member><link linkend="url.ref.boost__urls__variant">variant</link></member>
|
||||
<member><link linkend="url.ref.boost__urls__errc"><emphasis role="red">errc</emphasis></link></member>
|
||||
<member><link linkend="url.ref.boost__urls__error_category"><emphasis role="red">error_category</emphasis></link></member>
|
||||
<member><link linkend="url.ref.boost__urls__error_code"><emphasis role="red">error_code</emphasis></link></member>
|
||||
<member><link linkend="url.ref.boost__urls__error_condition"><emphasis role="red">error_condition</emphasis></link></member>
|
||||
<member><link linkend="url.ref.boost__urls__generic_category"><emphasis role="red">generic_category</emphasis></link></member>
|
||||
<member><link linkend="url.ref.boost__urls__optional"><emphasis role="red">optional</emphasis></link></member>
|
||||
<member><link linkend="url.ref.boost__urls__result"><emphasis role="red">result</emphasis></link></member>
|
||||
<member><link linkend="url.ref.boost__urls__string_view"><emphasis role="red">string_view</emphasis></link></member>
|
||||
<member><link linkend="url.ref.boost__urls__system_category"><emphasis role="red">system_category</emphasis></link></member>
|
||||
<member><link linkend="url.ref.boost__urls__system_error"><emphasis role="red">system_error</emphasis></link></member>
|
||||
<member><link linkend="url.ref.boost__urls__variant"><emphasis role="red">variant</emphasis></link></member>
|
||||
</simplelist>
|
||||
|
||||
</entry>
|
||||
|
||||
@@ -33,7 +33,8 @@
|
||||
|
||||
namespace urls = boost::urls;
|
||||
namespace fs = boost::filesystem;
|
||||
using string_view = urls::string_view;
|
||||
namespace core = boost::core;
|
||||
using string_view = boost::core::string_view;
|
||||
|
||||
/** Check if a target matches a prefix
|
||||
|
||||
@@ -82,7 +83,7 @@ class route
|
||||
{
|
||||
public:
|
||||
/// Constructor
|
||||
route(string_view prefix, fs::path root)
|
||||
route(core::string_view prefix, fs::path root)
|
||||
: prefix_(urls::parse_uri_reference(prefix).value())
|
||||
, root_(std::move(root))
|
||||
{}
|
||||
|
||||
@@ -18,13 +18,16 @@
|
||||
|
||||
#include <boost/url/url.hpp>
|
||||
#include <boost/url/parse.hpp>
|
||||
#include <boost/system/result.hpp>
|
||||
#include <boost/json/stream_parser.hpp>
|
||||
#include <boost/core/detail/string_view.hpp>
|
||||
#include <boost/regex.hpp>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
namespace urls = boost::urls;
|
||||
namespace json = boost::json;
|
||||
namespace core = boost::core;
|
||||
|
||||
json::value
|
||||
read_json( std::istream& is, json::error_code& ec )
|
||||
@@ -47,8 +50,8 @@ read_json( std::istream& is, json::error_code& ec )
|
||||
|
||||
bool
|
||||
glob_match(
|
||||
urls::string_view pattern,
|
||||
urls::string_view str)
|
||||
core::string_view pattern,
|
||||
core::string_view str)
|
||||
{
|
||||
// regex
|
||||
if (str.starts_with("/") &&
|
||||
@@ -112,7 +115,7 @@ url_match(
|
||||
else if (mv.is_object())
|
||||
{
|
||||
json::object& m = mv.as_object();
|
||||
std::pair<urls::string_view, urls::string_view>
|
||||
std::pair<core::string_view, core::string_view>
|
||||
field_values[] = {
|
||||
{"protocol", u.scheme()},
|
||||
{"authority", u.encoded_authority()},
|
||||
@@ -166,7 +169,7 @@ int main(int argc, char** argv)
|
||||
}
|
||||
|
||||
// Parse url
|
||||
urls::result<urls::url> ru = urls::parse_uri(argv[2]);
|
||||
boost::system::result<urls::url> ru = urls::parse_uri(argv[2]);
|
||||
CHECK(ru, "Invalid URL");
|
||||
urls::url u = *ru;
|
||||
|
||||
|
||||
@@ -21,10 +21,12 @@
|
||||
#include <boost/url/rfc/absolute_uri_rule.hpp>
|
||||
#include <boost/url/grammar/digit_chars.hpp>
|
||||
#include <boost/url/grammar/parse.hpp>
|
||||
#include <boost/core/detail/string_view.hpp>
|
||||
#include "filter_view.hpp"
|
||||
#include <iostream>
|
||||
|
||||
namespace urls = boost::urls;
|
||||
namespace core = boost::core;
|
||||
|
||||
/** Callable to identify a magnet "exact topic"
|
||||
|
||||
@@ -54,10 +56,10 @@ struct is_exact_topic
|
||||
*/
|
||||
class is_url_with_key
|
||||
{
|
||||
urls::string_view k_;
|
||||
core::string_view k_;
|
||||
public:
|
||||
is_url_with_key(
|
||||
urls::string_view key)
|
||||
core::string_view key)
|
||||
: k_(key) {}
|
||||
|
||||
bool
|
||||
@@ -98,7 +100,7 @@ struct to_decoded_value
|
||||
/** Callable to convert param values to info_hashes
|
||||
|
||||
This callable converts the value of a
|
||||
query parameter into a urls::string_view with
|
||||
query parameter into a core::string_view with
|
||||
its infohash.
|
||||
|
||||
The infohash hash is a parameter of an
|
||||
@@ -109,14 +111,14 @@ struct to_decoded_value
|
||||
*/
|
||||
struct param_view_to_infohash
|
||||
{
|
||||
urls::string_view
|
||||
core::string_view
|
||||
operator()(urls::param_view p);
|
||||
};
|
||||
|
||||
/** Callable to convert param values to protocols
|
||||
|
||||
This callable converts the value of a
|
||||
query parameter into a urls::string_view with
|
||||
query parameter into a core::string_view with
|
||||
its protocol.
|
||||
|
||||
The protocol is a parameter of an exact
|
||||
@@ -127,7 +129,7 @@ struct param_view_to_infohash
|
||||
*/
|
||||
struct to_protocol
|
||||
{
|
||||
urls::string_view
|
||||
core::string_view
|
||||
operator()(urls::param_view p);
|
||||
};
|
||||
|
||||
@@ -336,7 +338,7 @@ public:
|
||||
@return Web seed
|
||||
*/
|
||||
boost::optional<urls::pct_string_view>
|
||||
param(urls::string_view key) const noexcept;
|
||||
param(core::string_view key) const noexcept;
|
||||
|
||||
friend
|
||||
std::ostream&
|
||||
@@ -348,11 +350,11 @@ public:
|
||||
private:
|
||||
// get a query parameter as a urls::pct_string_view
|
||||
boost::optional<urls::pct_string_view>
|
||||
encoded_param(urls::string_view key) const noexcept;
|
||||
encoded_param(core::string_view key) const noexcept;
|
||||
|
||||
// get a query parameter as a urls::url_view
|
||||
boost::optional<urls::url_view>
|
||||
url_param(urls::string_view key) const noexcept;
|
||||
url_param(core::string_view key) const noexcept;
|
||||
|
||||
friend magnet_link_rule_t;
|
||||
};
|
||||
@@ -384,12 +386,12 @@ operator()(urls::param_view p)
|
||||
{
|
||||
if (p.key != k_)
|
||||
return false;
|
||||
urls::error_code ec;
|
||||
boost::system::error_code ec;
|
||||
std::string buf(
|
||||
p.value.begin(), p.value.end());
|
||||
if (ec.failed())
|
||||
return false;
|
||||
urls::result<urls::url_view> r =
|
||||
boost::system::result<urls::url_view> r =
|
||||
urls::parse_uri(buf);
|
||||
return r.has_value();
|
||||
}
|
||||
@@ -410,26 +412,26 @@ operator()(urls::param_view p)
|
||||
return u;
|
||||
}
|
||||
|
||||
urls::string_view
|
||||
core::string_view
|
||||
param_view_to_infohash::
|
||||
operator()(urls::param_view p)
|
||||
{
|
||||
urls::url_view topic =
|
||||
urls::parse_uri(p.value).value();
|
||||
urls::string_view t = topic.encoded_path();
|
||||
core::string_view t = topic.encoded_path();
|
||||
std::size_t pos = t.find_last_of(':');
|
||||
if (pos != urls::string_view::npos)
|
||||
if (pos != core::string_view::npos)
|
||||
return t.substr(pos + 1);
|
||||
return t;
|
||||
}
|
||||
|
||||
urls::string_view
|
||||
core::string_view
|
||||
to_protocol::
|
||||
operator()(urls::param_view p)
|
||||
{
|
||||
urls::url_view topic =
|
||||
urls::parse_uri(p.value).value();
|
||||
urls::string_view t = topic.encoded_path();
|
||||
core::string_view t = topic.encoded_path();
|
||||
std::size_t pos = t.find_last_of(':');
|
||||
return t.substr(0, pos);
|
||||
}
|
||||
@@ -485,7 +487,7 @@ magnet_link_view::acceptable_sources() const
|
||||
boost::optional<std::string>
|
||||
magnet_link_view::keyword_topic() const noexcept
|
||||
{
|
||||
urls::optional<urls::pct_string_view> o =
|
||||
boost::optional<urls::pct_string_view> o =
|
||||
encoded_param("kt");
|
||||
if (o)
|
||||
return o->decode();
|
||||
@@ -517,7 +519,7 @@ magnet_link_view::web_seed() const
|
||||
}
|
||||
|
||||
boost::optional<urls::pct_string_view>
|
||||
magnet_link_view::param(urls::string_view key) const noexcept
|
||||
magnet_link_view::param(core::string_view key) const noexcept
|
||||
{
|
||||
urls::params_view ps = u_.params();
|
||||
auto it = ps.begin();
|
||||
@@ -534,9 +536,9 @@ magnet_link_view::param(urls::string_view key) const noexcept
|
||||
auto mid = std::next(p.key.begin(), 2);
|
||||
auto last = p.key.end();
|
||||
urls::pct_string_view prefix(
|
||||
urls::string_view(first, mid));
|
||||
core::string_view(first, mid));
|
||||
urls::pct_string_view suffix(
|
||||
urls::string_view(mid, last));
|
||||
core::string_view(mid, last));
|
||||
if (prefix == "x." &&
|
||||
suffix == key &&
|
||||
p.has_value)
|
||||
@@ -547,7 +549,7 @@ magnet_link_view::param(urls::string_view key) const noexcept
|
||||
}
|
||||
|
||||
boost::optional<urls::pct_string_view>
|
||||
magnet_link_view::encoded_param(urls::string_view key) const noexcept
|
||||
magnet_link_view::encoded_param(core::string_view key) const noexcept
|
||||
{
|
||||
urls::params_encoded_view ps = u_.encoded_params();
|
||||
auto it = ps.find(key);
|
||||
@@ -557,13 +559,13 @@ magnet_link_view::encoded_param(urls::string_view key) const noexcept
|
||||
}
|
||||
|
||||
boost::optional<urls::url_view>
|
||||
magnet_link_view::url_param(urls::string_view key) const noexcept
|
||||
magnet_link_view::url_param(core::string_view key) const noexcept
|
||||
{
|
||||
urls::params_encoded_view ps = u_.encoded_params();
|
||||
auto it = ps.find(key);
|
||||
if (it != ps.end() && (*it).has_value)
|
||||
{
|
||||
urls::result<urls::url_view> r =
|
||||
boost::system::result<urls::url_view> r =
|
||||
urls::parse_uri((*it).value);
|
||||
if (r)
|
||||
return *r;
|
||||
@@ -579,7 +581,7 @@ struct magnet_link_rule_t
|
||||
using value_type = magnet_link_view;
|
||||
|
||||
/// Parse a sequence of characters into a magnet_link_view
|
||||
urls::result< value_type >
|
||||
boost::system::result< value_type >
|
||||
parse( char const*& it, char const* end ) const noexcept;
|
||||
};
|
||||
|
||||
@@ -587,10 +589,10 @@ auto
|
||||
magnet_link_rule_t::parse(
|
||||
char const*& it,
|
||||
char const* end ) const noexcept
|
||||
-> urls::result< value_type >
|
||||
-> boost::system::result< value_type >
|
||||
{
|
||||
// 1) Parse url with the general uri syntax
|
||||
urls::result<urls::url_view> r =
|
||||
boost::system::result<urls::url_view> r =
|
||||
urls::grammar::parse(it, end, urls::absolute_uri_rule);
|
||||
if(!r)
|
||||
return urls::grammar::error::invalid;
|
||||
@@ -616,7 +618,7 @@ magnet_link_rule_t::parse(
|
||||
{
|
||||
if (!is_exact_topic{}(p))
|
||||
return true;
|
||||
urls::result<urls::url_view> u =
|
||||
boost::system::result<urls::url_view> u =
|
||||
urls::parse_uri(p.value);
|
||||
return u.has_value();
|
||||
}))
|
||||
@@ -634,8 +636,8 @@ constexpr magnet_link_rule_t magnet_link_rule{};
|
||||
This is a more convenient user-facing function
|
||||
to parse magnet links.
|
||||
*/
|
||||
urls::result< magnet_link_view >
|
||||
parse_magnet_link( urls::string_view s ) noexcept
|
||||
boost::system::result< magnet_link_view >
|
||||
parse_magnet_link( core::string_view s ) noexcept
|
||||
{
|
||||
return urls::grammar::parse(s, magnet_link_rule);
|
||||
}
|
||||
@@ -658,7 +660,7 @@ int main(int argc, char** argv)
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
urls::result<magnet_link_view> r =
|
||||
boost::system::result<magnet_link_view> r =
|
||||
parse_magnet_link(argv[1]);
|
||||
if (!r)
|
||||
return EXIT_FAILURE;
|
||||
|
||||
@@ -135,12 +135,12 @@ private:
|
||||
// Count number of addresses in a string
|
||||
static
|
||||
std::size_t
|
||||
addr_in_str(urls::string_view s);
|
||||
addr_in_str(boost::core::string_view s);
|
||||
|
||||
// Get the ith address from a string
|
||||
static
|
||||
urls::optional<urls::pct_string_view>
|
||||
get_nth_address(urls::string_view to, std::size_t &i) noexcept;
|
||||
boost::optional<urls::pct_string_view>
|
||||
get_nth_address(boost::core::string_view to, std::size_t &i) noexcept;
|
||||
|
||||
// Get param value or empty otherwise
|
||||
urls::pct_string_view
|
||||
@@ -157,7 +157,7 @@ struct mailto_rule_t
|
||||
using value_type = mailto_view;
|
||||
|
||||
/// Parse a sequence of characters into a mailto_view
|
||||
urls::result< value_type >
|
||||
boost::system::result< value_type >
|
||||
parse( char const*& it, char const* end ) const noexcept;
|
||||
};
|
||||
|
||||
@@ -168,8 +168,8 @@ constexpr mailto_rule_t mailto_rule{};
|
||||
This is a more convenient user-facing function
|
||||
to parse mailto URLs.
|
||||
*/
|
||||
urls::result< mailto_view >
|
||||
parse_mailto( urls::string_view s ) noexcept
|
||||
boost::system::result< mailto_view >
|
||||
parse_mailto( boost::core::string_view s ) noexcept
|
||||
{
|
||||
return urls::grammar::parse(s, mailto_rule);
|
||||
}
|
||||
@@ -196,7 +196,7 @@ int main(int argc, char** argv)
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
urls::result<mailto_view> r =
|
||||
boost::system::result<mailto_view> r =
|
||||
parse_mailto(argv[1]);
|
||||
if (!r)
|
||||
return EXIT_FAILURE;
|
||||
@@ -326,7 +326,7 @@ mailto_view::encoded_body() const noexcept
|
||||
}
|
||||
|
||||
std::size_t
|
||||
mailto_view::addr_in_str(urls::string_view s)
|
||||
mailto_view::addr_in_str(boost::core::string_view s)
|
||||
{
|
||||
std::size_t n = 0;
|
||||
bool empty = true;
|
||||
@@ -346,11 +346,11 @@ mailto_view::addr_in_str(urls::string_view s)
|
||||
return n;
|
||||
}
|
||||
|
||||
urls::optional<urls::pct_string_view>
|
||||
mailto_view::get_nth_address(urls::string_view to, std::size_t &i) noexcept
|
||||
boost::optional<urls::pct_string_view>
|
||||
mailto_view::get_nth_address(boost::core::string_view to, std::size_t &i) noexcept
|
||||
{
|
||||
auto p = to.find(',');
|
||||
while (p != urls::string_view::npos)
|
||||
while (p != boost::core::string_view::npos)
|
||||
{
|
||||
if (i == 0)
|
||||
return urls::pct_string_view(
|
||||
@@ -381,10 +381,10 @@ mailto_view::param_or_empty(urls::pct_string_view k) const noexcept
|
||||
|
||||
auto
|
||||
mailto_rule_t::parse( char const*& it, char const* end ) const noexcept
|
||||
-> urls::result< value_type >
|
||||
-> boost::system::result< value_type >
|
||||
{
|
||||
// Syntax-based rules
|
||||
urls::result<urls::url_view> r =
|
||||
boost::system::result<urls::url_view> r =
|
||||
urls::grammar::parse(it, end, urls::absolute_uri_rule);
|
||||
if (!r)
|
||||
return r.error();
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <boost/url/grammar/vchars.hpp>
|
||||
#include <boost/url/rfc/pct_encoded_rule.hpp>
|
||||
#include <boost/url/rfc/unreserved_chars.hpp>
|
||||
#include <boost/core/detail/string_view.hpp>
|
||||
#include <algorithm>
|
||||
|
||||
namespace urls = boost::urls;
|
||||
@@ -208,9 +209,9 @@ namespace detail
|
||||
struct ccontent_and_comment_rules {
|
||||
struct ccontent_rule_t
|
||||
{
|
||||
using value_type = urls::string_view;
|
||||
using value_type = boost::core::string_view;
|
||||
|
||||
urls::result< value_type >
|
||||
boost::system::result< value_type >
|
||||
parse(
|
||||
char const*& it,
|
||||
char const* end
|
||||
@@ -220,7 +221,7 @@ namespace detail
|
||||
bool v = ccontent_and_comment_rules::
|
||||
parse_ccontent(it, end);
|
||||
if (v)
|
||||
return urls::string_view(it0, it);
|
||||
return boost::core::string_view(it0, it);
|
||||
return grammar::error::invalid;
|
||||
}
|
||||
};
|
||||
@@ -241,9 +242,9 @@ namespace detail
|
||||
|
||||
struct comment_rule_t
|
||||
{
|
||||
using value_type = urls::string_view;
|
||||
using value_type = boost::core::string_view;
|
||||
|
||||
urls::result< value_type >
|
||||
boost::system::result< value_type >
|
||||
parse(
|
||||
char const*& it,
|
||||
char const* end
|
||||
@@ -253,7 +254,7 @@ namespace detail
|
||||
bool v = ccontent_and_comment_rules::
|
||||
parse_comment(it, end);
|
||||
if (v)
|
||||
return urls::string_view(it0, it);
|
||||
return boost::core::string_view(it0, it);
|
||||
return grammar::error::invalid;
|
||||
}
|
||||
};
|
||||
@@ -344,15 +345,15 @@ constexpr auto hfvalue_rule = urls::pct_encoded_rule(qchars);
|
||||
/// Rule for hfname = *qchar
|
||||
struct hfname_rule_t
|
||||
{
|
||||
using value_type = urls::string_view;
|
||||
using value_type = boost::core::string_view;
|
||||
|
||||
urls::result<value_type>
|
||||
boost::system::result<value_type>
|
||||
parse(
|
||||
char const*& it,
|
||||
char const* end
|
||||
) const noexcept
|
||||
{
|
||||
urls::string_view s(it, end);
|
||||
boost::core::string_view s(it, end);
|
||||
it += s.size();
|
||||
auto r = grammar::parse(s, hfvalue_rule);
|
||||
if (!r)
|
||||
@@ -360,13 +361,13 @@ struct hfname_rule_t
|
||||
|
||||
// The user agent interpreting a 'mailto' URI SHOULD NOT create a
|
||||
// message if any of the header fields are considered dangerous
|
||||
static const urls::string_view valid_k[] = {
|
||||
static const boost::core::string_view valid_k[] = {
|
||||
"to", "subject", "keywords",
|
||||
"cc", "body", "in-reply-to"
|
||||
};
|
||||
if (std::any_of(
|
||||
std::begin(valid_k), std::end(valid_k),
|
||||
[s](urls::string_view valid_k)
|
||||
[s](boost::core::string_view valid_k)
|
||||
{
|
||||
return grammar::ci_is_equal(s, valid_k);
|
||||
}))
|
||||
|
||||
@@ -15,10 +15,12 @@
|
||||
*/
|
||||
|
||||
#include <boost/url/url.hpp>
|
||||
#include <boost/core/detail/string_view.hpp>
|
||||
#include <boost/url/parse.hpp>
|
||||
#include <iostream>
|
||||
|
||||
namespace urls = boost::urls;
|
||||
namespace core = boost::core;
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
@@ -53,9 +55,9 @@ int main(int argc, char** argv)
|
||||
// Encoding
|
||||
if (argc >= 5)
|
||||
{
|
||||
urls::string_view output_encoding =
|
||||
urls::string_view(argv[3]) == "Shift_JIS" ||
|
||||
urls::string_view(argv[3]) == "ISO-8859-1" ?
|
||||
core::string_view output_encoding =
|
||||
core::string_view(argv[3]) == "Shift_JIS" ||
|
||||
core::string_view(argv[3]) == "ISO-8859-1" ?
|
||||
argv[4] : "UTF-8";
|
||||
ps.append({"choe", output_encoding});
|
||||
}
|
||||
|
||||
@@ -51,14 +51,14 @@ public:
|
||||
bool
|
||||
match(pct_string_view seg) const;
|
||||
|
||||
string_view
|
||||
core::string_view
|
||||
string() const
|
||||
{
|
||||
return str_;
|
||||
}
|
||||
|
||||
BOOST_URL_DECL
|
||||
string_view
|
||||
core::string_view
|
||||
id() const;
|
||||
|
||||
bool
|
||||
@@ -141,7 +141,7 @@ struct segment_template_rule_t
|
||||
using value_type = segment_template;
|
||||
|
||||
BOOST_URL_DECL
|
||||
urls::result<value_type>
|
||||
system::result<value_type>
|
||||
parse(
|
||||
char const*& it,
|
||||
char const* end
|
||||
@@ -172,13 +172,13 @@ match(pct_string_view seg) const
|
||||
return true;
|
||||
}
|
||||
|
||||
string_view
|
||||
core::string_view
|
||||
segment_template::
|
||||
id() const
|
||||
{
|
||||
// if (is_literal_) return {};
|
||||
BOOST_ASSERT(!is_literal());
|
||||
string_view r = {str_};
|
||||
core::string_view r = {str_};
|
||||
r.remove_prefix(1);
|
||||
r.remove_suffix(1);
|
||||
if (r.ends_with('?') ||
|
||||
@@ -193,7 +193,7 @@ segment_template_rule_t::
|
||||
parse(
|
||||
char const*& it,
|
||||
char const* end) const noexcept
|
||||
-> urls::result<value_type>
|
||||
-> system::result<value_type>
|
||||
{
|
||||
segment_template t;
|
||||
if (it != end &&
|
||||
@@ -207,7 +207,7 @@ parse(
|
||||
it, end, grammar::lut_chars('}'));
|
||||
if (send != end)
|
||||
{
|
||||
string_view s(it, send);
|
||||
core::string_view s(it, send);
|
||||
static constexpr auto modifiers_cs =
|
||||
grammar::lut_chars("?*+");
|
||||
static constexpr auto id_rule =
|
||||
@@ -221,7 +221,7 @@ parse(
|
||||
{
|
||||
it = send + 1;
|
||||
|
||||
t.str_ = string_view(it0, send + 1);
|
||||
t.str_ = core::string_view(it0, send + 1);
|
||||
t.is_literal_ = false;
|
||||
if (s.ends_with('?'))
|
||||
t.modifier_ =
|
||||
@@ -404,15 +404,15 @@ public:
|
||||
// include a node for a resource
|
||||
void
|
||||
insert_impl(
|
||||
string_view path,
|
||||
core::string_view path,
|
||||
router_base::any_resource const* v);
|
||||
|
||||
// match a node and return the element
|
||||
router_base::any_resource const*
|
||||
find_impl(
|
||||
segments_encoded_view path,
|
||||
string_view*& matches,
|
||||
string_view*& ids) const;
|
||||
core::string_view*& matches,
|
||||
core::string_view*& ids) const;
|
||||
|
||||
private:
|
||||
// try to match from this root node
|
||||
@@ -422,8 +422,8 @@ private:
|
||||
segments_encoded_view::const_iterator end,
|
||||
node const* root,
|
||||
int level,
|
||||
string_view*& matches,
|
||||
string_view*& ids) const;
|
||||
core::string_view*& matches,
|
||||
core::string_view*& ids) const;
|
||||
|
||||
// check if a node has a resource when we
|
||||
// also consider optional paths through
|
||||
@@ -433,8 +433,8 @@ private:
|
||||
find_optional_resource(
|
||||
const node* root,
|
||||
std::vector<node> const& ns,
|
||||
string_view*& matches,
|
||||
string_view*& ids);
|
||||
core::string_view*& matches,
|
||||
core::string_view*& ids);
|
||||
};
|
||||
|
||||
node const*
|
||||
@@ -442,8 +442,8 @@ impl::
|
||||
find_optional_resource(
|
||||
const node* root,
|
||||
std::vector<node> const& ns,
|
||||
string_view*& matches,
|
||||
string_view*& ids)
|
||||
core::string_view*& matches,
|
||||
core::string_view*& ids)
|
||||
{
|
||||
BOOST_ASSERT(root);
|
||||
if (root->resource)
|
||||
@@ -474,7 +474,7 @@ find_optional_resource(
|
||||
void
|
||||
impl::
|
||||
insert_impl(
|
||||
string_view path,
|
||||
core::string_view path,
|
||||
router_base::any_resource const* v)
|
||||
{
|
||||
// Parse dynamic route segments
|
||||
@@ -496,7 +496,7 @@ insert_impl(
|
||||
int level = 0;
|
||||
while (it != end)
|
||||
{
|
||||
string_view seg = (*it).string();
|
||||
core::string_view seg = (*it).string();
|
||||
if (seg == ".")
|
||||
{
|
||||
++it;
|
||||
@@ -595,8 +595,8 @@ try_match(
|
||||
segments_encoded_view::const_iterator end,
|
||||
node const* cur,
|
||||
int level,
|
||||
string_view*& matches,
|
||||
string_view*& ids) const
|
||||
core::string_view*& matches,
|
||||
core::string_view*& ids) const
|
||||
{
|
||||
while (it != end)
|
||||
{
|
||||
@@ -832,7 +832,7 @@ try_match(
|
||||
level, matches, ids);
|
||||
if (r)
|
||||
{
|
||||
string_view prev = *std::prev(start);
|
||||
core::string_view prev = *std::prev(start);
|
||||
*matches0 = {
|
||||
matches0->data(),
|
||||
prev.data() + prev.size()};
|
||||
@@ -896,8 +896,8 @@ router_base::any_resource const*
|
||||
impl::
|
||||
find_impl(
|
||||
segments_encoded_view path,
|
||||
string_view*& matches,
|
||||
string_view*& ids) const
|
||||
core::string_view*& matches,
|
||||
core::string_view*& ids) const
|
||||
{
|
||||
// parse_path is inconsistent for empty paths
|
||||
if (path.empty())
|
||||
@@ -926,7 +926,7 @@ router_base::
|
||||
void
|
||||
router_base::
|
||||
insert_impl(
|
||||
string_view s,
|
||||
core::string_view s,
|
||||
any_resource const* v)
|
||||
{
|
||||
reinterpret_cast<impl*>(impl_)
|
||||
@@ -937,8 +937,8 @@ auto
|
||||
router_base::
|
||||
find_impl(
|
||||
segments_encoded_view path,
|
||||
string_view*& matches,
|
||||
string_view*& ids) const noexcept
|
||||
core::string_view*& matches,
|
||||
core::string_view*& ids) const noexcept
|
||||
-> any_resource const*
|
||||
{
|
||||
return reinterpret_cast<impl*>(impl_)
|
||||
|
||||
@@ -44,15 +44,15 @@ protected:
|
||||
BOOST_URL_DECL
|
||||
void
|
||||
insert_impl(
|
||||
string_view s,
|
||||
core::string_view s,
|
||||
any_resource const* v);
|
||||
|
||||
BOOST_URL_DECL
|
||||
any_resource const*
|
||||
find_impl(
|
||||
segments_encoded_view path,
|
||||
string_view*& matches,
|
||||
string_view*& names) const noexcept;
|
||||
core::string_view*& matches,
|
||||
core::string_view*& names) const noexcept;
|
||||
};
|
||||
|
||||
} // detail
|
||||
|
||||
@@ -36,7 +36,7 @@ operator[]( size_type pos ) const
|
||||
|
||||
auto
|
||||
matches_base::
|
||||
at( string_view id ) const
|
||||
at( core::string_view id ) const
|
||||
-> const_reference
|
||||
{
|
||||
for (std::size_t i = 0; i < size(); ++i)
|
||||
@@ -50,7 +50,7 @@ at( string_view id ) const
|
||||
|
||||
auto
|
||||
matches_base::
|
||||
operator[]( string_view id ) const
|
||||
operator[]( core::string_view id ) const
|
||||
-> const_reference
|
||||
{
|
||||
return at(id);
|
||||
@@ -58,7 +58,7 @@ operator[]( string_view id ) const
|
||||
|
||||
auto
|
||||
matches_base::
|
||||
find( string_view id ) const
|
||||
find( core::string_view id ) const
|
||||
-> const_iterator
|
||||
{
|
||||
for (std::size_t i = 0; i < size(); ++i)
|
||||
|
||||
@@ -19,7 +19,7 @@ template <class T>
|
||||
template <class U>
|
||||
void
|
||||
router<T>::
|
||||
insert(string_view pattern, U&& v)
|
||||
insert(core::string_view pattern, U&& v)
|
||||
{
|
||||
BOOST_STATIC_ASSERT(
|
||||
std::is_same<T, U>::value ||
|
||||
@@ -55,8 +55,8 @@ T const*
|
||||
router<T>::
|
||||
find(segments_encoded_view path, matches_base& m) const noexcept
|
||||
{
|
||||
string_view* matches_it = m.matches();
|
||||
string_view* ids_it = m.ids();
|
||||
core::string_view* matches_it = m.matches();
|
||||
core::string_view* ids_it = m.ids();
|
||||
any_resource const* p = find_impl(
|
||||
path, matches_it, ids_it );
|
||||
if (p)
|
||||
|
||||
@@ -20,33 +20,33 @@ namespace urls {
|
||||
class matches_base
|
||||
{
|
||||
public:
|
||||
using iterator = string_view*;
|
||||
using const_iterator = string_view const*;
|
||||
using iterator = core::string_view*;
|
||||
using const_iterator = core::string_view const*;
|
||||
using size_type = std::size_t;
|
||||
using difference_type = std::ptrdiff_t;
|
||||
using reference = string_view&;
|
||||
using const_reference = string_view const&;
|
||||
using pointer = string_view*;
|
||||
using const_pointer = string_view const*;
|
||||
using reference = core::string_view&;
|
||||
using const_reference = core::string_view const&;
|
||||
using pointer = core::string_view*;
|
||||
using const_pointer = core::string_view const*;
|
||||
|
||||
matches_base() = default;
|
||||
|
||||
virtual ~matches_base() = default;
|
||||
|
||||
virtual
|
||||
string_view const*
|
||||
core::string_view const*
|
||||
matches() const = 0;
|
||||
|
||||
virtual
|
||||
string_view const*
|
||||
core::string_view const*
|
||||
ids() const = 0;
|
||||
|
||||
virtual
|
||||
string_view*
|
||||
core::string_view*
|
||||
matches() = 0;
|
||||
|
||||
virtual
|
||||
string_view*
|
||||
core::string_view*
|
||||
ids() = 0;
|
||||
|
||||
virtual
|
||||
@@ -61,16 +61,16 @@ public:
|
||||
at( size_type pos ) const;
|
||||
|
||||
const_reference
|
||||
at( string_view id ) const;
|
||||
at( core::string_view id ) const;
|
||||
|
||||
const_reference
|
||||
operator[]( size_type pos ) const;
|
||||
|
||||
const_reference
|
||||
operator[]( string_view id ) const;
|
||||
operator[]( core::string_view id ) const;
|
||||
|
||||
const_iterator
|
||||
find( string_view id ) const;
|
||||
find( core::string_view id ) const;
|
||||
|
||||
const_iterator
|
||||
begin() const;
|
||||
@@ -87,13 +87,13 @@ template <std::size_t N = 20>
|
||||
class matches_storage
|
||||
: public matches_base
|
||||
{
|
||||
string_view matches_storage_[N];
|
||||
string_view ids_storage_[N];
|
||||
core::string_view matches_storage_[N];
|
||||
core::string_view ids_storage_[N];
|
||||
std::size_t size_;
|
||||
|
||||
matches_storage(
|
||||
string_view matches[N],
|
||||
string_view ids[N],
|
||||
core::string_view matches[N],
|
||||
core::string_view ids[N],
|
||||
std::size_t n)
|
||||
{
|
||||
for (std::size_t i = 0; i < n; ++i)
|
||||
@@ -104,14 +104,14 @@ class matches_storage
|
||||
}
|
||||
|
||||
virtual
|
||||
string_view*
|
||||
core::string_view*
|
||||
matches() override
|
||||
{
|
||||
return matches_storage_;
|
||||
}
|
||||
|
||||
virtual
|
||||
string_view*
|
||||
core::string_view*
|
||||
ids() override
|
||||
{
|
||||
return ids_storage_;
|
||||
@@ -121,14 +121,14 @@ public:
|
||||
matches_storage() = default;
|
||||
|
||||
virtual
|
||||
string_view const*
|
||||
core::string_view const*
|
||||
matches() const override
|
||||
{
|
||||
return matches_storage_;
|
||||
}
|
||||
|
||||
virtual
|
||||
string_view const*
|
||||
core::string_view const*
|
||||
ids() const override
|
||||
{
|
||||
return ids_storage_;
|
||||
|
||||
@@ -31,10 +31,11 @@
|
||||
#include <functional>
|
||||
|
||||
namespace urls = boost::urls;
|
||||
namespace core = boost::core;
|
||||
namespace asio = boost::asio;
|
||||
namespace beast = boost::beast;
|
||||
namespace http = beast::http;
|
||||
using string_view = urls::string_view;
|
||||
using string_view = core::string_view;
|
||||
using request_t = http::request<http::string_body>;
|
||||
struct connection;
|
||||
using handler = std::function<void(connection&, urls::matches)>;
|
||||
@@ -52,13 +53,13 @@ struct connection
|
||||
: socket(ioc) {}
|
||||
|
||||
void
|
||||
string_reply(string_view msg);
|
||||
string_reply(core::string_view msg);
|
||||
|
||||
void
|
||||
file_reply(string_view path);
|
||||
file_reply(core::string_view path);
|
||||
|
||||
void
|
||||
error_reply(http::status, string_view msg);
|
||||
error_reply(http::status, core::string_view msg);
|
||||
|
||||
beast::error_code ec;
|
||||
asio::ip::tcp::socket socket;
|
||||
@@ -74,9 +75,9 @@ main(int argc, char **argv)
|
||||
*/
|
||||
if (argc != 4)
|
||||
{
|
||||
string_view exec = argv[0];
|
||||
core::string_view exec = argv[0];
|
||||
auto file_pos = exec.find_last_of("/\\");
|
||||
if (file_pos != string_view::npos)
|
||||
if (file_pos != core::string_view::npos)
|
||||
exec = exec.substr(file_pos + 1);
|
||||
std::cerr
|
||||
<< "Usage: " << exec
|
||||
@@ -189,7 +190,7 @@ serve(
|
||||
|
||||
void
|
||||
connection::
|
||||
error_reply(http::status s, string_view msg)
|
||||
error_reply(http::status s, core::string_view msg)
|
||||
{
|
||||
// invalid route
|
||||
http::response<http::string_body> res{s, req.version()};
|
||||
@@ -204,7 +205,7 @@ error_reply(http::status s, string_view msg)
|
||||
|
||||
void
|
||||
connection::
|
||||
string_reply(string_view msg)
|
||||
string_reply(core::string_view msg)
|
||||
{
|
||||
http::response<http::string_body> res{http::status::ok, req.version()};
|
||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||
@@ -215,8 +216,8 @@ string_reply(string_view msg)
|
||||
http::write(socket, res, ec);
|
||||
}
|
||||
|
||||
string_view
|
||||
mime_type(string_view path);
|
||||
core::string_view
|
||||
mime_type(core::string_view path);
|
||||
|
||||
std::string
|
||||
path_cat(
|
||||
@@ -225,7 +226,7 @@ path_cat(
|
||||
|
||||
void
|
||||
connection::
|
||||
file_reply(string_view path)
|
||||
file_reply(core::string_view path)
|
||||
{
|
||||
http::file_body::value_type body;
|
||||
std::string jpath = path_cat(doc_root, path);
|
||||
@@ -254,8 +255,8 @@ file_reply(string_view path)
|
||||
// The returned path is normalized for the platform.
|
||||
std::string
|
||||
path_cat(
|
||||
string_view base,
|
||||
string_view path)
|
||||
core::string_view base,
|
||||
core::string_view path)
|
||||
{
|
||||
if (base.empty())
|
||||
return std::string(path);
|
||||
@@ -282,8 +283,8 @@ path_cat(
|
||||
return result;
|
||||
}
|
||||
|
||||
string_view
|
||||
mime_type(string_view path)
|
||||
core::string_view
|
||||
mime_type(core::string_view path)
|
||||
{
|
||||
using beast::iequals;
|
||||
auto const ext = [&path]
|
||||
|
||||
@@ -64,7 +64,7 @@ public:
|
||||
*/
|
||||
template <class U>
|
||||
void
|
||||
insert(string_view pattern, U&& v);
|
||||
insert(core::string_view pattern, U&& v);
|
||||
|
||||
/** Match URL path to corresponding resource
|
||||
|
||||
|
||||
@@ -56,23 +56,23 @@
|
||||
#include <array>
|
||||
|
||||
namespace urls = boost::urls;
|
||||
using string_view = urls::string_view;
|
||||
namespace core = boost::core;
|
||||
|
||||
struct url_components
|
||||
{
|
||||
string_view scheme;
|
||||
string_view user;
|
||||
string_view password;
|
||||
string_view hostname;
|
||||
string_view port;
|
||||
string_view path;
|
||||
string_view query;
|
||||
string_view fragment;
|
||||
core::string_view scheme;
|
||||
core::string_view user;
|
||||
core::string_view password;
|
||||
core::string_view hostname;
|
||||
core::string_view port;
|
||||
core::string_view path;
|
||||
core::string_view query;
|
||||
core::string_view fragment;
|
||||
};
|
||||
|
||||
string_view
|
||||
port_of_scheme(string_view scheme_str) {
|
||||
static std::array<std::pair<string_view, string_view>, 21> scheme_ports =
|
||||
core::string_view
|
||||
port_of_scheme(core::string_view scheme_str) {
|
||||
static std::array<std::pair<core::string_view, core::string_view>, 21> scheme_ports =
|
||||
{{
|
||||
{"http", "80"},
|
||||
{"ftp", "21"},
|
||||
@@ -97,7 +97,7 @@ port_of_scheme(string_view scheme_str) {
|
||||
{"", "65535"}
|
||||
}};
|
||||
|
||||
auto iequals = [](string_view a, string_view b)
|
||||
auto iequals = [](core::string_view a, core::string_view b)
|
||||
{
|
||||
if (b.size() != a.size()) {
|
||||
return false;
|
||||
@@ -113,7 +113,7 @@ port_of_scheme(string_view scheme_str) {
|
||||
auto const& it = std::find_if(
|
||||
scheme_ports.begin(),
|
||||
scheme_ports.end(),
|
||||
[&](std::pair<string_view, string_view> const& s) {
|
||||
[&](std::pair<core::string_view, core::string_view> const& s) {
|
||||
return iequals(s.first, scheme_str);
|
||||
});
|
||||
|
||||
@@ -126,7 +126,7 @@ port_of_scheme(string_view scheme_str) {
|
||||
|
||||
void
|
||||
extract_relative_ref(
|
||||
string_view hostinfo_relative,
|
||||
core::string_view hostinfo_relative,
|
||||
url_components &out)
|
||||
{
|
||||
// split path and query#fragment
|
||||
@@ -134,7 +134,7 @@ extract_relative_ref(
|
||||
auto it = urls::grammar::find_if(
|
||||
hostinfo_relative.begin(),
|
||||
hostinfo_relative.end(), path_end_chars);
|
||||
string_view query_and_frag = hostinfo_relative.substr(it - hostinfo_relative.begin());
|
||||
core::string_view query_and_frag = hostinfo_relative.substr(it - hostinfo_relative.begin());
|
||||
if (query_and_frag != hostinfo_relative)
|
||||
out.path = hostinfo_relative.substr(
|
||||
0, query_and_frag.data() - hostinfo_relative.data());
|
||||
@@ -144,9 +144,9 @@ extract_relative_ref(
|
||||
// ?query#fragment
|
||||
if (query_and_frag.front() == '?') {
|
||||
query_and_frag = query_and_frag.substr(1);
|
||||
string_view::size_type hash_pos = query_and_frag.find('#');
|
||||
if (hash_pos != string_view::npos) {
|
||||
string_view fragment_part = query_and_frag.substr(hash_pos);
|
||||
core::string_view::size_type hash_pos = query_and_frag.find('#');
|
||||
if (hash_pos != core::string_view::npos) {
|
||||
core::string_view fragment_part = query_and_frag.substr(hash_pos);
|
||||
out.fragment = fragment_part.substr(1);
|
||||
out.query = query_and_frag.substr(
|
||||
0, fragment_part.data() - query_and_frag.data());
|
||||
@@ -162,15 +162,15 @@ extract_relative_ref(
|
||||
|
||||
void
|
||||
extract_userinfo_relative(
|
||||
string_view relative_ref,
|
||||
string_view userinfo_relative,
|
||||
string_view host_info,
|
||||
core::string_view relative_ref,
|
||||
core::string_view userinfo_relative,
|
||||
core::string_view host_info,
|
||||
url_components& out) {
|
||||
// We expect userinfo_relative to point to the first character of
|
||||
// the hostname. If there's a port it is the first colon,
|
||||
// except with IPv6.
|
||||
auto host_end_pos = host_info.find(':');
|
||||
if (host_end_pos == string_view::npos)
|
||||
if (host_end_pos == core::string_view::npos)
|
||||
{
|
||||
// definitely no port
|
||||
out.hostname = userinfo_relative.substr(
|
||||
@@ -180,7 +180,7 @@ extract_userinfo_relative(
|
||||
|
||||
// extract hostname and port
|
||||
out.hostname = userinfo_relative.substr(0, host_end_pos);
|
||||
string_view host_relative = userinfo_relative.substr(host_end_pos + 1);
|
||||
core::string_view host_relative = userinfo_relative.substr(host_end_pos + 1);
|
||||
out.port = host_relative.substr(0, relative_ref.data() - host_relative.data());
|
||||
|
||||
// validate port
|
||||
@@ -204,7 +204,7 @@ extract_userinfo_relative(
|
||||
|
||||
void
|
||||
extract_scheme_relative(
|
||||
string_view scheme_relative,
|
||||
core::string_view scheme_relative,
|
||||
url_components &out)
|
||||
{
|
||||
// hostinfo
|
||||
@@ -216,12 +216,12 @@ extract_scheme_relative(
|
||||
auto path_offset = (std::min)(
|
||||
scheme_relative.size(),
|
||||
static_cast<std::size_t>(it - scheme_relative.begin()));
|
||||
string_view host_info = scheme_relative.substr(0, path_offset);
|
||||
core::string_view host_info = scheme_relative.substr(0, path_offset);
|
||||
|
||||
// userinfo
|
||||
string_view relative_ref = scheme_relative.substr(path_offset);
|
||||
core::string_view relative_ref = scheme_relative.substr(path_offset);
|
||||
auto host_offset = host_info.find_last_of('@');
|
||||
if (host_offset == string_view::npos)
|
||||
if (host_offset == core::string_view::npos)
|
||||
return extract_userinfo_relative(
|
||||
relative_ref,
|
||||
scheme_relative,
|
||||
@@ -229,19 +229,19 @@ extract_scheme_relative(
|
||||
out);
|
||||
|
||||
// password
|
||||
string_view userinfo_at_relative = scheme_relative.substr(host_offset);
|
||||
string_view userinfo(host_info.data(), userinfo_at_relative.data() - host_info.data());
|
||||
core::string_view userinfo_at_relative = scheme_relative.substr(host_offset);
|
||||
core::string_view userinfo(host_info.data(), userinfo_at_relative.data() - host_info.data());
|
||||
auto password_offset = std::min(userinfo.size(), userinfo.find(':'));
|
||||
if (password_offset != userinfo.size()) {
|
||||
out.user = scheme_relative.substr(0, password_offset);
|
||||
string_view password = scheme_relative.substr(password_offset + 1);
|
||||
core::string_view password = scheme_relative.substr(password_offset + 1);
|
||||
out.password = password.substr(0, userinfo_at_relative.data() - password.data());
|
||||
} else {
|
||||
out.user = scheme_relative.substr(0, userinfo_at_relative.data() - scheme_relative.data());
|
||||
}
|
||||
|
||||
// userinfo-relative
|
||||
string_view userinfo_relative = userinfo_at_relative.substr(1);
|
||||
core::string_view userinfo_relative = userinfo_at_relative.substr(1);
|
||||
it = urls::grammar::find_if(
|
||||
userinfo_relative.begin(),
|
||||
userinfo_relative.end(),
|
||||
@@ -259,7 +259,7 @@ extract_scheme_relative(
|
||||
|
||||
void
|
||||
extract_uri_components(
|
||||
string_view s,
|
||||
core::string_view s,
|
||||
url_components &out)
|
||||
{
|
||||
if (s.starts_with("//") && !s.starts_with("///"))
|
||||
@@ -287,7 +287,7 @@ extract_uri_components(
|
||||
}
|
||||
|
||||
// The usual route, parse scheme first
|
||||
string_view scheme_relative = s;
|
||||
core::string_view scheme_relative = s;
|
||||
if (has_scheme)
|
||||
scheme_relative = s.substr(out.scheme.size() + 1);
|
||||
|
||||
@@ -307,11 +307,11 @@ extract_uri_components(
|
||||
// this is the authority and "www.boost.org" is a perfectly valid
|
||||
// path segment.
|
||||
auto first_seg_offset = (std::min)(s.size(), s.find_first_of('/'));
|
||||
string_view first_seg = s.substr(0, first_seg_offset);
|
||||
core::string_view first_seg = s.substr(0, first_seg_offset);
|
||||
auto host_delimiter_pos = first_seg.find_first_of(".:");
|
||||
bool const looks_like_authority =
|
||||
urls::parse_authority(first_seg) &&
|
||||
host_delimiter_pos != string_view::npos &&
|
||||
host_delimiter_pos != core::string_view::npos &&
|
||||
host_delimiter_pos != first_seg.size() - 1;
|
||||
if (looks_like_authority)
|
||||
return extract_scheme_relative(s, out);
|
||||
@@ -328,7 +328,7 @@ extract_uri_components(
|
||||
}
|
||||
|
||||
void
|
||||
sanitize_uri(string_view s, urls::url_base& dest) {
|
||||
sanitize_uri(core::string_view s, urls::url_base& dest) {
|
||||
url_components o;
|
||||
dest.clear();
|
||||
extract_uri_components(s, o);
|
||||
@@ -351,7 +351,7 @@ sanitize_uri(string_view s, urls::url_base& dest) {
|
||||
}
|
||||
|
||||
urls::url
|
||||
sanitize_uri(string_view s) {
|
||||
sanitize_uri(core::string_view s) {
|
||||
urls::url u;
|
||||
sanitize_uri(s, u);
|
||||
return u;
|
||||
@@ -394,9 +394,9 @@ main(int argc, char **argv)
|
||||
{
|
||||
if (argc != 2)
|
||||
{
|
||||
string_view exec = argv[0];
|
||||
core::string_view exec = argv[0];
|
||||
auto p = exec.find_last_of("/\\");
|
||||
if (p != string_view::npos)
|
||||
if (p != core::string_view::npos)
|
||||
exec = exec.substr(p);
|
||||
std::cerr
|
||||
<< "Usage: " << exec
|
||||
@@ -405,9 +405,9 @@ main(int argc, char **argv)
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
string_view uri_str = argv[1];
|
||||
core::string_view uri_str = argv[1];
|
||||
|
||||
urls::result<urls::url_view> ru = urls::parse_uri_reference(uri_str);
|
||||
boost::system::result<urls::url_view> ru = urls::parse_uri_reference(uri_str);
|
||||
if (ru)
|
||||
{
|
||||
urls::url_view u = *ru;
|
||||
|
||||
@@ -52,7 +52,7 @@ int main(int argc, char** argv)
|
||||
std::string line;
|
||||
while (std::getline(fin, line))
|
||||
{
|
||||
urls::string_view sv(line);
|
||||
boost::core::string_view sv(line);
|
||||
if (sv.starts_with("//") && suffix.empty())
|
||||
{
|
||||
comment.append(sv.substr(3));
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
#include <boost/url/segments_ref.hpp>
|
||||
#include <boost/url/segments_view.hpp>
|
||||
#include <boost/url/static_url.hpp>
|
||||
#include <boost/url/string_view.hpp>
|
||||
#include <boost/core/detail/string_view.hpp>
|
||||
#include <boost/url/url.hpp>
|
||||
#include <boost/url/url_base.hpp>
|
||||
#include <boost/url/url_view.hpp>
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace urls {
|
||||
strings constructed from a parsed, external
|
||||
character buffer whose storage is managed
|
||||
by the caller. That is, it acts like a
|
||||
@ref string_view in terms of ownership.
|
||||
@ref core::string_view in terms of ownership.
|
||||
The caller is responsible for ensuring
|
||||
that the lifetime of the underlying
|
||||
character buffer extends until it is no
|
||||
@@ -55,7 +55,7 @@ namespace urls {
|
||||
contain an error. The error can be converted to
|
||||
an exception by the caller if desired:
|
||||
@code
|
||||
result< authority_view > rv = parse_authority( "user:pass@www.example.com:8080" );
|
||||
system::result< authority_view > rv = parse_authority( "user:pass@www.example.com:8080" );
|
||||
@endcode
|
||||
|
||||
@par BNF
|
||||
@@ -159,7 +159,7 @@ public:
|
||||
*/
|
||||
BOOST_URL_DECL
|
||||
explicit
|
||||
authority_view(string_view s);
|
||||
authority_view(core::string_view s);
|
||||
|
||||
/** Constructor
|
||||
*/
|
||||
@@ -255,10 +255,10 @@ public:
|
||||
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2"
|
||||
>3.2. Authority (rfc3986)</a>
|
||||
*/
|
||||
string_view
|
||||
core::string_view
|
||||
buffer() const noexcept
|
||||
{
|
||||
return string_view(data(), size());
|
||||
return core::string_view(data(), size());
|
||||
}
|
||||
|
||||
//--------------------------------------------
|
||||
@@ -987,7 +987,7 @@ public:
|
||||
>3.2.2. Host (rfc3986)</a>
|
||||
*/
|
||||
BOOST_URL_DECL
|
||||
string_view
|
||||
core::string_view
|
||||
host_ipvfuture() const noexcept;
|
||||
|
||||
/** Return the host name
|
||||
@@ -1148,7 +1148,7 @@ public:
|
||||
@ref port_number.
|
||||
*/
|
||||
BOOST_URL_DECL
|
||||
string_view
|
||||
core::string_view
|
||||
port() const noexcept;
|
||||
|
||||
/** Return the port
|
||||
@@ -1450,9 +1450,9 @@ operator<<(
|
||||
@ref authority_view.
|
||||
*/
|
||||
BOOST_URL_DECL
|
||||
result<authority_view>
|
||||
system::result<authority_view>
|
||||
parse_authority(
|
||||
string_view s) noexcept;
|
||||
core::string_view s) noexcept;
|
||||
|
||||
//------------------------------------------------
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#define BOOST_URL_DECODE_VIEW_HPP
|
||||
|
||||
#include <boost/url/detail/config.hpp>
|
||||
#include <boost/url/string_view.hpp>
|
||||
#include <boost/core/detail/string_view.hpp>
|
||||
#include <boost/url/encoding_opts.hpp>
|
||||
#include <boost/url/pct_string_view.hpp>
|
||||
#include <type_traits>
|
||||
@@ -72,7 +72,7 @@ make_decode_view(
|
||||
@par Operators
|
||||
The following operators are supported between
|
||||
@ref decode_view and any object that is convertible
|
||||
to @ref string_view
|
||||
to @ref core::string_view
|
||||
|
||||
@code
|
||||
bool operator==( decode_view, decode_view ) noexcept;
|
||||
@@ -103,7 +103,7 @@ class decode_view
|
||||
BOOST_URL_DECL
|
||||
explicit
|
||||
decode_view(
|
||||
string_view s,
|
||||
core::string_view s,
|
||||
std::size_t n,
|
||||
encoding_opts opt) noexcept;
|
||||
|
||||
@@ -355,7 +355,7 @@ public:
|
||||
*/
|
||||
BOOST_URL_DECL
|
||||
bool
|
||||
starts_with( string_view s ) const noexcept;
|
||||
starts_with( core::string_view s ) const noexcept;
|
||||
|
||||
/** Checks if the string ends with the given prefix
|
||||
|
||||
@@ -372,7 +372,7 @@ public:
|
||||
*/
|
||||
BOOST_URL_DECL
|
||||
bool
|
||||
ends_with( string_view s ) const noexcept;
|
||||
ends_with( core::string_view s ) const noexcept;
|
||||
|
||||
/** Checks if the string begins with the given prefix
|
||||
|
||||
@@ -509,7 +509,7 @@ public:
|
||||
*/
|
||||
BOOST_URL_DECL
|
||||
int
|
||||
compare(string_view other) const noexcept;
|
||||
compare(core::string_view other) const noexcept;
|
||||
|
||||
/** Return the result of comparing to another string
|
||||
|
||||
@@ -539,17 +539,17 @@ public:
|
||||
private:
|
||||
template<class S0, class S1>
|
||||
using is_match = std::integral_constant<bool,
|
||||
// both decode_view or convertible to string_view
|
||||
// both decode_view or convertible to core::string_view
|
||||
(
|
||||
std::is_same<typename std::decay<S0>::type, decode_view>::value ||
|
||||
std::is_convertible<S0, string_view>::value) &&
|
||||
std::is_convertible<S0, core::string_view>::value) &&
|
||||
(
|
||||
std::is_same<typename std::decay<S1>::type, decode_view>::value ||
|
||||
std::is_convertible<S1, string_view>::value) &&
|
||||
std::is_convertible<S1, core::string_view>::value) &&
|
||||
// not both are convertible to string view
|
||||
(
|
||||
!std::is_convertible<S0, string_view>::value ||
|
||||
!std::is_convertible<S1, string_view>::value)>;
|
||||
!std::is_convertible<S0, core::string_view>::value ||
|
||||
!std::is_convertible<S1, core::string_view>::value)>;
|
||||
|
||||
static
|
||||
int
|
||||
|
||||
@@ -37,8 +37,8 @@ struct BOOST_SYMBOL_VISIBLE
|
||||
protected:
|
||||
any_params_iter(
|
||||
bool empty_,
|
||||
string_view s0_ = {},
|
||||
string_view s1_ = {}) noexcept
|
||||
core::string_view s0_ = {},
|
||||
core::string_view s1_ = {}) noexcept
|
||||
: s0(s0_)
|
||||
, s1(s1_)
|
||||
, empty(empty_)
|
||||
@@ -48,8 +48,8 @@ protected:
|
||||
public:
|
||||
// these are adjusted
|
||||
// when self-intersecting
|
||||
string_view s0;
|
||||
string_view s1;
|
||||
core::string_view s0;
|
||||
core::string_view s1;
|
||||
|
||||
// True if the sequence is empty
|
||||
bool empty = false;
|
||||
@@ -97,11 +97,11 @@ struct BOOST_SYMBOL_VISIBLE
|
||||
BOOST_URL_DECL
|
||||
explicit
|
||||
query_iter(
|
||||
string_view s,
|
||||
core::string_view s,
|
||||
bool ne = false) noexcept;
|
||||
|
||||
private:
|
||||
string_view s_;
|
||||
core::string_view s_;
|
||||
std::size_t n_;
|
||||
char const* p_;
|
||||
bool at_end_;
|
||||
@@ -348,7 +348,7 @@ struct param_value_iter
|
||||
{
|
||||
param_value_iter(
|
||||
std::size_t nk,
|
||||
string_view const& value,
|
||||
core::string_view const& value,
|
||||
bool has_value) noexcept
|
||||
: any_params_iter(
|
||||
false,
|
||||
|
||||
@@ -26,7 +26,7 @@ struct BOOST_SYMBOL_VISIBLE
|
||||
protected:
|
||||
explicit
|
||||
any_segments_iter(
|
||||
string_view s_ = {}) noexcept
|
||||
core::string_view s_ = {}) noexcept
|
||||
: s(s_)
|
||||
{
|
||||
}
|
||||
@@ -36,11 +36,11 @@ protected:
|
||||
public:
|
||||
// this is adjusted
|
||||
// when self-intersecting
|
||||
string_view s;
|
||||
core::string_view s;
|
||||
|
||||
// the first segment,
|
||||
// to handle special cases
|
||||
string_view front;
|
||||
core::string_view front;
|
||||
|
||||
// quick number of segments
|
||||
// 0 = zero
|
||||
@@ -87,7 +87,7 @@ struct BOOST_SYMBOL_VISIBLE
|
||||
|
||||
explicit
|
||||
segment_iter(
|
||||
string_view s) noexcept;
|
||||
core::string_view s) noexcept;
|
||||
|
||||
private:
|
||||
bool at_end_ = false;
|
||||
@@ -107,10 +107,10 @@ struct segments_iter_base
|
||||
protected:
|
||||
BOOST_URL_DECL static void
|
||||
measure_impl(std::size_t&,
|
||||
string_view, bool) noexcept;
|
||||
core::string_view, bool) noexcept;
|
||||
BOOST_URL_DECL static void
|
||||
copy_impl(char*&, char const*,
|
||||
string_view, bool) noexcept;
|
||||
core::string_view, bool) noexcept;
|
||||
};
|
||||
|
||||
// iterates segments in a
|
||||
@@ -124,7 +124,7 @@ struct segments_iter
|
||||
std::is_convertible<
|
||||
typename std::iterator_traits<
|
||||
FwdIt>::reference,
|
||||
string_view>::value);
|
||||
core::string_view>::value);
|
||||
|
||||
segments_iter(
|
||||
FwdIt first,
|
||||
@@ -221,10 +221,10 @@ struct segments_encoded_iter_base
|
||||
protected:
|
||||
BOOST_URL_DECL static void
|
||||
measure_impl(std::size_t&,
|
||||
string_view, bool) noexcept;
|
||||
core::string_view, bool) noexcept;
|
||||
BOOST_URL_DECL static void
|
||||
copy_impl(char*&, char const*,
|
||||
string_view, bool) noexcept;
|
||||
core::string_view, bool) noexcept;
|
||||
};
|
||||
|
||||
// iterates segments in an
|
||||
@@ -238,7 +238,7 @@ struct segments_encoded_iter
|
||||
std::is_convertible<
|
||||
typename std::iterator_traits<
|
||||
FwdIt>::reference,
|
||||
string_view>::value);
|
||||
core::string_view>::value);
|
||||
|
||||
segments_encoded_iter(
|
||||
FwdIt first,
|
||||
|
||||
@@ -117,6 +117,12 @@
|
||||
# error Unknown or unsupported architecture, please open an issue
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_MSVC) || defined(BOOST_URL_DOCS)
|
||||
#define BOOST_URL_DEPRECATED(msg)
|
||||
#else
|
||||
#define BOOST_URL_DEPRECATED(msg) BOOST_DEPRECATED(msg)
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace urls {
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#define BOOST_URL_DETAIL_DECODE_HPP
|
||||
|
||||
#include <boost/url/encoding_opts.hpp>
|
||||
#include <boost/url/string_view.hpp>
|
||||
#include <boost/core/detail/string_view.hpp>
|
||||
#include <cstdlib>
|
||||
|
||||
namespace boost {
|
||||
@@ -27,14 +27,14 @@ decode_one(
|
||||
BOOST_URL_DECL
|
||||
std::size_t
|
||||
decode_bytes_unsafe(
|
||||
string_view s) noexcept;
|
||||
core::string_view s) noexcept;
|
||||
|
||||
BOOST_URL_DECL
|
||||
std::size_t
|
||||
decode_unsafe(
|
||||
char* dest,
|
||||
char const* end,
|
||||
string_view s,
|
||||
core::string_view s,
|
||||
encoding_opts opt = {}) noexcept;
|
||||
|
||||
} // detail
|
||||
|
||||
@@ -37,7 +37,7 @@ char const* const hexdigs[] = {
|
||||
template<class CharSet>
|
||||
std::size_t
|
||||
re_encoded_size_unsafe(
|
||||
string_view s,
|
||||
core::string_view s,
|
||||
CharSet const& unreserved,
|
||||
encoding_opts opt) noexcept
|
||||
{
|
||||
@@ -107,7 +107,7 @@ std::size_t
|
||||
re_encode_unsafe(
|
||||
char*& dest_,
|
||||
char const* const end,
|
||||
string_view s,
|
||||
core::string_view s,
|
||||
CharSet const& unreserved,
|
||||
encoding_opts opt) noexcept
|
||||
{
|
||||
|
||||
@@ -19,13 +19,13 @@ namespace detail {
|
||||
|
||||
BOOST_URL_DECL void BOOST_NORETURN
|
||||
throw_system_error(
|
||||
error_code const& ec,
|
||||
system::error_code const& ec,
|
||||
source_location const& loc =
|
||||
BOOST_URL_POS);
|
||||
|
||||
BOOST_URL_DECL void BOOST_NORETURN
|
||||
throw_errc(
|
||||
errc::errc_t ev,
|
||||
boost::system::errc::errc_t ev,
|
||||
source_location const& loc =
|
||||
BOOST_URL_POS);
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
|
||||
constexpr
|
||||
format_parse_context(
|
||||
string_view fmt,
|
||||
core::string_view fmt,
|
||||
std::size_t arg_id = 0)
|
||||
: format_parse_context(
|
||||
fmt.data(),
|
||||
@@ -88,10 +88,10 @@ struct ignore_format {};
|
||||
template <class T>
|
||||
struct named_arg
|
||||
{
|
||||
string_view name;
|
||||
core::string_view name;
|
||||
T const& value;
|
||||
|
||||
named_arg(string_view n, T const& v)
|
||||
named_arg(core::string_view n, T const& v)
|
||||
: name(n)
|
||||
, value(v)
|
||||
{}
|
||||
@@ -111,7 +111,7 @@ class format_arg
|
||||
format_context&,
|
||||
grammar::lut_chars const&,
|
||||
void const* );
|
||||
string_view name_;
|
||||
core::string_view name_;
|
||||
std::size_t value_ = 0;
|
||||
bool ignore_ = false;
|
||||
|
||||
@@ -141,7 +141,7 @@ public:
|
||||
format_arg( named_arg<A>&& a );
|
||||
|
||||
template<class A>
|
||||
format_arg( string_view name, A&& a );
|
||||
format_arg( core::string_view name, A&& a );
|
||||
|
||||
format_arg()
|
||||
: format_arg(ignore_format{})
|
||||
@@ -171,7 +171,7 @@ public:
|
||||
fmt_( pctx, fctx, cs, arg_ );
|
||||
}
|
||||
|
||||
string_view
|
||||
core::string_view
|
||||
name() const
|
||||
{
|
||||
return name_;
|
||||
@@ -221,7 +221,7 @@ public:
|
||||
}
|
||||
|
||||
format_arg
|
||||
get( string_view name ) const noexcept
|
||||
get( core::string_view name ) const noexcept
|
||||
{
|
||||
for (std::size_t i = 0; i < n_; ++i)
|
||||
{
|
||||
@@ -259,7 +259,7 @@ public:
|
||||
}
|
||||
|
||||
format_arg
|
||||
arg( string_view name ) const noexcept
|
||||
arg( core::string_view name ) const noexcept
|
||||
{
|
||||
return args_.get( name );
|
||||
}
|
||||
@@ -309,7 +309,7 @@ public:
|
||||
}
|
||||
|
||||
format_arg
|
||||
arg( string_view name ) const noexcept
|
||||
arg( core::string_view name ) const noexcept
|
||||
{
|
||||
return args_.get( name );
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ get_uvalue( A&& a )
|
||||
|
||||
BOOST_URL_DECL
|
||||
std::size_t
|
||||
get_uvalue( string_view a );
|
||||
get_uvalue( core::string_view a );
|
||||
|
||||
BOOST_URL_DECL
|
||||
std::size_t
|
||||
@@ -86,7 +86,7 @@ format_arg( named_arg<A>&& a )
|
||||
|
||||
template<class A>
|
||||
format_arg::
|
||||
format_arg( string_view name, A&& a )
|
||||
format_arg( core::string_view name, A&& a )
|
||||
: arg_( &a )
|
||||
, measure_( &measure_impl<A> )
|
||||
, fmt_( &format_impl<A> )
|
||||
@@ -219,20 +219,20 @@ BOOST_URL_DECL
|
||||
void
|
||||
get_width_from_args(
|
||||
std::size_t arg_idx,
|
||||
string_view arg_name,
|
||||
core::string_view arg_name,
|
||||
format_args args,
|
||||
std::size_t& w);
|
||||
|
||||
// formatter for string view
|
||||
template <>
|
||||
struct formatter<string_view>
|
||||
struct formatter<core::string_view>
|
||||
{
|
||||
private:
|
||||
char fill = ' ';
|
||||
char align = '\0';
|
||||
std::size_t width = 0;
|
||||
std::size_t width_idx = std::size_t(-1);
|
||||
string_view width_name;
|
||||
core::string_view width_name;
|
||||
|
||||
public:
|
||||
BOOST_URL_DECL
|
||||
@@ -242,14 +242,14 @@ public:
|
||||
BOOST_URL_DECL
|
||||
std::size_t
|
||||
measure(
|
||||
string_view str,
|
||||
core::string_view str,
|
||||
measure_context& ctx,
|
||||
grammar::lut_chars const& cs) const;
|
||||
|
||||
BOOST_URL_DECL
|
||||
char*
|
||||
format(
|
||||
string_view str,
|
||||
core::string_view str,
|
||||
format_context& ctx,
|
||||
grammar::lut_chars const& cs) const;
|
||||
};
|
||||
@@ -260,9 +260,9 @@ template <class T>
|
||||
struct formatter<
|
||||
T, typename std::enable_if<
|
||||
std::is_convertible<
|
||||
T, string_view>::value>::type>
|
||||
T, core::string_view>::value>::type>
|
||||
{
|
||||
formatter<string_view> impl_;
|
||||
formatter<core::string_view> impl_;
|
||||
|
||||
public:
|
||||
char const*
|
||||
@@ -273,7 +273,7 @@ public:
|
||||
|
||||
std::size_t
|
||||
measure(
|
||||
string_view str,
|
||||
core::string_view str,
|
||||
measure_context& ctx,
|
||||
grammar::lut_chars const& cs) const
|
||||
{
|
||||
@@ -281,7 +281,7 @@ public:
|
||||
}
|
||||
|
||||
char*
|
||||
format(string_view str, format_context& ctx, grammar::lut_chars const& cs) const
|
||||
format(core::string_view str, format_context& ctx, grammar::lut_chars const& cs) const
|
||||
{
|
||||
return impl_.format(str, ctx, cs);
|
||||
}
|
||||
@@ -290,7 +290,7 @@ public:
|
||||
template <>
|
||||
struct formatter<char>
|
||||
{
|
||||
formatter<string_view> impl_;
|
||||
formatter<core::string_view> impl_;
|
||||
|
||||
public:
|
||||
char const*
|
||||
@@ -327,7 +327,7 @@ class integer_formatter_impl
|
||||
bool zeros = false;
|
||||
std::size_t width = 0;
|
||||
std::size_t width_idx = std::size_t(-1);
|
||||
string_view width_name;
|
||||
core::string_view width_name;
|
||||
|
||||
public:
|
||||
BOOST_URL_DECL
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#ifndef BOOST_URL_DETAIL_MOVE_CHARS_HPP
|
||||
#define BOOST_URL_DETAIL_MOVE_CHARS_HPP
|
||||
|
||||
#include <boost/url/string_view.hpp>
|
||||
#include <boost/core/detail/string_view.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <cstring>
|
||||
#include <functional>
|
||||
@@ -26,8 +26,8 @@ namespace detail {
|
||||
inline
|
||||
bool
|
||||
is_overlapping(
|
||||
string_view buf,
|
||||
string_view s) noexcept
|
||||
core::string_view buf,
|
||||
core::string_view s) noexcept
|
||||
{
|
||||
auto const b0 = buf.data();
|
||||
auto const e0 = b0 + buf.size();
|
||||
@@ -49,7 +49,7 @@ inline
|
||||
void
|
||||
move_chars_impl(
|
||||
std::ptrdiff_t,
|
||||
string_view const&) noexcept
|
||||
core::string_view const&) noexcept
|
||||
{
|
||||
}
|
||||
|
||||
@@ -57,8 +57,8 @@ template<class... Sn>
|
||||
void
|
||||
move_chars_impl(
|
||||
std::ptrdiff_t d,
|
||||
string_view const& buf,
|
||||
string_view& s,
|
||||
core::string_view const& buf,
|
||||
core::string_view& s,
|
||||
Sn&... sn) noexcept
|
||||
{
|
||||
if(is_overlapping(buf, s))
|
||||
@@ -74,10 +74,10 @@ move_chars(
|
||||
std::size_t n,
|
||||
Args&... args) noexcept
|
||||
{
|
||||
string_view buf(src, n);
|
||||
core::string_view buf(src, n);
|
||||
move_chars_impl(
|
||||
dest - src,
|
||||
string_view(src, n),
|
||||
core::string_view(src, n),
|
||||
args...);
|
||||
std::memmove(
|
||||
dest, src, n);
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#ifndef BOOST_URL_DETAIL_NORMALIZED_HPP
|
||||
#define BOOST_URL_DETAIL_NORMALIZED_HPP
|
||||
|
||||
#include <boost/url/string_view.hpp>
|
||||
#include <boost/core/detail/string_view.hpp>
|
||||
#include <boost/url/segments_encoded_view.hpp>
|
||||
#include <boost/url/detail/normalize.hpp>
|
||||
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
}
|
||||
|
||||
void
|
||||
put(string_view s) noexcept
|
||||
put(core::string_view s) noexcept
|
||||
{
|
||||
for (char c: s)
|
||||
{
|
||||
@@ -70,78 +70,78 @@ private:
|
||||
|
||||
void
|
||||
pop_encoded_front(
|
||||
string_view& s,
|
||||
core::string_view& s,
|
||||
char& c,
|
||||
std::size_t& n) noexcept;
|
||||
|
||||
// compare two string_views as if they are both
|
||||
// compare two core::string_views as if they are both
|
||||
// percent-decoded
|
||||
int
|
||||
compare_encoded(
|
||||
string_view lhs,
|
||||
string_view rhs) noexcept;
|
||||
core::string_view lhs,
|
||||
core::string_view rhs) noexcept;
|
||||
|
||||
// digest a string_view as if it were
|
||||
// digest a core::string_view as if it were
|
||||
// percent-decoded
|
||||
void
|
||||
digest_encoded(
|
||||
string_view s,
|
||||
core::string_view s,
|
||||
fnv_1a& hasher) noexcept;
|
||||
|
||||
void
|
||||
digest(
|
||||
string_view s,
|
||||
core::string_view s,
|
||||
fnv_1a& hasher) noexcept;
|
||||
|
||||
// check if string_view lhs starts with string_view
|
||||
// check if core::string_view lhs starts with core::string_view
|
||||
// rhs as if they are both percent-decoded. If
|
||||
// lhs starts with rhs, return number of chars
|
||||
// matched in the encoded string_view
|
||||
// matched in the encoded core::string_view
|
||||
std::size_t
|
||||
path_starts_with(
|
||||
string_view lhs,
|
||||
string_view rhs) noexcept;
|
||||
core::string_view lhs,
|
||||
core::string_view rhs) noexcept;
|
||||
|
||||
// check if string_view lhs ends with string_view
|
||||
// check if core::string_view lhs ends with core::string_view
|
||||
// rhs as if they are both percent-decoded. If
|
||||
// lhs ends with rhs, return number of chars
|
||||
// matched in the encoded string_view
|
||||
// matched in the encoded core::string_view
|
||||
std::size_t
|
||||
path_ends_with(
|
||||
string_view lhs,
|
||||
string_view rhs) noexcept;
|
||||
core::string_view lhs,
|
||||
core::string_view rhs) noexcept;
|
||||
|
||||
// compare two string_views as if they are both
|
||||
// compare two core::string_views as if they are both
|
||||
// percent-decoded and lowercase
|
||||
int
|
||||
ci_compare_encoded(
|
||||
string_view lhs,
|
||||
string_view rhs) noexcept;
|
||||
core::string_view lhs,
|
||||
core::string_view rhs) noexcept;
|
||||
|
||||
// digest a string_view as if it were decoded
|
||||
// digest a core::string_view as if it were decoded
|
||||
// and lowercase
|
||||
void
|
||||
ci_digest_encoded(
|
||||
string_view s,
|
||||
core::string_view s,
|
||||
fnv_1a& hasher) noexcept;
|
||||
|
||||
// compare two ascii string_views
|
||||
// compare two ascii core::string_views
|
||||
int
|
||||
compare(
|
||||
string_view lhs,
|
||||
string_view rhs) noexcept;
|
||||
core::string_view lhs,
|
||||
core::string_view rhs) noexcept;
|
||||
|
||||
// compare two string_views as if they are both
|
||||
// compare two core::string_views as if they are both
|
||||
// lowercase
|
||||
int
|
||||
ci_compare(
|
||||
string_view lhs,
|
||||
string_view rhs) noexcept;
|
||||
core::string_view lhs,
|
||||
core::string_view rhs) noexcept;
|
||||
|
||||
// digest a string_view as if it were lowercase
|
||||
// digest a core::string_view as if it were lowercase
|
||||
void
|
||||
ci_digest(
|
||||
string_view s,
|
||||
core::string_view s,
|
||||
fnv_1a& hasher) noexcept;
|
||||
|
||||
BOOST_URL_DECL
|
||||
@@ -149,21 +149,21 @@ std::size_t
|
||||
remove_dot_segments(
|
||||
char* dest,
|
||||
char const* end,
|
||||
string_view s) noexcept;
|
||||
core::string_view s) noexcept;
|
||||
|
||||
void
|
||||
pop_last_segment(
|
||||
string_view& s,
|
||||
string_view& c,
|
||||
core::string_view& s,
|
||||
core::string_view& c,
|
||||
std::size_t& level,
|
||||
bool r) noexcept;
|
||||
|
||||
char
|
||||
path_pop_back( string_view& s );
|
||||
path_pop_back( core::string_view& s );
|
||||
|
||||
void
|
||||
normalized_path_digest(
|
||||
string_view s,
|
||||
core::string_view s,
|
||||
bool remove_unmatched,
|
||||
fnv_1a& hasher) noexcept;
|
||||
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
#ifndef BOOST_URL_DETAIL_OPTIONAL_STRING_HPP
|
||||
#define BOOST_URL_DETAIL_OPTIONAL_STRING_HPP
|
||||
|
||||
#include <boost/url/string_view.hpp>
|
||||
#include <boost/url/detail/string_view.hpp>
|
||||
#include <boost/core/detail/string_view.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace urls {
|
||||
@@ -22,13 +23,13 @@ struct no_value_t;
|
||||
namespace detail {
|
||||
struct optional_string
|
||||
{
|
||||
string_view s;
|
||||
core::string_view s;
|
||||
bool b = false;
|
||||
};
|
||||
|
||||
template <class String>
|
||||
typename std::enable_if<
|
||||
std::is_convertible<String, string_view>::value,
|
||||
std::is_convertible<String, core::string_view>::value,
|
||||
optional_string>::type
|
||||
get_optional_string(
|
||||
String const& s)
|
||||
@@ -53,7 +54,7 @@ struct is_dereferenceable<
|
||||
|
||||
template <class OptionalString>
|
||||
typename std::enable_if<
|
||||
!std::is_convertible<OptionalString, string_view>::value,
|
||||
!std::is_convertible<OptionalString, core::string_view>::value,
|
||||
optional_string>::type
|
||||
get_optional_string(
|
||||
OptionalString const& opt)
|
||||
@@ -65,11 +66,11 @@ get_optional_string(
|
||||
static_assert(
|
||||
is_dereferenceable<OptionalString>::value &&
|
||||
std::is_constructible<bool, OptionalString>::value &&
|
||||
!std::is_convertible<OptionalString, string_view>::value &&
|
||||
std::is_convertible<typename std::decay<decltype(*std::declval<OptionalString>())>::type, string_view>::value,
|
||||
!std::is_convertible<OptionalString, core::string_view>::value &&
|
||||
std::is_convertible<typename std::decay<decltype(*std::declval<OptionalString>())>::type, core::string_view>::value,
|
||||
"OptionalString requirements not met");
|
||||
optional_string r;
|
||||
r.s = opt ? detail::to_sv(*opt) : string_view{};
|
||||
r.s = opt ? detail::to_sv(*opt) : core::string_view{};
|
||||
r.b = static_cast<bool>(opt);
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#ifndef BOOST_URL_DETAIL_PATH_HPP
|
||||
#define BOOST_URL_DETAIL_PATH_HPP
|
||||
|
||||
#include <boost/url/string_view.hpp>
|
||||
#include <boost/core/detail/string_view.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace urls {
|
||||
@@ -62,7 +62,7 @@ path_prefix(
|
||||
inline
|
||||
std::size_t
|
||||
path_prefix(
|
||||
string_view s) noexcept
|
||||
core::string_view s) noexcept
|
||||
{
|
||||
return path_prefix(
|
||||
s.data(), s.size());
|
||||
@@ -73,7 +73,7 @@ path_prefix(
|
||||
inline
|
||||
std::size_t
|
||||
path_segments(
|
||||
string_view s,
|
||||
core::string_view s,
|
||||
std::size_t nseg) noexcept
|
||||
{
|
||||
switch(s.size())
|
||||
@@ -124,9 +124,9 @@ path_segments(
|
||||
// Trim reserved characters from
|
||||
// the front of the path.
|
||||
inline
|
||||
string_view
|
||||
core::string_view
|
||||
clean_path(
|
||||
string_view s) noexcept
|
||||
core::string_view s) noexcept
|
||||
{
|
||||
s.remove_prefix(
|
||||
path_prefix(s));
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
#include <boost/url/error_types.hpp>
|
||||
#include <boost/url/url_base.hpp>
|
||||
#include <boost/url/string_view.hpp>
|
||||
#include <boost/core/detail/string_view.hpp>
|
||||
|
||||
// This file includes functions and classes
|
||||
// to parse uri templates or format strings
|
||||
@@ -25,14 +25,14 @@ class format_args;
|
||||
|
||||
struct pattern
|
||||
{
|
||||
string_view scheme;
|
||||
string_view user;
|
||||
string_view pass;
|
||||
string_view host;
|
||||
string_view port;
|
||||
string_view path;
|
||||
string_view query;
|
||||
string_view frag;
|
||||
core::string_view scheme;
|
||||
core::string_view user;
|
||||
core::string_view pass;
|
||||
core::string_view host;
|
||||
core::string_view port;
|
||||
core::string_view path;
|
||||
core::string_view query;
|
||||
core::string_view frag;
|
||||
|
||||
bool has_authority = false;
|
||||
bool has_user = false;
|
||||
@@ -49,9 +49,9 @@ struct pattern
|
||||
};
|
||||
|
||||
BOOST_URL_DECL
|
||||
result<pattern>
|
||||
system::result<pattern>
|
||||
parse_pattern(
|
||||
string_view s);
|
||||
core::string_view s);
|
||||
|
||||
} // detail
|
||||
} // url
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#ifndef BOOST_URL_DETAIL_PCT_FORMAT_HPP
|
||||
#define BOOST_URL_DETAIL_PCT_FORMAT_HPP
|
||||
|
||||
#include <boost/url/string_view.hpp>
|
||||
#include <boost/core/detail/string_view.hpp>
|
||||
#include <boost/url/url.hpp>
|
||||
#include <boost/url/grammar/lut_chars.hpp>
|
||||
#include <boost/url/detail/format_args.hpp>
|
||||
|
||||
@@ -57,10 +57,10 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
string_view
|
||||
core::string_view
|
||||
string() const noexcept
|
||||
{
|
||||
return string_view(buf_ +
|
||||
return core::string_view(buf_ +
|
||||
sizeof(buf_) - n_, n_);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#define BOOST_URL_DETAIL_REPLACEMENT_FIELD_RULE_HPP
|
||||
|
||||
#include <boost/url/error.hpp>
|
||||
#include <boost/url/string_view.hpp>
|
||||
#include <boost/core/detail/string_view.hpp>
|
||||
#include <boost/url/grammar/variant_rule.hpp>
|
||||
#include <boost/url/grammar/unsigned_rule.hpp>
|
||||
|
||||
@@ -22,10 +22,10 @@ namespace detail {
|
||||
// replacement_field ::= "{" [arg_id] [":" format_spec "}"
|
||||
struct replacement_field_rule_t
|
||||
{
|
||||
using value_type = string_view;
|
||||
using value_type = core::string_view;
|
||||
|
||||
BOOST_URL_DECL
|
||||
result<value_type>
|
||||
system::result<value_type>
|
||||
parse(
|
||||
char const*& it,
|
||||
char const* end) const noexcept;
|
||||
@@ -38,10 +38,10 @@ constexpr replacement_field_rule_t replacement_field_rule{};
|
||||
// id_continue ::= id_start | digit
|
||||
struct identifier_rule_t
|
||||
{
|
||||
using value_type = string_view;
|
||||
using value_type = core::string_view;
|
||||
|
||||
BOOST_URL_DECL
|
||||
result<value_type>
|
||||
system::result<value_type>
|
||||
parse(
|
||||
char const*& it,
|
||||
char const* end) const noexcept;
|
||||
@@ -59,9 +59,9 @@ static constexpr auto arg_id_rule =
|
||||
|
||||
struct format_spec_rule_t
|
||||
{
|
||||
using value_type = string_view;
|
||||
using value_type = core::string_view;
|
||||
|
||||
result<value_type>
|
||||
system::result<value_type>
|
||||
parse(
|
||||
char const*& it,
|
||||
char const* end) const noexcept;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
#include <boost/url/detail/parts_base.hpp>
|
||||
#include <boost/url/detail/url_impl.hpp>
|
||||
#include <boost/url/string_view.hpp>
|
||||
#include <boost/core/detail/string_view.hpp>
|
||||
#include <string>
|
||||
|
||||
namespace boost {
|
||||
|
||||
@@ -16,15 +16,15 @@ namespace boost {
|
||||
namespace urls {
|
||||
namespace detail {
|
||||
|
||||
// We use detail::to_sv(s) instead of string_view(s) whenever
|
||||
// we should convert to string_view.
|
||||
// We use detail::to_sv(s) instead of core::string_view(s) whenever
|
||||
// we should convert to core::string_view.
|
||||
// This is a workaround for GCC >=8.0 <8.4
|
||||
// See: https://github.com/boostorg/url/issues/672
|
||||
template<class T>
|
||||
core::string_view
|
||||
to_sv(T const& t) noexcept
|
||||
{
|
||||
return boost::core::string_view(t);
|
||||
return core::string_view(t);
|
||||
}
|
||||
|
||||
} // detail
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <boost/url/host_type.hpp>
|
||||
#include <boost/url/pct_string_view.hpp>
|
||||
#include <boost/url/scheme.hpp>
|
||||
#include <boost/url/string_view.hpp>
|
||||
#include <boost/core/detail/string_view.hpp>
|
||||
#include <boost/url/detail/parts_base.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <cstdint>
|
||||
@@ -70,8 +70,8 @@ struct url_impl : parts_base
|
||||
std::size_t len(int, int) const noexcept;
|
||||
std::size_t len(int) const noexcept;
|
||||
std::size_t offset(int) const noexcept;
|
||||
string_view get(int) const noexcept;
|
||||
string_view get(int, int) const noexcept;
|
||||
core::string_view get(int) const noexcept;
|
||||
core::string_view get(int, int) const noexcept;
|
||||
pct_string_view pct_get(int) const noexcept;
|
||||
pct_string_view pct_get(int, int) const noexcept;
|
||||
void set_size(int, std::size_t) noexcept;
|
||||
@@ -79,12 +79,12 @@ struct url_impl : parts_base
|
||||
void adjust(int, int, std::size_t) noexcept;
|
||||
void collapse(int, int, std::size_t) noexcept;
|
||||
|
||||
void apply_scheme(string_view) noexcept;
|
||||
void apply_scheme(core::string_view) noexcept;
|
||||
void apply_userinfo(pct_string_view const&,
|
||||
pct_string_view const*) noexcept;
|
||||
void apply_host(host_type, pct_string_view,
|
||||
unsigned char const*) noexcept;
|
||||
void apply_port(string_view, unsigned short) noexcept;
|
||||
void apply_port(core::string_view, unsigned short) noexcept;
|
||||
void apply_authority(authority_view const&) noexcept;
|
||||
void apply_path(pct_string_view, std::size_t) noexcept;
|
||||
void apply_query(pct_string_view, std::size_t) noexcept;
|
||||
@@ -94,7 +94,7 @@ struct url_impl : parts_base
|
||||
//------------------------------------------------
|
||||
|
||||
// this allows a path to come from a
|
||||
// url_impl or a separate string_view
|
||||
// url_impl or a separate core::string_view
|
||||
class path_ref
|
||||
: private parts_base
|
||||
{
|
||||
@@ -107,7 +107,7 @@ class path_ref
|
||||
public:
|
||||
path_ref() = default;
|
||||
path_ref(url_impl const& impl) noexcept;
|
||||
path_ref(string_view,
|
||||
path_ref(core::string_view,
|
||||
std::size_t, std::size_t) noexcept;
|
||||
pct_string_view buffer() const noexcept;
|
||||
std::size_t size() const noexcept;
|
||||
@@ -139,7 +139,7 @@ public:
|
||||
//------------------------------------------------
|
||||
|
||||
// this allows a params to come from a
|
||||
// url_impl or a separate string_view
|
||||
// url_impl or a separate core::string_view
|
||||
class query_ref
|
||||
: private parts_base
|
||||
{
|
||||
@@ -152,7 +152,7 @@ class query_ref
|
||||
|
||||
public:
|
||||
query_ref(
|
||||
string_view s, // buffer, no '?'
|
||||
core::string_view s, // buffer, no '?'
|
||||
std::size_t dn, // decoded size
|
||||
std::size_t nparam
|
||||
) noexcept;
|
||||
@@ -230,7 +230,7 @@ offset(int id) const noexcept ->
|
||||
|
||||
// return id as string
|
||||
inline
|
||||
string_view
|
||||
core::string_view
|
||||
url_impl::
|
||||
get(int id) const noexcept
|
||||
{
|
||||
@@ -240,7 +240,7 @@ get(int id) const noexcept
|
||||
|
||||
// return [first, last) as string
|
||||
inline
|
||||
string_view
|
||||
core::string_view
|
||||
url_impl::
|
||||
get(int first,
|
||||
int last) const noexcept
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
#include <boost/url/detail/format_args.hpp>
|
||||
#include <boost/url/detail/pattern.hpp>
|
||||
#include <boost/url/string_view.hpp>
|
||||
#include <boost/core/detail/string_view.hpp>
|
||||
#include <boost/url/url.hpp>
|
||||
|
||||
namespace boost {
|
||||
@@ -23,7 +23,7 @@ inline
|
||||
void
|
||||
vformat_to(
|
||||
url_base& u,
|
||||
string_view fmt,
|
||||
core::string_view fmt,
|
||||
detail::format_args args)
|
||||
{
|
||||
parse_pattern(fmt)
|
||||
@@ -33,7 +33,7 @@ vformat_to(
|
||||
inline
|
||||
url
|
||||
vformat(
|
||||
string_view fmt,
|
||||
core::string_view fmt,
|
||||
detail::format_args args)
|
||||
{
|
||||
url u;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
#include <boost/url/detail/config.hpp>
|
||||
#include <boost/url/encoding_opts.hpp>
|
||||
#include <boost/url/string_view.hpp>
|
||||
#include <boost/core/detail/string_view.hpp>
|
||||
#include <boost/url/grammar/all_chars.hpp>
|
||||
#include <boost/url/grammar/string_token.hpp>
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace urls {
|
||||
template<class CharSet>
|
||||
std::size_t
|
||||
encoded_size(
|
||||
string_view s,
|
||||
core::string_view s,
|
||||
CharSet const& unreserved,
|
||||
encoding_opts opt = {}) noexcept;
|
||||
|
||||
@@ -119,7 +119,7 @@ std::size_t
|
||||
encode(
|
||||
char* dest,
|
||||
std::size_t size,
|
||||
string_view s,
|
||||
core::string_view s,
|
||||
CharSet const& unreserved,
|
||||
encoding_opts opt = {});
|
||||
|
||||
@@ -130,7 +130,7 @@ std::size_t
|
||||
encode_unsafe(
|
||||
char* dest,
|
||||
std::size_t size,
|
||||
string_view s,
|
||||
core::string_view s,
|
||||
CharSet const& unreserved,
|
||||
encoding_opts opt);
|
||||
#endif
|
||||
@@ -183,7 +183,7 @@ template<
|
||||
class CharSet>
|
||||
BOOST_URL_STRTOK_RETURN
|
||||
encode(
|
||||
string_view s,
|
||||
core::string_view s,
|
||||
CharSet const& unreserved,
|
||||
encoding_opts opt = {},
|
||||
BOOST_URL_STRTOK_ARG(token)) noexcept;
|
||||
|
||||
@@ -22,34 +22,161 @@ namespace urls {
|
||||
namespace error_types {
|
||||
#endif
|
||||
|
||||
/// The type of error category used by the library
|
||||
using error_category = boost::system::error_category;
|
||||
/** The type of error category used by the library
|
||||
|
||||
/// The type of error code used by the library
|
||||
using error_code = boost::system::error_code;
|
||||
@note This alias is no longer supported and
|
||||
should not be used in new code. Please use
|
||||
`core::string_view` instead.
|
||||
|
||||
/// The type of error condition used by the library
|
||||
using error_condition = boost::system::error_condition;
|
||||
This alias is included for backwards
|
||||
compatibility with earlier versions of the
|
||||
library.
|
||||
|
||||
/// The type of system error thrown by the library
|
||||
using system_error = boost::system::system_error;
|
||||
However, it will be removed in future releases,
|
||||
and using it in new code is not recommended.
|
||||
|
||||
/// A function to return the generic error category used by the library
|
||||
Please use the updated version instead to
|
||||
ensure compatibility with future versions of
|
||||
the library.
|
||||
|
||||
*/
|
||||
using error_category
|
||||
BOOST_URL_DEPRECATED("Use system::error_category instead") =
|
||||
boost::system::error_category;
|
||||
|
||||
/** The type of error code used by the library
|
||||
|
||||
@note This alias is no longer supported and
|
||||
should not be used in new code. Please use
|
||||
`core::string_view` instead.
|
||||
|
||||
This alias is included for backwards
|
||||
compatibility with earlier versions of the
|
||||
library.
|
||||
|
||||
However, it will be removed in future releases,
|
||||
and using it in new code is not recommended.
|
||||
|
||||
Please use the updated version instead to
|
||||
ensure compatibility with future versions of
|
||||
the library.
|
||||
|
||||
*/
|
||||
using error_code
|
||||
BOOST_URL_DEPRECATED("Use system::error_code instead") =
|
||||
boost::system::error_code;
|
||||
|
||||
/** The type of error condition used by the library
|
||||
|
||||
@note This alias is no longer supported and
|
||||
should not be used in new code. Please use
|
||||
`core::string_view` instead.
|
||||
|
||||
This alias is included for backwards
|
||||
compatibility with earlier versions of the
|
||||
library.
|
||||
|
||||
However, it will be removed in future releases,
|
||||
and using it in new code is not recommended.
|
||||
|
||||
Please use the updated version instead to
|
||||
ensure compatibility with future versions of
|
||||
the library.
|
||||
|
||||
*/
|
||||
using error_condition
|
||||
BOOST_URL_DEPRECATED("Use system::error_condition instead") =
|
||||
boost::system::error_condition;
|
||||
|
||||
/** The type of system error thrown by the library
|
||||
|
||||
@note This alias is no longer supported and
|
||||
should not be used in new code. Please use
|
||||
`core::string_view` instead.
|
||||
|
||||
This alias is included for backwards
|
||||
compatibility with earlier versions of the
|
||||
library.
|
||||
|
||||
However, it will be removed in future releases,
|
||||
and using it in new code is not recommended.
|
||||
|
||||
Please use the updated version instead to
|
||||
ensure compatibility with future versions of
|
||||
the library.
|
||||
|
||||
*/
|
||||
using system_error
|
||||
BOOST_URL_DEPRECATED("Use system::system_error instead") =
|
||||
boost::system::system_error;
|
||||
|
||||
/** A function to return the generic error category used by the library
|
||||
|
||||
@note This alias is no longer supported and
|
||||
should not be used in new code. Please use
|
||||
`core::string_view` instead.
|
||||
|
||||
This alias is included for backwards
|
||||
compatibility with earlier versions of the
|
||||
library.
|
||||
|
||||
However, it will be removed in future releases,
|
||||
and using it in new code is not recommended.
|
||||
|
||||
Please use the updated version instead to
|
||||
ensure compatibility with future versions of
|
||||
the library.
|
||||
|
||||
*/
|
||||
#ifdef BOOST_URL_DOCS
|
||||
error_category const& generic_category();
|
||||
#else
|
||||
using boost::system::generic_category;
|
||||
#endif
|
||||
|
||||
/// A function to return the system error category used by the library
|
||||
#if BOOST_URL_DOCS
|
||||
/** A function to return the system error category used by the library
|
||||
|
||||
@note This alias is no longer supported and
|
||||
should not be used in new code. Please use
|
||||
`core::string_view` instead.
|
||||
|
||||
This alias is included for backwards
|
||||
compatibility with earlier versions of the
|
||||
library.
|
||||
|
||||
However, it will be removed in future releases,
|
||||
and using it in new code is not recommended.
|
||||
|
||||
Please use the updated version instead to
|
||||
ensure compatibility with future versions of
|
||||
the library.
|
||||
|
||||
*/
|
||||
#ifdef BOOST_URL_DOCS
|
||||
error_category const& system_category();
|
||||
#else
|
||||
using boost::system::system_category;
|
||||
#endif
|
||||
|
||||
/// The set of constants used for cross-platform error codes
|
||||
#if BOOST_URL_DOCS
|
||||
/** The set of constants used for cross-platform error codes
|
||||
|
||||
@note This alias is no longer supported and
|
||||
should not be used in new code. Please use
|
||||
`core::string_view` instead.
|
||||
|
||||
This alias is included for backwards
|
||||
compatibility with earlier versions of the
|
||||
library.
|
||||
|
||||
However, it will be removed in future releases,
|
||||
and using it in new code is not recommended.
|
||||
|
||||
Please use the updated version instead to
|
||||
ensure compatibility with future versions of
|
||||
the library.
|
||||
|
||||
*/
|
||||
#ifdef BOOST_URL_DOCS
|
||||
enum errc
|
||||
{
|
||||
__see_below__
|
||||
@@ -60,7 +187,22 @@ namespace errc = boost::system::errc;
|
||||
|
||||
/** The type of result returned by library functions
|
||||
|
||||
This is an alias template used as the return type
|
||||
@note This alias is no longer supported and
|
||||
should not be used in new code. Please use
|
||||
`core::string_view` instead.
|
||||
|
||||
This alias is included for backwards
|
||||
compatibility with earlier versions of the
|
||||
library.
|
||||
|
||||
However, it will be removed in future releases,
|
||||
and using it in new code is not recommended.
|
||||
|
||||
Please use the updated version instead to
|
||||
ensure compatibility with future versions of
|
||||
the library.
|
||||
|
||||
@details This is an alias template used as the return type
|
||||
for functions that can either return a container,
|
||||
or fail with an error code. This is a brief
|
||||
synopsis of the type:
|
||||
@@ -79,7 +221,7 @@ namespace errc = boost::system::errc;
|
||||
//
|
||||
// Return the error
|
||||
//
|
||||
constexpr error_code error() const noexcept;
|
||||
constexpr system::error_code error() const noexcept;
|
||||
|
||||
//
|
||||
// Return true if the result contains a value
|
||||
@@ -107,7 +249,7 @@ namespace errc = boost::system::errc;
|
||||
@par Usage
|
||||
Given the function @ref parse_uri with this signature:
|
||||
@code
|
||||
result< url_view > parse_uri( string_view s ) noexcept;
|
||||
system::result< url_view > parse_uri( core::string_view s ) noexcept;
|
||||
@endcode
|
||||
|
||||
The following statement captures the value in a
|
||||
@@ -119,7 +261,7 @@ namespace errc = boost::system::errc;
|
||||
This statement captures the result in a local
|
||||
variable and inspects the error condition:
|
||||
@code
|
||||
result< url_view > rv = parse_uri( "http://example.com/path/to/file.txt" );
|
||||
system::result< url_view > rv = parse_uri( "http://example.com/path/to/file.txt" );
|
||||
|
||||
if(! rv )
|
||||
std::cout << rv.error();
|
||||
@@ -135,7 +277,9 @@ namespace errc = boost::system::errc;
|
||||
|
||||
*/
|
||||
template<class T>
|
||||
using result = boost::system::result<T, error_code>;
|
||||
using result
|
||||
BOOST_URL_DEPRECATED("Use system::result<T> instead") =
|
||||
boost::system::result<T, system::error_code>;
|
||||
|
||||
#ifndef BOOST_URL_DOCS
|
||||
} // error_types
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#define BOOST_URL_FORMAT_HPP
|
||||
|
||||
#include <boost/url/detail/config.hpp>
|
||||
#include <boost/url/string_view.hpp>
|
||||
#include <boost/core/detail/string_view.hpp>
|
||||
#include <boost/url/url.hpp>
|
||||
#include <boost/url/detail/vformat.hpp>
|
||||
#include <initializer_list>
|
||||
@@ -90,7 +90,7 @@ namespace urls {
|
||||
template <class... Args>
|
||||
url
|
||||
format(
|
||||
string_view fmt,
|
||||
core::string_view fmt,
|
||||
Args&&... args)
|
||||
{
|
||||
return detail::vformat(
|
||||
@@ -174,7 +174,7 @@ template <class... Args>
|
||||
void
|
||||
format_to(
|
||||
url_base& u,
|
||||
string_view fmt,
|
||||
core::string_view fmt,
|
||||
Args&&... args)
|
||||
{
|
||||
detail::vformat_to(
|
||||
@@ -262,7 +262,7 @@ format_to(
|
||||
inline
|
||||
url
|
||||
format(
|
||||
string_view fmt,
|
||||
core::string_view fmt,
|
||||
#ifdef BOOST_URL_DOCS
|
||||
std::initializer_list<__see_below__> args
|
||||
#else
|
||||
@@ -360,7 +360,7 @@ inline
|
||||
void
|
||||
format_to(
|
||||
url_base& u,
|
||||
string_view fmt,
|
||||
core::string_view fmt,
|
||||
#ifdef BOOST_URL_DOCS
|
||||
std::initializer_list<__see_below__> args
|
||||
#else
|
||||
@@ -405,7 +405,7 @@ __implementation_defined__
|
||||
#else
|
||||
detail::named_arg<T>
|
||||
#endif
|
||||
arg(string_view name, T const& arg)
|
||||
arg(core::string_view name, T const& arg)
|
||||
{
|
||||
return {name, arg};
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace grammar {
|
||||
Character sets are used with rules and the
|
||||
functions @ref find_if and @ref find_if_not.
|
||||
@code
|
||||
result< string_view > rv = parse( "JohnDoe", token_rule( all_chars ) );
|
||||
system::result< core::string_view > rv = parse( "JohnDoe", token_rule( all_chars ) );
|
||||
@endcode
|
||||
|
||||
@par BNF
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace grammar {
|
||||
Character sets are used with rules and the
|
||||
functions @ref find_if and @ref find_if_not.
|
||||
@code
|
||||
result< string_view > = parse( "Johnny42", token_rule( alnumchars ) );
|
||||
system::result< core::string_view > = parse( "Johnny42", token_rule( alnumchars ) );
|
||||
@endcode
|
||||
|
||||
@par BNF
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace grammar {
|
||||
Character sets are used with rules and the
|
||||
functions @ref find_if and @ref find_if_not.
|
||||
@code
|
||||
result< string_view > rv = parse( "JohnDoe", token_rule( alpha_chars ) );
|
||||
system::result< core::string_view > rv = parse( "JohnDoe", token_rule( alpha_chars ) );
|
||||
@endcode
|
||||
|
||||
@par BNF
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#define BOOST_URL_GRAMMAR_CI_STRING_HPP
|
||||
|
||||
#include <boost/url/detail/config.hpp>
|
||||
#include <boost/url/string_view.hpp>
|
||||
#include <boost/core/detail/string_view.hpp>
|
||||
#include <boost/url/grammar/detail/ci_string.hpp>
|
||||
#include <cstdlib>
|
||||
|
||||
@@ -119,8 +119,8 @@ to_upper(char c) noexcept
|
||||
BOOST_URL_DECL
|
||||
int
|
||||
ci_compare(
|
||||
string_view s0,
|
||||
string_view s1) noexcept;
|
||||
core::string_view s0,
|
||||
core::string_view s1) noexcept;
|
||||
|
||||
/** Return the case-insensitive digest of a string
|
||||
|
||||
@@ -139,7 +139,7 @@ ci_compare(
|
||||
BOOST_URL_DECL
|
||||
std::size_t
|
||||
ci_digest(
|
||||
string_view s) noexcept;
|
||||
core::string_view s) noexcept;
|
||||
|
||||
//------------------------------------------------
|
||||
|
||||
@@ -176,13 +176,13 @@ ci_is_equal(
|
||||
String1 const& s1) ->
|
||||
typename std::enable_if<
|
||||
! std::is_convertible<
|
||||
String0, string_view>::value ||
|
||||
String0, core::string_view>::value ||
|
||||
! std::is_convertible<
|
||||
String1, string_view>::value,
|
||||
String1, core::string_view>::value,
|
||||
bool>::type
|
||||
{
|
||||
// this overload supports forward iterators and
|
||||
// does not assume the existence string_view::size
|
||||
// does not assume the existence core::string_view::size
|
||||
if( detail::type_id<String0>() >
|
||||
detail::type_id<String1>())
|
||||
return detail::ci_is_equal(s1, s0);
|
||||
@@ -192,11 +192,11 @@ ci_is_equal(
|
||||
inline
|
||||
bool
|
||||
ci_is_equal(
|
||||
string_view s0,
|
||||
string_view s1) noexcept
|
||||
core::string_view s0,
|
||||
core::string_view s1) noexcept
|
||||
{
|
||||
// this overload is faster as it makes use of
|
||||
// string_view::size
|
||||
// core::string_view::size
|
||||
if(s0.size() != s1.size())
|
||||
return false;
|
||||
return detail::ci_is_equal(s0, s1);
|
||||
@@ -224,8 +224,8 @@ ci_is_equal(
|
||||
inline
|
||||
bool
|
||||
ci_is_less(
|
||||
string_view s0,
|
||||
string_view s1) noexcept
|
||||
core::string_view s0,
|
||||
core::string_view s1) noexcept
|
||||
{
|
||||
if(s0.size() != s1.size())
|
||||
return s0.size() < s1.size();
|
||||
@@ -264,7 +264,7 @@ struct ci_hash
|
||||
|
||||
std::size_t
|
||||
operator()(
|
||||
string_view s) const noexcept
|
||||
core::string_view s) const noexcept
|
||||
{
|
||||
return ci_digest(s);
|
||||
}
|
||||
@@ -341,8 +341,8 @@ struct ci_less
|
||||
|
||||
std::size_t
|
||||
operator()(
|
||||
string_view s0,
|
||||
string_view s1) const noexcept
|
||||
core::string_view s0,
|
||||
core::string_view s1) const noexcept
|
||||
{
|
||||
return ci_is_less(s0, s1);
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace grammar {
|
||||
@par Example
|
||||
Rules are used with the function @ref parse.
|
||||
@code
|
||||
result< unsigned char > rv = parse( "255", dec_octet_rule );
|
||||
system::result< unsigned char > rv = parse( "255", dec_octet_rule );
|
||||
@endcode
|
||||
|
||||
@par BNF
|
||||
@@ -63,7 +63,7 @@ struct dec_octet_rule_t
|
||||
char const*& it,
|
||||
char const* end
|
||||
) const noexcept ->
|
||||
result<value_type>;
|
||||
system::result<value_type>;
|
||||
};
|
||||
|
||||
constexpr dec_octet_rule_t dec_octet_rule{};
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#define BOOST_URL_GRAMMAR_DELIM_RULE_HPP
|
||||
|
||||
#include <boost/url/detail/config.hpp>
|
||||
#include <boost/url/string_view.hpp>
|
||||
#include <boost/core/detail/string_view.hpp>
|
||||
#include <boost/url/grammar/charset.hpp>
|
||||
#include <boost/url/grammar/error.hpp>
|
||||
#include <boost/url/grammar/type_traits.hpp>
|
||||
@@ -26,20 +26,20 @@ namespace grammar {
|
||||
This matches the specified character.
|
||||
The value is a reference to the character
|
||||
in the underlying buffer, expressed as a
|
||||
@ref string_view. The function @ref squelch
|
||||
@ref core::string_view. The function @ref squelch
|
||||
may be used to turn this into `void` instead.
|
||||
If there is no more input, the error code
|
||||
@ref error::need_more is returned.
|
||||
|
||||
@par Value Type
|
||||
@code
|
||||
using value_type = string_view;
|
||||
using value_type = core::string_view;
|
||||
@endcode
|
||||
|
||||
@par Example
|
||||
Rules are used with the function @ref parse.
|
||||
@code
|
||||
result< string_view > rv = parse( ".", delim_rule('.') );
|
||||
system::result< core::string_view > rv = parse( ".", delim_rule('.') );
|
||||
@endcode
|
||||
|
||||
@par BNF
|
||||
@@ -60,7 +60,7 @@ delim_rule( char ch ) noexcept;
|
||||
#else
|
||||
struct ch_delim_rule
|
||||
{
|
||||
using value_type = string_view;
|
||||
using value_type = core::string_view;
|
||||
|
||||
constexpr
|
||||
ch_delim_rule(char ch) noexcept
|
||||
@@ -69,7 +69,7 @@ struct ch_delim_rule
|
||||
}
|
||||
|
||||
BOOST_URL_DECL
|
||||
result<value_type>
|
||||
system::result<value_type>
|
||||
parse(
|
||||
char const*& it,
|
||||
char const* end) const noexcept;
|
||||
@@ -94,20 +94,20 @@ delim_rule( char ch ) noexcept
|
||||
belongs to the specified character set.
|
||||
The value is a reference to the character
|
||||
in the underlying buffer, expressed as a
|
||||
@ref string_view. The function @ref squelch
|
||||
@ref core::string_view. The function @ref squelch
|
||||
may be used to turn this into `void` instead.
|
||||
If there is no more input, the error code
|
||||
@ref error::need_more is returned.
|
||||
|
||||
@par Value Type
|
||||
@code
|
||||
using value_type = string_view;
|
||||
using value_type = core::string_view;
|
||||
@endcode
|
||||
|
||||
@par Example
|
||||
Rules are used with the function @ref parse.
|
||||
@code
|
||||
result< string_view > rv = parse( "X", delim_rule( alpha_chars ) );
|
||||
system::result< core::string_view > rv = parse( "X", delim_rule( alpha_chars ) );
|
||||
@endcode
|
||||
|
||||
@param cs The character set to use.
|
||||
@@ -126,7 +126,7 @@ delim_rule( CharSet const& cs ) noexcept;
|
||||
template<class CharSet>
|
||||
struct cs_delim_rule
|
||||
{
|
||||
using value_type = string_view;
|
||||
using value_type = core::string_view;
|
||||
|
||||
constexpr
|
||||
cs_delim_rule(
|
||||
@@ -135,7 +135,7 @@ struct cs_delim_rule
|
||||
{
|
||||
}
|
||||
|
||||
result<value_type>
|
||||
system::result<value_type>
|
||||
parse(
|
||||
char const*& it,
|
||||
char const* end) const noexcept
|
||||
@@ -152,7 +152,7 @@ struct cs_delim_rule
|
||||
BOOST_URL_RETURN_EC(
|
||||
error::mismatch);
|
||||
}
|
||||
return string_view{
|
||||
return core::string_view{
|
||||
it++, 1 };
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#ifndef BOOST_URL_GRAMMAR_DETAIL_CI_STRING_HPP
|
||||
#define BOOST_URL_GRAMMAR_DETAIL_CI_STRING_HPP
|
||||
|
||||
#include <boost/url/string_view.hpp>
|
||||
#include <boost/core/detail/string_view.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <cstdint>
|
||||
#include <iterator>
|
||||
@@ -111,9 +111,9 @@ ci_is_equal(
|
||||
S1 const& s1) ->
|
||||
typename std::enable_if<
|
||||
! std::is_convertible<
|
||||
S0, string_view>::value ||
|
||||
S0, core::string_view>::value ||
|
||||
! std::is_convertible<
|
||||
S1, string_view>::value,
|
||||
S1, core::string_view>::value,
|
||||
bool>::type
|
||||
{
|
||||
/* If you get a compile error here, it
|
||||
@@ -162,14 +162,14 @@ ci_is_equal(
|
||||
BOOST_URL_DECL
|
||||
bool
|
||||
ci_is_equal(
|
||||
string_view s0,
|
||||
string_view s1) noexcept;
|
||||
core::string_view s0,
|
||||
core::string_view s1) noexcept;
|
||||
|
||||
BOOST_URL_DECL
|
||||
bool
|
||||
ci_is_less(
|
||||
string_view s0,
|
||||
string_view s1) noexcept;
|
||||
core::string_view s0,
|
||||
core::string_view s1) noexcept;
|
||||
|
||||
} // detail
|
||||
} // grammar
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace grammar {
|
||||
Character sets are used with rules and the
|
||||
functions @ref find_if and @ref find_if_not.
|
||||
@code
|
||||
result< string_view > rv = parse( "2022", token_rule( digit_chars ) );
|
||||
system::result< core::string_view > rv = parse( "2022", token_rule( digit_chars ) );
|
||||
@endcode
|
||||
|
||||
@par BNF
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace grammar {
|
||||
Character sets are used with rules and the
|
||||
functions @ref find_if and @ref find_if_not.
|
||||
@code
|
||||
result< string_view > rv = parse( "8086FC19", token_rule( hexdig_chars ) );
|
||||
system::result< core::string_view > rv = parse( "8086FC19", token_rule( hexdig_chars ) );
|
||||
@endcode
|
||||
|
||||
@par BNF
|
||||
|
||||
@@ -23,7 +23,7 @@ not_empty_rule_t<R>::
|
||||
parse(
|
||||
char const*& it,
|
||||
char const* end) const ->
|
||||
result<value_type>
|
||||
system::result<value_type>
|
||||
{
|
||||
if(it == end)
|
||||
{
|
||||
|
||||
@@ -22,7 +22,7 @@ optional_rule_t<R>::
|
||||
parse(
|
||||
char const*& it,
|
||||
char const* end) const ->
|
||||
result<value_type>
|
||||
system::result<value_type>
|
||||
{
|
||||
if(it == end)
|
||||
return boost::none;
|
||||
|
||||
@@ -24,7 +24,7 @@ parse(
|
||||
char const*& it,
|
||||
char const* end,
|
||||
R const& r) ->
|
||||
result<typename R::value_type>
|
||||
system::result<typename R::value_type>
|
||||
{
|
||||
// If this goes off, it means the rule
|
||||
// passed in did not meet the requirements.
|
||||
@@ -40,9 +40,9 @@ template<class R>
|
||||
BOOST_URL_NO_INLINE
|
||||
auto
|
||||
parse(
|
||||
string_view s,
|
||||
core::string_view s,
|
||||
R const& r) ->
|
||||
result<typename R::value_type>
|
||||
system::result<typename R::value_type>
|
||||
{
|
||||
// If this goes off, it means the rule
|
||||
// passed in did not meet the requirements.
|
||||
|
||||
@@ -59,21 +59,21 @@ struct range<T>::
|
||||
}
|
||||
|
||||
virtual
|
||||
result<T>
|
||||
system::result<T>
|
||||
first(
|
||||
char const*&,
|
||||
char const*) const noexcept
|
||||
{
|
||||
return error_code{};
|
||||
return system::error_code{};
|
||||
}
|
||||
|
||||
virtual
|
||||
result<T>
|
||||
system::result<T>
|
||||
next(
|
||||
char const*&,
|
||||
char const*) const noexcept
|
||||
{
|
||||
return error_code{};
|
||||
return system::error_code{};
|
||||
}
|
||||
};
|
||||
|
||||
@@ -113,7 +113,7 @@ private:
|
||||
::new(dest) impl1(*this);
|
||||
}
|
||||
|
||||
result<T>
|
||||
system::result<T>
|
||||
first(
|
||||
char const*& it,
|
||||
char const* end)
|
||||
@@ -123,7 +123,7 @@ private:
|
||||
it, end, this->get());
|
||||
}
|
||||
|
||||
result<T>
|
||||
system::result<T>
|
||||
next(
|
||||
char const*& it,
|
||||
char const* end)
|
||||
@@ -188,7 +188,7 @@ private:
|
||||
::new(dest) impl1(*this);
|
||||
}
|
||||
|
||||
result<T>
|
||||
system::result<T>
|
||||
first(
|
||||
char const*& it,
|
||||
char const* end)
|
||||
@@ -198,7 +198,7 @@ private:
|
||||
it, end, this->get().r);
|
||||
}
|
||||
|
||||
result<T>
|
||||
system::result<T>
|
||||
next(
|
||||
char const*& it,
|
||||
char const* end)
|
||||
@@ -249,7 +249,7 @@ private:
|
||||
::new(dest) impl2(*this);
|
||||
}
|
||||
|
||||
result<T>
|
||||
system::result<T>
|
||||
first(
|
||||
char const*& it,
|
||||
char const* end)
|
||||
@@ -260,7 +260,7 @@ private:
|
||||
R0,0>::get());
|
||||
}
|
||||
|
||||
result<T>
|
||||
system::result<T>
|
||||
next(
|
||||
char const*& it,
|
||||
char const* end)
|
||||
@@ -330,7 +330,7 @@ private:
|
||||
::new(dest) impl2(*this);
|
||||
}
|
||||
|
||||
result<T>
|
||||
system::result<T>
|
||||
first(
|
||||
char const*& it,
|
||||
char const* end)
|
||||
@@ -340,7 +340,7 @@ private:
|
||||
it, end, get().first);
|
||||
}
|
||||
|
||||
result<T>
|
||||
system::result<T>
|
||||
next(
|
||||
char const*& it,
|
||||
char const* end)
|
||||
@@ -427,7 +427,7 @@ private:
|
||||
|
||||
range<T> const* r_ = nullptr;
|
||||
char const* p_ = nullptr;
|
||||
result<T> rv_;
|
||||
system::result<T> rv_;
|
||||
|
||||
iterator(
|
||||
range<T> const& r) noexcept
|
||||
@@ -458,7 +458,7 @@ template<class T>
|
||||
template<class R>
|
||||
range<T>::
|
||||
range(
|
||||
string_view s,
|
||||
core::string_view s,
|
||||
std::size_t n,
|
||||
R const& next)
|
||||
: s_(s)
|
||||
@@ -480,7 +480,7 @@ template<
|
||||
class R0, class R1>
|
||||
range<T>::
|
||||
range(
|
||||
string_view s,
|
||||
core::string_view s,
|
||||
std::size_t n,
|
||||
R0 const& first,
|
||||
R1 const& next)
|
||||
@@ -604,7 +604,7 @@ range_rule_t<R>::
|
||||
parse(
|
||||
char const*& it,
|
||||
char const* end) const ->
|
||||
result<value_type>
|
||||
system::result<value_type>
|
||||
{
|
||||
using T = typename R::value_type;
|
||||
|
||||
@@ -628,7 +628,7 @@ parse(
|
||||
}
|
||||
// good
|
||||
return range<T>(
|
||||
string_view(it0, it - it0),
|
||||
core::string_view(it0, it - it0),
|
||||
n, next_);
|
||||
}
|
||||
for(;;)
|
||||
@@ -661,7 +661,7 @@ parse(
|
||||
}
|
||||
// good
|
||||
return range<T>(
|
||||
string_view(it0, it - it0),
|
||||
core::string_view(it0, it - it0),
|
||||
n, next_);
|
||||
}
|
||||
|
||||
@@ -673,7 +673,7 @@ range_rule_t<R0, R1>::
|
||||
parse(
|
||||
char const*& it,
|
||||
char const* end) const ->
|
||||
result<range<typename
|
||||
system::result<range<typename
|
||||
R0::value_type>>
|
||||
{
|
||||
using T = typename R0::value_type;
|
||||
@@ -698,7 +698,7 @@ parse(
|
||||
}
|
||||
// good
|
||||
return range<T>(
|
||||
string_view(it0, it - it0),
|
||||
core::string_view(it0, it - it0),
|
||||
n, first_, next_);
|
||||
}
|
||||
for(;;)
|
||||
@@ -731,7 +731,7 @@ parse(
|
||||
}
|
||||
// good
|
||||
return range<T>(
|
||||
string_view(it0, it - it0),
|
||||
core::string_view(it0, it - it0),
|
||||
n, first_, next_);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ parse(
|
||||
char const*& it,
|
||||
char const* end
|
||||
) const noexcept ->
|
||||
result<value_type>
|
||||
system::result<value_type>
|
||||
{
|
||||
auto const it0 = it;
|
||||
if(it == end)
|
||||
@@ -33,7 +33,7 @@ parse(
|
||||
}
|
||||
it = (find_if_not)(it, end, cs_);
|
||||
if(it != it0)
|
||||
return string_view(it0, it - it0);
|
||||
return core::string_view(it0, it - it0);
|
||||
BOOST_URL_RETURN_EC(
|
||||
error::mismatch);
|
||||
}
|
||||
|
||||
@@ -36,15 +36,15 @@ struct parse_sequence
|
||||
|
||||
using V = mp11::mp_remove<
|
||||
std::tuple<
|
||||
result<typename R0::value_type>,
|
||||
result<typename Rn::value_type>...>,
|
||||
result<void>>;
|
||||
system::result<typename R0::value_type>,
|
||||
system::result<typename Rn::value_type>...>,
|
||||
system::result<void>>;
|
||||
|
||||
template<std::size_t I>
|
||||
using is_void = std::is_same<
|
||||
mp11::mp_at_c<L, I>, void>;
|
||||
|
||||
error_code ec;
|
||||
system::error_code ec;
|
||||
R const& rn;
|
||||
V vn;
|
||||
|
||||
@@ -53,7 +53,7 @@ struct parse_sequence
|
||||
R const& rn_) noexcept
|
||||
: rn(rn_)
|
||||
, vn(mp11::mp_fill<
|
||||
V, error_code>{})
|
||||
V, system::error_code>{})
|
||||
{
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ struct parse_sequence
|
||||
{
|
||||
}
|
||||
|
||||
// for result<void>
|
||||
// for system::result<void>
|
||||
template<
|
||||
std::size_t Ir,
|
||||
std::size_t Iv>
|
||||
@@ -77,7 +77,7 @@ struct parse_sequence
|
||||
mp11::mp_size_t<Iv> const&,
|
||||
mp11::mp_true const&)
|
||||
{
|
||||
result<void> rv =
|
||||
system::result<void> rv =
|
||||
grammar::parse(
|
||||
it, end, get<Ir>(rn));
|
||||
if( !rv )
|
||||
@@ -142,7 +142,7 @@ struct parse_sequence
|
||||
|
||||
auto
|
||||
make_result() noexcept ->
|
||||
result<typename tuple_rule_t<
|
||||
system::result<typename tuple_rule_t<
|
||||
R0, Rn...>::value_type>
|
||||
{
|
||||
if(ec.failed())
|
||||
@@ -165,9 +165,9 @@ struct parse_sequence<false, R0, Rn...>
|
||||
using V = mp11::mp_first<
|
||||
mp11::mp_remove<
|
||||
mp11::mp_list<
|
||||
result<typename R0::value_type>,
|
||||
result<typename Rn::value_type>...>,
|
||||
result<void>>>;
|
||||
system::result<typename R0::value_type>,
|
||||
system::result<typename Rn::value_type>...>,
|
||||
system::result<void>>>;
|
||||
|
||||
template<std::size_t I>
|
||||
using is_void = std::is_same<
|
||||
@@ -180,7 +180,7 @@ struct parse_sequence<false, R0, Rn...>
|
||||
parse_sequence(
|
||||
R const& rn_) noexcept
|
||||
: rn(rn_)
|
||||
, v(error_code{})
|
||||
, v(system::error_code{})
|
||||
{
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@ struct parse_sequence<false, R0, Rn...>
|
||||
{
|
||||
}
|
||||
|
||||
// for result<void>
|
||||
// for system::result<void>
|
||||
template<
|
||||
std::size_t Ir,
|
||||
std::size_t Iv>
|
||||
@@ -205,7 +205,7 @@ struct parse_sequence<false, R0, Rn...>
|
||||
mp11::mp_size_t<Iv> const&,
|
||||
mp11::mp_true const&)
|
||||
{
|
||||
result<void> rv =
|
||||
system::result<void> rv =
|
||||
grammar::parse(
|
||||
it, end, get<Ir>(rn));
|
||||
if( !rv )
|
||||
@@ -270,7 +270,7 @@ tuple_rule_t<R0, Rn...>::
|
||||
parse(
|
||||
char const*& it,
|
||||
char const* end) const ->
|
||||
result<value_type>
|
||||
system::result<value_type>
|
||||
{
|
||||
detail::parse_sequence<
|
||||
IsList, R0, Rn...> t(this->get());
|
||||
|
||||
@@ -25,7 +25,7 @@ parse(
|
||||
char const*& it,
|
||||
char const* end
|
||||
) const noexcept ->
|
||||
result<value_type>
|
||||
system::result<value_type>
|
||||
{
|
||||
if(it == end)
|
||||
{
|
||||
|
||||
@@ -35,7 +35,7 @@ parse_variant(
|
||||
std::integral_constant<
|
||||
std::size_t, I> const&,
|
||||
std::false_type const&) ->
|
||||
result<variant<
|
||||
system::result<variant<
|
||||
typename R0::value_type,
|
||||
typename Rn::value_type...>>
|
||||
{
|
||||
@@ -57,7 +57,7 @@ parse_variant(
|
||||
std::integral_constant<
|
||||
std::size_t, I> const&,
|
||||
std::true_type const&) ->
|
||||
result<variant<
|
||||
system::result<variant<
|
||||
typename R0::value_type,
|
||||
typename Rn::value_type...>>
|
||||
{
|
||||
@@ -87,7 +87,7 @@ variant_rule_t<R0, Rn...>::
|
||||
parse(
|
||||
char const*& it,
|
||||
char const* end) const ->
|
||||
result<value_type>
|
||||
system::result<value_type>
|
||||
{
|
||||
return detail::parse_variant(
|
||||
it, end, rn_,
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
#include <boost/url/detail/config.hpp>
|
||||
#include <boost/url/error_types.hpp>
|
||||
#include <boost/url/string_view.hpp>
|
||||
#include <boost/core/detail/string_view.hpp>
|
||||
#include <cstdlib>
|
||||
|
||||
namespace boost {
|
||||
@@ -28,13 +28,13 @@ namespace grammar {
|
||||
|
||||
@par Value Type
|
||||
@code
|
||||
using value_type = string_view;
|
||||
using value_type = core::string_view;
|
||||
@endcode
|
||||
|
||||
@par Example
|
||||
Rules are used with the function @ref parse.
|
||||
@code
|
||||
result< string_view > rv = parse( "HTTP", literal_rule( "HTTP" ) );
|
||||
system::result< core::string_view > rv = parse( "HTTP", literal_rule( "HTTP" ) );
|
||||
@endcode
|
||||
|
||||
@see
|
||||
@@ -62,7 +62,7 @@ class literal_rule
|
||||
}
|
||||
|
||||
public:
|
||||
using value_type = string_view;
|
||||
using value_type = core::string_view;
|
||||
|
||||
constexpr
|
||||
explicit
|
||||
@@ -74,7 +74,7 @@ public:
|
||||
}
|
||||
|
||||
BOOST_URL_DECL
|
||||
result<value_type>
|
||||
system::result<value_type>
|
||||
parse(
|
||||
char const*& it,
|
||||
char const* end) const noexcept;
|
||||
|
||||
@@ -52,7 +52,7 @@ struct is_pred<T, void_t<
|
||||
@code
|
||||
constexpr lut_chars vowel_chars = "AEIOU" "aeiou";
|
||||
|
||||
result< string_view > rv = parse( "Aiea", token_rule( vowel_chars ) );
|
||||
system::result< core::string_view > rv = parse( "Aiea", token_rule( vowel_chars ) );
|
||||
@endcode
|
||||
|
||||
@see
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace grammar {
|
||||
@par Example
|
||||
Rules are used with the function @ref parse.
|
||||
@code
|
||||
result< decode_view > rv = parse( "Program%20Files",
|
||||
system::result< decode_view > rv = parse( "Program%20Files",
|
||||
not_empty_rule( pct_encoded_rule( unreserved_chars ) ) );
|
||||
@endcode
|
||||
|
||||
@@ -59,7 +59,7 @@ struct not_empty_rule_t
|
||||
parse(
|
||||
char const*& it,
|
||||
char const* end) const ->
|
||||
result<value_type>;
|
||||
system::result<value_type>;
|
||||
|
||||
template<class R_>
|
||||
friend
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace grammar {
|
||||
@par Example
|
||||
Rules are used with the function @ref grammar::parse.
|
||||
@code
|
||||
result< optional< string_view > > rv = parse( "", optional_rule( token_rule( alpha_chars ) ) );
|
||||
system::result< optional< core::string_view > > rv = parse( "", optional_rule( token_rule( alpha_chars ) ) );
|
||||
@endcode
|
||||
|
||||
@par BNF
|
||||
@@ -65,10 +65,10 @@ template<class Rule>
|
||||
struct optional_rule_t
|
||||
: private empty_value<Rule>
|
||||
{
|
||||
using value_type = optional<
|
||||
using value_type = boost::optional<
|
||||
typename Rule::value_type>;
|
||||
|
||||
result<value_type>
|
||||
system::result<value_type>
|
||||
parse(
|
||||
char const*& it,
|
||||
char const* end) const;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
#include <boost/url/detail/config.hpp>
|
||||
#include <boost/url/error_types.hpp>
|
||||
#include <boost/url/string_view.hpp>
|
||||
#include <boost/core/detail/string_view.hpp>
|
||||
#include <boost/url/grammar/type_traits.hpp>
|
||||
|
||||
namespace boost {
|
||||
@@ -38,7 +38,7 @@ namespace grammar {
|
||||
@ref result.
|
||||
*/
|
||||
template<class Rule>
|
||||
result<typename Rule::value_type>
|
||||
system::result<typename Rule::value_type>
|
||||
parse(
|
||||
char const*& it,
|
||||
char const* end,
|
||||
@@ -62,9 +62,9 @@ parse(
|
||||
@ref result.
|
||||
*/
|
||||
template<class Rule>
|
||||
result<typename Rule::value_type>
|
||||
system::result<typename Rule::value_type>
|
||||
parse(
|
||||
string_view s,
|
||||
core::string_view s,
|
||||
Rule const& r);
|
||||
|
||||
//------------------------------------------------
|
||||
@@ -80,7 +80,7 @@ struct rule_ref
|
||||
using value_type =
|
||||
typename Rule::value_type;
|
||||
|
||||
result<value_type>
|
||||
system::result<value_type>
|
||||
parse(
|
||||
char const*& it,
|
||||
char const* end) const
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
#include <boost/url/detail/config.hpp>
|
||||
#include <boost/url/error.hpp>
|
||||
#include <boost/url/string_view.hpp>
|
||||
#include <boost/core/detail/string_view.hpp>
|
||||
#include <boost/url/grammar/parse.hpp>
|
||||
#include <boost/url/grammar/type_traits.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
@@ -80,7 +80,7 @@ class range
|
||||
};
|
||||
|
||||
small_buffer sb_;
|
||||
string_view s_;
|
||||
core::string_view s_;
|
||||
std::size_t n_ = 0;
|
||||
|
||||
//--------------------------------------------
|
||||
@@ -115,14 +115,14 @@ class range
|
||||
|
||||
template<class R>
|
||||
range(
|
||||
string_view s,
|
||||
core::string_view s,
|
||||
std::size_t n,
|
||||
R const& r);
|
||||
|
||||
template<
|
||||
class R0, class R1>
|
||||
range(
|
||||
string_view s,
|
||||
core::string_view s,
|
||||
std::size_t n,
|
||||
R0 const& first,
|
||||
R1 const& next);
|
||||
@@ -263,7 +263,7 @@ public:
|
||||
|
||||
/** Return the matching part of the string
|
||||
*/
|
||||
string_view
|
||||
core::string_view
|
||||
string() const noexcept
|
||||
{
|
||||
return s_;
|
||||
@@ -307,7 +307,7 @@ struct range_rule_t;
|
||||
@code
|
||||
// range = 1*( ";" token )
|
||||
|
||||
result< range<string_view> > rv = parse( ";alpha;xray;charlie",
|
||||
system::result< range<core::string_view> > rv = parse( ";alpha;xray;charlie",
|
||||
range_rule(
|
||||
tuple_rule(
|
||||
squelch( delim_rule( ';' ) ),
|
||||
@@ -361,7 +361,7 @@ struct range_rule_t<R>
|
||||
using value_type =
|
||||
range<typename R::value_type>;
|
||||
|
||||
result<value_type>
|
||||
system::result<value_type>
|
||||
parse(
|
||||
char const*& it,
|
||||
char const* end) const;
|
||||
@@ -445,7 +445,7 @@ range_rule(
|
||||
@code
|
||||
// range = [ token ] *( "," token )
|
||||
|
||||
result< range< string_view > > rv = parse( "whiskey,tango,foxtrot",
|
||||
system::result< range< core::string_view > > rv = parse( "whiskey,tango,foxtrot",
|
||||
range_rule(
|
||||
token_rule( alpha_chars ), // first
|
||||
tuple_rule( // next
|
||||
@@ -506,7 +506,7 @@ struct range_rule_t
|
||||
using value_type =
|
||||
range<typename R0::value_type>;
|
||||
|
||||
result<value_type>
|
||||
system::result<value_type>
|
||||
parse(
|
||||
char const*& it,
|
||||
char const* end) const;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#define BOOST_URL_GRAMMAR_STRING_TOKEN_HPP
|
||||
|
||||
#include <boost/url/detail/config.hpp>
|
||||
#include <boost/url/string_view.hpp>
|
||||
#include <boost/core/detail/string_view.hpp>
|
||||
#include <boost/url/detail/except.hpp>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
@@ -268,7 +268,7 @@ assign_to(
|
||||
|
||||
//------------------------------------------------
|
||||
|
||||
/** A token for producing a durable string_view from a temporary string
|
||||
/** A token for producing a durable core::string_view from a temporary string
|
||||
*/
|
||||
#ifdef BOOST_URL_DOCS
|
||||
template<
|
||||
@@ -285,7 +285,7 @@ template<class Alloc>
|
||||
struct preserve_size_t
|
||||
: arg
|
||||
{
|
||||
using result_type = string_view;
|
||||
using result_type = core::string_view;
|
||||
|
||||
using string_type = std::basic_string<
|
||||
char, std::char_traits<char>,
|
||||
@@ -312,7 +312,7 @@ struct preserve_size_t
|
||||
result_type
|
||||
result() noexcept
|
||||
{
|
||||
return string_view(
|
||||
return core::string_view(
|
||||
s_.data(), n_);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,8 @@
|
||||
#define BOOST_URL_GRAMMAR_STRING_VIEW_BASE_HPP
|
||||
|
||||
#include <boost/url/detail/config.hpp>
|
||||
#include <boost/url/string_view.hpp>
|
||||
#include <boost/url/detail/string_view.hpp>
|
||||
#include <boost/core/detail/string_view.hpp>
|
||||
#include <cstddef>
|
||||
#include <iterator>
|
||||
#include <string>
|
||||
@@ -37,13 +38,13 @@ class string_view_base
|
||||
protected:
|
||||
/** The referenced character buffer
|
||||
*/
|
||||
string_view s_;
|
||||
core::string_view s_;
|
||||
|
||||
/** Constructor
|
||||
*/
|
||||
constexpr
|
||||
string_view_base(
|
||||
string_view s) noexcept
|
||||
core::string_view s) noexcept
|
||||
: s_(s)
|
||||
{
|
||||
}
|
||||
@@ -109,14 +110,14 @@ public:
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
|
||||
/// A constant used to represent "no position"
|
||||
static constexpr std::size_t npos = string_view::npos;
|
||||
static constexpr std::size_t npos = core::string_view::npos;
|
||||
|
||||
//--------------------------------------------
|
||||
|
||||
/** Conversion
|
||||
*/
|
||||
operator
|
||||
string_view() const noexcept
|
||||
core::string_view() const noexcept
|
||||
{
|
||||
return s_;
|
||||
}
|
||||
@@ -151,7 +152,7 @@ public:
|
||||
|
||||
/** Return an iterator to the beginning
|
||||
|
||||
See `string_view::begin`
|
||||
See `core::string_view::begin`
|
||||
*/
|
||||
BOOST_CONSTEXPR const_iterator begin() const noexcept
|
||||
{
|
||||
@@ -160,7 +161,7 @@ public:
|
||||
|
||||
/** Return an iterator to the end
|
||||
|
||||
See `string_view::end`
|
||||
See `core::string_view::end`
|
||||
*/
|
||||
BOOST_CONSTEXPR const_iterator end() const noexcept
|
||||
{
|
||||
@@ -169,7 +170,7 @@ public:
|
||||
|
||||
/** Return an iterator to the beginning
|
||||
|
||||
See `string_view::cbegin`
|
||||
See `core::string_view::cbegin`
|
||||
*/
|
||||
BOOST_CONSTEXPR const_iterator cbegin() const noexcept
|
||||
{
|
||||
@@ -178,7 +179,7 @@ public:
|
||||
|
||||
/** Return an iterator to the end
|
||||
|
||||
See `string_view::cend`
|
||||
See `core::string_view::cend`
|
||||
*/
|
||||
BOOST_CONSTEXPR const_iterator cend() const noexcept
|
||||
{
|
||||
@@ -187,7 +188,7 @@ public:
|
||||
|
||||
/** Return a reverse iterator to the end
|
||||
|
||||
See `string_view::rbegin`
|
||||
See `core::string_view::rbegin`
|
||||
*/
|
||||
#ifdef __cpp_lib_array_constexpr
|
||||
constexpr
|
||||
@@ -199,7 +200,7 @@ public:
|
||||
|
||||
/** Return a reverse iterator to the beginning
|
||||
|
||||
See `string_view::rend`
|
||||
See `core::string_view::rend`
|
||||
*/
|
||||
#ifdef __cpp_lib_array_constexpr
|
||||
constexpr
|
||||
@@ -211,7 +212,7 @@ public:
|
||||
|
||||
/** Return a reverse iterator to the end
|
||||
|
||||
See `string_view::crbegin`
|
||||
See `core::string_view::crbegin`
|
||||
*/
|
||||
#ifdef __cpp_lib_array_constexpr
|
||||
constexpr
|
||||
@@ -223,7 +224,7 @@ public:
|
||||
|
||||
/** Return a reverse iterator to the beginning
|
||||
|
||||
See `string_view::crend`
|
||||
See `core::string_view::crend`
|
||||
*/
|
||||
#ifdef __cpp_lib_array_constexpr
|
||||
constexpr
|
||||
@@ -237,7 +238,7 @@ public:
|
||||
|
||||
/** Return the size
|
||||
|
||||
See `string_view::size`
|
||||
See `core::string_view::size`
|
||||
*/
|
||||
BOOST_CONSTEXPR size_type size() const noexcept
|
||||
{
|
||||
@@ -246,7 +247,7 @@ public:
|
||||
|
||||
/** Return the size
|
||||
|
||||
See `string_view::length`
|
||||
See `core::string_view::length`
|
||||
*/
|
||||
BOOST_CONSTEXPR size_type length() const noexcept
|
||||
{
|
||||
@@ -255,7 +256,7 @@ public:
|
||||
|
||||
/** Return the maximum allowed size
|
||||
|
||||
See `string_view::max_size`
|
||||
See `core::string_view::max_size`
|
||||
*/
|
||||
BOOST_CONSTEXPR size_type max_size() const noexcept
|
||||
{
|
||||
@@ -264,7 +265,7 @@ public:
|
||||
|
||||
/** Return true if the string is empty
|
||||
|
||||
See `string_view::size`
|
||||
See `core::string_view::size`
|
||||
*/
|
||||
BOOST_CONSTEXPR bool empty() const noexcept
|
||||
{
|
||||
@@ -275,7 +276,7 @@ public:
|
||||
|
||||
/** Access a character
|
||||
|
||||
See `string_view::operator[]`
|
||||
See `core::string_view::operator[]`
|
||||
*/
|
||||
BOOST_CXX14_CONSTEXPR const_reference
|
||||
operator[]( size_type pos ) const noexcept
|
||||
@@ -285,7 +286,7 @@ public:
|
||||
|
||||
/** Access a character
|
||||
|
||||
See `string_view::at`
|
||||
See `core::string_view::at`
|
||||
*/
|
||||
BOOST_CXX14_CONSTEXPR const_reference
|
||||
at( size_type pos ) const
|
||||
@@ -295,7 +296,7 @@ public:
|
||||
|
||||
/** Return the first character
|
||||
|
||||
See `string_view::front`
|
||||
See `core::string_view::front`
|
||||
*/
|
||||
BOOST_CXX14_CONSTEXPR const_reference
|
||||
front() const noexcept
|
||||
@@ -305,7 +306,7 @@ public:
|
||||
|
||||
/** Return the last character
|
||||
|
||||
See `string_view::back`
|
||||
See `core::string_view::back`
|
||||
*/
|
||||
BOOST_CXX14_CONSTEXPR const_reference
|
||||
back() const noexcept
|
||||
@@ -315,7 +316,7 @@ public:
|
||||
|
||||
/** Return a pointer to the character buffer
|
||||
|
||||
See `string_view::data`
|
||||
See `core::string_view::data`
|
||||
*/
|
||||
BOOST_CONSTEXPR const_pointer
|
||||
data() const noexcept
|
||||
@@ -327,7 +328,7 @@ public:
|
||||
|
||||
/** Copy the characters to another buffer
|
||||
|
||||
See `string_view::copy`
|
||||
See `core::string_view::copy`
|
||||
*/
|
||||
BOOST_CXX14_CONSTEXPR size_type copy(
|
||||
char* s, size_type n, size_type pos = 0 ) const
|
||||
@@ -337,10 +338,10 @@ public:
|
||||
|
||||
/** Return a view to part of the string
|
||||
|
||||
See `string_view::substr`
|
||||
See `core::string_view::substr`
|
||||
*/
|
||||
BOOST_CXX14_CONSTEXPR string_view substr(
|
||||
size_type pos = 0, size_type n = string_view::npos ) const
|
||||
BOOST_CXX14_CONSTEXPR core::string_view substr(
|
||||
size_type pos = 0, size_type n = core::string_view::npos ) const
|
||||
{
|
||||
return s_.substr(pos, n);
|
||||
}
|
||||
@@ -349,30 +350,30 @@ public:
|
||||
|
||||
/** Return the result of comparing to another string
|
||||
|
||||
See `string_view::compare`
|
||||
See `core::string_view::compare`
|
||||
*/
|
||||
BOOST_CXX14_CONSTEXPR int
|
||||
compare( string_view str ) const noexcept
|
||||
compare( core::string_view str ) const noexcept
|
||||
{
|
||||
return s_.compare(str);
|
||||
}
|
||||
|
||||
/** Return the result of comparing to another string
|
||||
|
||||
See `string_view::compare`
|
||||
See `core::string_view::compare`
|
||||
*/
|
||||
BOOST_CONSTEXPR int compare(
|
||||
size_type pos1, size_type n1, string_view str ) const
|
||||
size_type pos1, size_type n1, core::string_view str ) const
|
||||
{
|
||||
return s_.compare(pos1, n1, str);
|
||||
}
|
||||
|
||||
/** Return the result of comparing to another string
|
||||
|
||||
See `string_view::compare`
|
||||
See `core::string_view::compare`
|
||||
*/
|
||||
BOOST_CONSTEXPR int compare(
|
||||
size_type pos1, size_type n1, string_view str,
|
||||
size_type pos1, size_type n1, core::string_view str,
|
||||
size_type pos2, size_type n2 ) const
|
||||
{
|
||||
return s_.compare(pos1, n1, str, pos2, n2);
|
||||
@@ -380,7 +381,7 @@ public:
|
||||
|
||||
/** Return the result of comparing to another string
|
||||
|
||||
See `string_view::compare`
|
||||
See `core::string_view::compare`
|
||||
*/
|
||||
BOOST_CONSTEXPR int compare(
|
||||
char const* s ) const noexcept
|
||||
@@ -390,7 +391,7 @@ public:
|
||||
|
||||
/** Return the result of comparing to another string
|
||||
|
||||
See `string_view::compare`
|
||||
See `core::string_view::compare`
|
||||
*/
|
||||
BOOST_CONSTEXPR int compare(
|
||||
size_type pos1, size_type n1, char const* s ) const
|
||||
@@ -400,7 +401,7 @@ public:
|
||||
|
||||
/** Return the result of comparing to another string
|
||||
|
||||
See `string_view::compare`
|
||||
See `core::string_view::compare`
|
||||
*/
|
||||
BOOST_CONSTEXPR int compare(
|
||||
size_type pos1, size_type n1,
|
||||
@@ -413,17 +414,17 @@ public:
|
||||
|
||||
/** Return true if a matching prefix exists
|
||||
|
||||
See `string_view::starts_with`
|
||||
See `core::string_view::starts_with`
|
||||
*/
|
||||
BOOST_CONSTEXPR bool starts_with(
|
||||
string_view x ) const noexcept
|
||||
core::string_view x ) const noexcept
|
||||
{
|
||||
return s_.starts_with(x);
|
||||
}
|
||||
|
||||
/** Return true if a matching prefix exists
|
||||
|
||||
See `string_view::starts_with`
|
||||
See `core::string_view::starts_with`
|
||||
*/
|
||||
BOOST_CONSTEXPR bool starts_with(
|
||||
char x ) const noexcept
|
||||
@@ -433,7 +434,7 @@ public:
|
||||
|
||||
/** Return true if a matching prefix exists
|
||||
|
||||
See `string_view::starts_with`
|
||||
See `core::string_view::starts_with`
|
||||
*/
|
||||
BOOST_CONSTEXPR bool starts_with(
|
||||
char const* x ) const noexcept
|
||||
@@ -445,17 +446,17 @@ public:
|
||||
|
||||
/** Return true if a matching suffix exists
|
||||
|
||||
See `string_view::ends_with`
|
||||
See `core::string_view::ends_with`
|
||||
*/
|
||||
BOOST_CONSTEXPR bool ends_with(
|
||||
string_view x ) const noexcept
|
||||
core::string_view x ) const noexcept
|
||||
{
|
||||
return s_.ends_with(x);
|
||||
}
|
||||
|
||||
/** Return true if a matching suffix exists
|
||||
|
||||
See `string_view::ends_with`
|
||||
See `core::string_view::ends_with`
|
||||
*/
|
||||
BOOST_CONSTEXPR bool ends_with(
|
||||
char x ) const noexcept
|
||||
@@ -465,7 +466,7 @@ public:
|
||||
|
||||
/** Return true if a matching suffix exists
|
||||
|
||||
See `string_view::ends_with`
|
||||
See `core::string_view::ends_with`
|
||||
*/
|
||||
BOOST_CONSTEXPR bool ends_with(
|
||||
char const* x ) const noexcept
|
||||
@@ -477,17 +478,17 @@ public:
|
||||
|
||||
/** Return the position of matching characters
|
||||
|
||||
See `string_view::find`
|
||||
See `core::string_view::find`
|
||||
*/
|
||||
BOOST_CONSTEXPR size_type find(
|
||||
string_view str, size_type pos = 0 ) const noexcept
|
||||
core::string_view str, size_type pos = 0 ) const noexcept
|
||||
{
|
||||
return s_.find(str, pos);
|
||||
}
|
||||
|
||||
/** Return the position of matching characters
|
||||
|
||||
See `string_view::find`
|
||||
See `core::string_view::find`
|
||||
*/
|
||||
BOOST_CXX14_CONSTEXPR size_type find(
|
||||
char c, size_type pos = 0 ) const noexcept
|
||||
@@ -497,7 +498,7 @@ public:
|
||||
|
||||
/** Return the position of matching characters
|
||||
|
||||
See `string_view::find`
|
||||
See `core::string_view::find`
|
||||
*/
|
||||
BOOST_CXX14_CONSTEXPR size_type find(
|
||||
char const* s, size_type pos, size_type n ) const noexcept
|
||||
@@ -507,7 +508,7 @@ public:
|
||||
|
||||
/** Return the position of matching characters
|
||||
|
||||
See `string_view::find`
|
||||
See `core::string_view::find`
|
||||
*/
|
||||
BOOST_CONSTEXPR size_type find(
|
||||
char const* s, size_type pos = 0 ) const noexcept
|
||||
@@ -519,27 +520,27 @@ public:
|
||||
|
||||
/** Return the position of matching characters
|
||||
|
||||
See `string_view::rfind`
|
||||
See `core::string_view::rfind`
|
||||
*/
|
||||
BOOST_CONSTEXPR size_type rfind(
|
||||
string_view str, size_type pos = string_view::npos ) const noexcept
|
||||
core::string_view str, size_type pos = core::string_view::npos ) const noexcept
|
||||
{
|
||||
return s_.rfind(str, pos);
|
||||
}
|
||||
|
||||
/** Return the position of matching characters
|
||||
|
||||
See `string_view::rfind`
|
||||
See `core::string_view::rfind`
|
||||
*/
|
||||
BOOST_CXX14_CONSTEXPR size_type rfind(
|
||||
char c, size_type pos = string_view::npos ) const noexcept
|
||||
char c, size_type pos = core::string_view::npos ) const noexcept
|
||||
{
|
||||
return s_.rfind(c, pos);
|
||||
}
|
||||
|
||||
/** Return the position of matching characters
|
||||
|
||||
See `string_view::rfind`
|
||||
See `core::string_view::rfind`
|
||||
*/
|
||||
BOOST_CXX14_CONSTEXPR size_type rfind(
|
||||
char const* s, size_type pos, size_type n ) const noexcept
|
||||
@@ -549,10 +550,10 @@ public:
|
||||
|
||||
/** Return the position of matching characters
|
||||
|
||||
See `string_view::rfind`
|
||||
See `core::string_view::rfind`
|
||||
*/
|
||||
BOOST_CONSTEXPR size_type rfind(
|
||||
char const* s, size_type pos = string_view::npos ) const noexcept
|
||||
char const* s, size_type pos = core::string_view::npos ) const noexcept
|
||||
{
|
||||
return s_.rfind(s, pos);
|
||||
}
|
||||
@@ -561,17 +562,17 @@ public:
|
||||
|
||||
/** Return the position of the first match
|
||||
|
||||
See `string_view::find_first_of`
|
||||
See `core::string_view::find_first_of`
|
||||
*/
|
||||
BOOST_CXX14_CONSTEXPR size_type find_first_of(
|
||||
string_view str, size_type pos = 0 ) const noexcept
|
||||
core::string_view str, size_type pos = 0 ) const noexcept
|
||||
{
|
||||
return s_.find_first_of(str, pos);
|
||||
}
|
||||
|
||||
/** Return the position of the first match
|
||||
|
||||
See `string_view::find_first_of`
|
||||
See `core::string_view::find_first_of`
|
||||
*/
|
||||
BOOST_CONSTEXPR size_type find_first_of(
|
||||
char c, size_type pos = 0 ) const noexcept
|
||||
@@ -581,7 +582,7 @@ public:
|
||||
|
||||
/** Return the position of the first match
|
||||
|
||||
See `string_view::find_first_of`
|
||||
See `core::string_view::find_first_of`
|
||||
*/
|
||||
BOOST_CXX14_CONSTEXPR size_type find_first_of(
|
||||
char const* s, size_type pos, size_type n ) const noexcept
|
||||
@@ -591,7 +592,7 @@ public:
|
||||
|
||||
/** Return the position of the first match
|
||||
|
||||
See `string_view::find_first_of`
|
||||
See `core::string_view::find_first_of`
|
||||
*/
|
||||
BOOST_CXX14_CONSTEXPR size_type find_first_of(
|
||||
char const* s, size_type pos = 0 ) const noexcept
|
||||
@@ -603,27 +604,27 @@ public:
|
||||
|
||||
/** Return the position of the last match
|
||||
|
||||
See `string_view::find_last_of`
|
||||
See `core::string_view::find_last_of`
|
||||
*/
|
||||
BOOST_CXX14_CONSTEXPR size_type find_last_of(
|
||||
string_view str, size_type pos = string_view::npos ) const noexcept
|
||||
core::string_view str, size_type pos = core::string_view::npos ) const noexcept
|
||||
{
|
||||
return s_.find_last_of(str, pos);
|
||||
}
|
||||
|
||||
/** Return the position of the last match
|
||||
|
||||
See `string_view::find_last_of`
|
||||
See `core::string_view::find_last_of`
|
||||
*/
|
||||
BOOST_CONSTEXPR size_type find_last_of(
|
||||
char c, size_type pos = string_view::npos ) const noexcept
|
||||
char c, size_type pos = core::string_view::npos ) const noexcept
|
||||
{
|
||||
return s_.find_last_of(c, pos);
|
||||
}
|
||||
|
||||
/** Return the position of the last match
|
||||
|
||||
See `string_view::find_last_of`
|
||||
See `core::string_view::find_last_of`
|
||||
*/
|
||||
BOOST_CXX14_CONSTEXPR size_type find_last_of(
|
||||
char const* s, size_type pos, size_type n ) const noexcept
|
||||
@@ -633,10 +634,10 @@ public:
|
||||
|
||||
/** Return the position of the last match
|
||||
|
||||
See `string_view::find_last_of`
|
||||
See `core::string_view::find_last_of`
|
||||
*/
|
||||
BOOST_CXX14_CONSTEXPR size_type find_last_of(
|
||||
char const* s, size_type pos = string_view::npos ) const noexcept
|
||||
char const* s, size_type pos = core::string_view::npos ) const noexcept
|
||||
{
|
||||
return s_.find_last_of(s, pos);
|
||||
}
|
||||
@@ -645,17 +646,17 @@ public:
|
||||
|
||||
/** Return the position of the first non-match
|
||||
|
||||
See `string_view::find_first_not_of`
|
||||
See `core::string_view::find_first_not_of`
|
||||
*/
|
||||
BOOST_CXX14_CONSTEXPR size_type find_first_not_of(
|
||||
string_view str, size_type pos = 0 ) const noexcept
|
||||
core::string_view str, size_type pos = 0 ) const noexcept
|
||||
{
|
||||
return s_.find_first_not_of(str, pos);
|
||||
}
|
||||
|
||||
/** Return the position of the first non-match
|
||||
|
||||
See `string_view::find_first_not_of`
|
||||
See `core::string_view::find_first_not_of`
|
||||
*/
|
||||
BOOST_CXX14_CONSTEXPR size_type find_first_not_of(
|
||||
char c, size_type pos = 0 ) const noexcept
|
||||
@@ -665,7 +666,7 @@ public:
|
||||
|
||||
/** Return the position of the first non-match
|
||||
|
||||
See `string_view::find_first_not_of`
|
||||
See `core::string_view::find_first_not_of`
|
||||
*/
|
||||
BOOST_CXX14_CONSTEXPR size_type find_first_not_of(
|
||||
char const* s, size_type pos, size_type n ) const noexcept
|
||||
@@ -675,7 +676,7 @@ public:
|
||||
|
||||
/** Return the position of the first non-match
|
||||
|
||||
See `string_view::find_first_not_of`
|
||||
See `core::string_view::find_first_not_of`
|
||||
*/
|
||||
BOOST_CXX14_CONSTEXPR size_type find_first_not_of(
|
||||
char const* s, size_type pos = 0 ) const noexcept
|
||||
@@ -687,27 +688,27 @@ public:
|
||||
|
||||
/** Return the position of the last non-match
|
||||
|
||||
See `string_view::find_last_not_of`
|
||||
See `core::string_view::find_last_not_of`
|
||||
*/
|
||||
BOOST_CXX14_CONSTEXPR size_type find_last_not_of(
|
||||
string_view str, size_type pos = string_view::npos ) const noexcept
|
||||
core::string_view str, size_type pos = core::string_view::npos ) const noexcept
|
||||
{
|
||||
return s_.find_last_not_of(str, pos);
|
||||
}
|
||||
|
||||
/** Return the position of the last non-match
|
||||
|
||||
See `string_view::find_last_not_of`
|
||||
See `core::string_view::find_last_not_of`
|
||||
*/
|
||||
BOOST_CXX14_CONSTEXPR size_type find_last_not_of(
|
||||
char c, size_type pos = string_view::npos ) const noexcept
|
||||
char c, size_type pos = core::string_view::npos ) const noexcept
|
||||
{
|
||||
return s_.find_last_not_of(c, pos);
|
||||
}
|
||||
|
||||
/** Return the position of the last non-match
|
||||
|
||||
See `string_view::find_last_not_of`
|
||||
See `core::string_view::find_last_not_of`
|
||||
*/
|
||||
BOOST_CXX14_CONSTEXPR size_type find_last_not_of(
|
||||
char const* s, size_type pos, size_type n ) const noexcept
|
||||
@@ -717,10 +718,10 @@ public:
|
||||
|
||||
/** Return the position of the last non-match
|
||||
|
||||
See `string_view::find_last_not_of`
|
||||
See `core::string_view::find_last_not_of`
|
||||
*/
|
||||
BOOST_CXX14_CONSTEXPR size_type find_last_not_of(
|
||||
char const* s, size_type pos = string_view::npos ) const noexcept
|
||||
char const* s, size_type pos = core::string_view::npos ) const noexcept
|
||||
{
|
||||
return s_.find_last_not_of(s, pos);
|
||||
}
|
||||
@@ -729,16 +730,16 @@ public:
|
||||
|
||||
/** Return true if matching characters are found
|
||||
|
||||
See `string_view::contains`
|
||||
See `core::string_view::contains`
|
||||
*/
|
||||
BOOST_CONSTEXPR bool contains( string_view sv ) const noexcept
|
||||
BOOST_CONSTEXPR bool contains( core::string_view sv ) const noexcept
|
||||
{
|
||||
return s_.contains(sv);
|
||||
}
|
||||
|
||||
/** Return true if matching characters are found
|
||||
|
||||
See `string_view::contains`
|
||||
See `core::string_view::contains`
|
||||
*/
|
||||
BOOST_CXX14_CONSTEXPR bool contains( char c ) const noexcept
|
||||
{
|
||||
@@ -747,7 +748,7 @@ public:
|
||||
|
||||
/** Return true if matching characters are found
|
||||
|
||||
See `string_view::contains`
|
||||
See `core::string_view::contains`
|
||||
*/
|
||||
BOOST_CONSTEXPR bool contains( char const* s ) const noexcept
|
||||
{
|
||||
@@ -759,8 +760,8 @@ public:
|
||||
private:
|
||||
template<class S0, class S1>
|
||||
using is_match = std::integral_constant<bool,
|
||||
std::is_convertible<S0, string_view>::value &&
|
||||
std::is_convertible<S1, string_view>::value && (
|
||||
std::is_convertible<S0, core::string_view>::value &&
|
||||
std::is_convertible<S1, core::string_view>::value && (
|
||||
(std::is_base_of<string_view_base,
|
||||
typename std::decay<S0>::type>::value &&
|
||||
std::is_convertible<S0 const volatile*,
|
||||
@@ -862,10 +863,10 @@ operator<<(
|
||||
namespace detail {
|
||||
template <>
|
||||
inline
|
||||
string_view
|
||||
core::string_view
|
||||
to_sv(grammar::string_view_base const& s) noexcept
|
||||
{
|
||||
return s.operator string_view();
|
||||
return s.operator core::string_view();
|
||||
}
|
||||
} // detail
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <boost/url/detail/config.hpp>
|
||||
#include <boost/url/grammar/charset.hpp>
|
||||
#include <boost/url/error_types.hpp>
|
||||
#include <boost/url/string_view.hpp>
|
||||
#include <boost/core/detail/string_view.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace urls {
|
||||
@@ -26,13 +26,13 @@ namespace grammar {
|
||||
|
||||
@par Value Type
|
||||
@code
|
||||
using value_type = string_view;
|
||||
using value_type = core::string_view;
|
||||
@endcode
|
||||
|
||||
@par Example
|
||||
Rules are used with the function @ref parse.
|
||||
@code
|
||||
result< string_view > rv = parse( "abcdef", token_rule( alpha_chars ) );
|
||||
system::result< core::string_view > rv = parse( "abcdef", token_rule( alpha_chars ) );
|
||||
@endcode
|
||||
|
||||
@par BNF
|
||||
@@ -56,7 +56,7 @@ token_rule(
|
||||
template<class CharSet>
|
||||
struct token_rule_t
|
||||
{
|
||||
using value_type = string_view;
|
||||
using value_type = core::string_view;
|
||||
|
||||
static_assert(
|
||||
is_charset<CharSet>::value,
|
||||
@@ -67,7 +67,7 @@ struct token_rule_t
|
||||
char const*& it,
|
||||
char const* end
|
||||
) const noexcept ->
|
||||
result<value_type>;
|
||||
system::result<value_type>;
|
||||
|
||||
private:
|
||||
template<class CharSet_>
|
||||
|
||||
@@ -42,13 +42,13 @@ namespace grammar {
|
||||
except that `void` values are removed.
|
||||
However, if there is exactly one non-void
|
||||
value type `T`, then the sequence rule
|
||||
returns `result<T>` instead of
|
||||
`result<tuple<...>>`.
|
||||
returns `system::result<T>` instead of
|
||||
`system::result<tuple<...>>`.
|
||||
|
||||
@par Example
|
||||
Rules are used with the function @ref parse.
|
||||
@code
|
||||
result< std::tuple< unsigned char, unsigned char, unsigned char, unsigned char > > rv =
|
||||
system::result< std::tuple< unsigned char, unsigned char, unsigned char, unsigned char > > rv =
|
||||
parse( "192.168.0.1",
|
||||
tuple_rule(
|
||||
dec_octet_rule,
|
||||
@@ -114,7 +114,7 @@ public:
|
||||
Rn_ const&... rn) noexcept ->
|
||||
tuple_rule_t<R0_, Rn_...>;
|
||||
|
||||
result<value_type>
|
||||
system::result<value_type>
|
||||
parse(
|
||||
char const*& it,
|
||||
char const* end) const;
|
||||
@@ -164,7 +164,7 @@ struct squelch_rule_t
|
||||
{
|
||||
}
|
||||
|
||||
result<value_type>
|
||||
system::result<value_type>
|
||||
parse(
|
||||
char const*& it,
|
||||
char const* end) const
|
||||
@@ -196,7 +196,7 @@ struct squelch_rule_t
|
||||
@par Example 1
|
||||
With `squelch`:
|
||||
@code
|
||||
result< std::tuple< decode_view, string_view > > rv = parse(
|
||||
system::result< std::tuple< decode_view, core::string_view > > rv = parse(
|
||||
"www.example.com:443",
|
||||
tuple_rule(
|
||||
pct_encoded_rule(unreserved_chars + '-' + '.'),
|
||||
@@ -207,7 +207,7 @@ struct squelch_rule_t
|
||||
@par Example 2
|
||||
Without `squelch`:
|
||||
@code
|
||||
result< std::tuple< decode_view, string_view, string_view > > rv = parse(
|
||||
system::result< std::tuple< decode_view, core::string_view, core::string_view > > rv = parse(
|
||||
"www.example.com:443",
|
||||
tuple_rule(
|
||||
pct_encoded_rule(unreserved_chars + '-' + '.'),
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace grammar {
|
||||
parse(
|
||||
char const*& it,
|
||||
char const* end) const ->
|
||||
result<value_type>
|
||||
system::result<value_type>
|
||||
};
|
||||
|
||||
static_assert( is_rule<U>::value, "Requirements not met" );
|
||||
@@ -52,7 +52,7 @@ struct is_rule : std::false_type {};
|
||||
|
||||
template<class T>
|
||||
struct is_rule<T, void_t<decltype(
|
||||
std::declval<result<typename T::value_type>&>() =
|
||||
std::declval<system::result<typename T::value_type>&>() =
|
||||
std::declval<T const&>().parse(
|
||||
std::declval<char const*&>(),
|
||||
std::declval<char const*>())
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include <boost/url/detail/config.hpp>
|
||||
#include <boost/url/error_types.hpp>
|
||||
#include <boost/url/grammar/charset.hpp>
|
||||
#include <boost/url/string_view.hpp>
|
||||
#include <boost/core/detail/string_view.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <limits>
|
||||
#include <type_traits>
|
||||
@@ -35,7 +35,7 @@ namespace grammar {
|
||||
@par Example
|
||||
Rules are used with the function @ref parse.
|
||||
@code
|
||||
result< unsigned short > rv = parse( "32767", unsigned_rule< unsigned short >{} );
|
||||
system::result< unsigned short > rv = parse( "32767", unsigned_rule< unsigned short >{} );
|
||||
@endcode
|
||||
|
||||
@par BNF
|
||||
@@ -69,7 +69,7 @@ struct unsigned_rule
|
||||
char const*& it,
|
||||
char const* end
|
||||
) const noexcept ->
|
||||
result<value_type>;
|
||||
system::result<value_type>;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace grammar {
|
||||
// / authority-form
|
||||
// / asterisk-form
|
||||
|
||||
result< variant< url_view, url_view, authority_view, string_view > > rv = grammar::parse(
|
||||
system::result< variant< url_view, url_view, authority_view, core::string_view > > rv = grammar::parse(
|
||||
"/index.html?width=full",
|
||||
variant_rule(
|
||||
origin_form_rule,
|
||||
@@ -87,7 +87,7 @@ public:
|
||||
parse(
|
||||
char const*& it,
|
||||
char const* end) const ->
|
||||
result<value_type>;
|
||||
system::result<value_type>;
|
||||
|
||||
template<
|
||||
class R0_,
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace grammar {
|
||||
Character sets are used with rules and the
|
||||
functions @ref find_if and @ref find_if_not.
|
||||
@code
|
||||
result< string_view > rv = parse( "JohnDoe", token_rule( vchars ) );
|
||||
system::result< core::string_view > rv = parse( "JohnDoe", token_rule( vchars ) );
|
||||
@endcode
|
||||
|
||||
@par BNF
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace urls {
|
||||
template<class CharSet>
|
||||
std::size_t
|
||||
encoded_size(
|
||||
string_view s,
|
||||
core::string_view s,
|
||||
CharSet const& unreserved,
|
||||
encoding_opts opt) noexcept
|
||||
{
|
||||
@@ -80,7 +80,7 @@ std::size_t
|
||||
encode(
|
||||
char* dest,
|
||||
std::size_t size,
|
||||
string_view s,
|
||||
core::string_view s,
|
||||
CharSet const& unreserved,
|
||||
encoding_opts opt)
|
||||
{
|
||||
@@ -174,7 +174,7 @@ std::size_t
|
||||
encode_unsafe(
|
||||
char* dest,
|
||||
std::size_t size,
|
||||
string_view s,
|
||||
core::string_view s,
|
||||
CharSet const& unreserved,
|
||||
encoding_opts opt)
|
||||
{
|
||||
@@ -249,7 +249,7 @@ template<
|
||||
class CharSet>
|
||||
BOOST_URL_STRTOK_RETURN
|
||||
encode(
|
||||
string_view s,
|
||||
core::string_view s,
|
||||
CharSet const& unreserved,
|
||||
encoding_opts opt,
|
||||
StringToken&& token) noexcept
|
||||
|
||||
@@ -124,7 +124,7 @@ inline
|
||||
bool
|
||||
params_base::
|
||||
contains(
|
||||
string_view key,
|
||||
core::string_view key,
|
||||
ignore_case_param ic) const noexcept
|
||||
{
|
||||
return find(
|
||||
@@ -135,7 +135,7 @@ inline
|
||||
auto
|
||||
params_base::
|
||||
find(
|
||||
string_view key,
|
||||
core::string_view key,
|
||||
ignore_case_param ic) const noexcept ->
|
||||
iterator
|
||||
{
|
||||
@@ -150,7 +150,7 @@ auto
|
||||
params_base::
|
||||
find(
|
||||
iterator it,
|
||||
string_view key,
|
||||
core::string_view key,
|
||||
ignore_case_param ic) const noexcept ->
|
||||
iterator
|
||||
{
|
||||
@@ -164,7 +164,7 @@ inline
|
||||
auto
|
||||
params_base::
|
||||
find_last(
|
||||
string_view key,
|
||||
core::string_view key,
|
||||
ignore_case_param ic) const noexcept ->
|
||||
iterator
|
||||
{
|
||||
@@ -179,7 +179,7 @@ auto
|
||||
params_base::
|
||||
find_last(
|
||||
iterator it,
|
||||
string_view key,
|
||||
core::string_view key,
|
||||
ignore_case_param ic) const noexcept ->
|
||||
iterator
|
||||
{
|
||||
|
||||
@@ -146,7 +146,7 @@ erase(
|
||||
iterator last) noexcept ->
|
||||
iterator
|
||||
{
|
||||
string_view s("", 0);
|
||||
core::string_view s("", 0);
|
||||
return u_->edit_params(
|
||||
first.it_,
|
||||
last.it_,
|
||||
|
||||
@@ -186,7 +186,7 @@ erase(
|
||||
iterator last) noexcept ->
|
||||
iterator
|
||||
{
|
||||
string_view s("", 0);
|
||||
core::string_view s("", 0);
|
||||
return iterator(
|
||||
u_->edit_params(
|
||||
first.it_,
|
||||
|
||||
@@ -48,7 +48,7 @@ assign(
|
||||
std::is_convertible<
|
||||
typename std::iterator_traits<
|
||||
FwdIt>::reference,
|
||||
string_view>::value,
|
||||
core::string_view>::value,
|
||||
"Type requirements not met");
|
||||
|
||||
u_->edit_segments(
|
||||
@@ -76,7 +76,7 @@ insert(
|
||||
std::is_convertible<
|
||||
typename std::iterator_traits<
|
||||
FwdIt>::reference,
|
||||
string_view>::value,
|
||||
core::string_view>::value,
|
||||
"Type requirements not met");
|
||||
|
||||
return insert(
|
||||
@@ -116,7 +116,7 @@ replace(
|
||||
std::is_convertible<
|
||||
typename std::iterator_traits<
|
||||
FwdIt>::reference,
|
||||
string_view>::value,
|
||||
core::string_view>::value,
|
||||
"Type requirements not met");
|
||||
|
||||
return u_->edit_segments(
|
||||
|
||||
@@ -47,7 +47,7 @@ assign(FwdIt first, FwdIt last)
|
||||
std::is_convertible<
|
||||
typename std::iterator_traits<
|
||||
FwdIt>::reference,
|
||||
string_view>::value,
|
||||
core::string_view>::value,
|
||||
"Type requirements not met");
|
||||
|
||||
u_->edit_segments(
|
||||
@@ -75,7 +75,7 @@ insert(
|
||||
std::is_convertible<
|
||||
typename std::iterator_traits<
|
||||
FwdIt>::reference,
|
||||
string_view>::value,
|
||||
core::string_view>::value,
|
||||
"Type requirements not met");
|
||||
|
||||
return insert(
|
||||
@@ -115,7 +115,7 @@ replace(
|
||||
std::is_convertible<
|
||||
typename std::iterator_traits<
|
||||
FwdIt>::reference,
|
||||
string_view>::value,
|
||||
core::string_view>::value,
|
||||
"Type requirements not met");
|
||||
|
||||
return u_->edit_segments(
|
||||
@@ -131,7 +131,7 @@ inline
|
||||
void
|
||||
segments_ref::
|
||||
push_back(
|
||||
string_view s)
|
||||
core::string_view s)
|
||||
{
|
||||
insert(end(), s);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include <boost/url/detail/config.hpp>
|
||||
#include <boost/url/error.hpp>
|
||||
#include <boost/url/error_types.hpp>
|
||||
#include <boost/url/string_view.hpp>
|
||||
#include <boost/core/detail/string_view.hpp>
|
||||
#include <boost/url/grammar/string_token.hpp>
|
||||
#include <string>
|
||||
#include <array>
|
||||
@@ -145,7 +145,7 @@ public:
|
||||
BOOST_URL_DECL
|
||||
explicit
|
||||
ipv4_address(
|
||||
string_view s);
|
||||
core::string_view s);
|
||||
|
||||
/** Return the address as bytes, in network byte order.
|
||||
*/
|
||||
@@ -215,7 +215,7 @@ public:
|
||||
@param dest_size The size of the output buffer.
|
||||
*/
|
||||
BOOST_URL_DECL
|
||||
string_view
|
||||
core::string_view
|
||||
to_buffer(
|
||||
char* dest,
|
||||
std::size_t dest_size) const;
|
||||
@@ -334,9 +334,9 @@ operator<<(
|
||||
/** Return an IPv4 address from an IP address string in dotted decimal form
|
||||
*/
|
||||
BOOST_URL_DECL
|
||||
result<ipv4_address>
|
||||
system::result<ipv4_address>
|
||||
parse_ipv4_address(
|
||||
string_view s) noexcept;
|
||||
core::string_view s) noexcept;
|
||||
|
||||
} // urls
|
||||
} // boost
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include <boost/url/detail/config.hpp>
|
||||
#include <boost/url/error.hpp>
|
||||
#include <boost/url/error_types.hpp>
|
||||
#include <boost/url/string_view.hpp>
|
||||
#include <boost/core/detail/string_view.hpp>
|
||||
#include <boost/url/grammar/string_token.hpp>
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
@@ -168,7 +168,7 @@ public:
|
||||
*/
|
||||
BOOST_URL_DECL
|
||||
ipv6_address(
|
||||
string_view s);
|
||||
core::string_view s);
|
||||
|
||||
/** Return the address as bytes, in network byte order
|
||||
*/
|
||||
@@ -242,7 +242,7 @@ public:
|
||||
@param dest_size The size of the output buffer.
|
||||
*/
|
||||
BOOST_URL_DECL
|
||||
string_view
|
||||
core::string_view
|
||||
to_buffer(
|
||||
char* dest,
|
||||
std::size_t dest_size) const;
|
||||
@@ -388,9 +388,9 @@ operator<<(
|
||||
@param s The string to parse.
|
||||
*/
|
||||
BOOST_URL_DECL
|
||||
result<ipv6_address>
|
||||
system::result<ipv6_address>
|
||||
parse_ipv6_address(
|
||||
string_view s) noexcept;
|
||||
core::string_view s) noexcept;
|
||||
|
||||
} // urls
|
||||
} // boost
|
||||
|
||||
@@ -17,9 +17,32 @@ namespace boost {
|
||||
namespace urls {
|
||||
|
||||
/** The type of optional used by the library
|
||||
|
||||
@note This alias is no longer supported and
|
||||
should not be used in new code. Please use
|
||||
`core::string_view` instead.
|
||||
|
||||
This alias is included for backwards
|
||||
compatibility with earlier versions of the
|
||||
library.
|
||||
|
||||
However, it will be removed in future releases,
|
||||
and using it in new code is not recommended.
|
||||
|
||||
Please use the updated version instead to
|
||||
ensure compatibility with future versions of
|
||||
the library.
|
||||
|
||||
*/
|
||||
#ifndef BOOST_URL_DOCS
|
||||
template<class T>
|
||||
using optional
|
||||
BOOST_URL_DEPRECATED("Use boost::optional<T> instead") =
|
||||
boost::optional<T>;
|
||||
#else
|
||||
template<class T>
|
||||
using optional = boost::optional<T>;
|
||||
#endif
|
||||
|
||||
} // urls
|
||||
} // boost
|
||||
|
||||
@@ -241,7 +241,7 @@ struct param
|
||||
@endcode
|
||||
|
||||
@code
|
||||
param qp( "key", optional<string_view>("value") );
|
||||
param qp( "key", optional<core::string_view>("value") );
|
||||
@endcode
|
||||
|
||||
@code
|
||||
@@ -268,15 +268,15 @@ struct param
|
||||
Calls to allocate may throw.
|
||||
|
||||
@tparam OptionalString An optional string
|
||||
type, such as @ref string_view,
|
||||
type, such as @ref core::string_view,
|
||||
`std::nullptr`, @ref no_value_t, or
|
||||
`optional<string_view>`.
|
||||
`optional<core::string_view>`.
|
||||
|
||||
@param key, value The key and value to set.
|
||||
*/
|
||||
template <class OptionalString>
|
||||
param(
|
||||
string_view key,
|
||||
core::string_view key,
|
||||
OptionalString const& value)
|
||||
: param(key, detail::get_optional_string(value))
|
||||
{
|
||||
@@ -334,13 +334,13 @@ struct param
|
||||
|
||||
// aggregate construction
|
||||
param(
|
||||
string_view key,
|
||||
string_view value,
|
||||
core::string_view key,
|
||||
core::string_view value,
|
||||
bool has_value) noexcept
|
||||
: key(key)
|
||||
, value(has_value
|
||||
? value
|
||||
: string_view())
|
||||
: core::string_view())
|
||||
, has_value(has_value)
|
||||
{
|
||||
}
|
||||
@@ -348,7 +348,7 @@ struct param
|
||||
|
||||
private:
|
||||
param(
|
||||
string_view key,
|
||||
core::string_view key,
|
||||
detail::optional_string const& value)
|
||||
: param(key, value.s, value.b)
|
||||
{
|
||||
@@ -411,7 +411,7 @@ struct param_view
|
||||
the authority that has final control
|
||||
over how the query is interpreted.
|
||||
*/
|
||||
string_view key;
|
||||
core::string_view key;
|
||||
|
||||
/** The value
|
||||
|
||||
@@ -419,7 +419,7 @@ struct param_view
|
||||
@ref has_value equal to true.
|
||||
An empty value is distinct from no value.
|
||||
*/
|
||||
string_view value;
|
||||
core::string_view value;
|
||||
|
||||
/** True if a value is present
|
||||
|
||||
@@ -484,15 +484,15 @@ struct param_view
|
||||
Throws nothing.
|
||||
|
||||
@tparam OptionalString An optional string
|
||||
type, such as @ref string_view,
|
||||
type, such as @ref core::string_view,
|
||||
`std::nullptr`, @ref no_value_t, or
|
||||
`optional<string_view>`.
|
||||
`optional<core::string_view>`.
|
||||
|
||||
@param key, value The key and value to set.
|
||||
*/
|
||||
template <class OptionalString>
|
||||
param_view(
|
||||
string_view key,
|
||||
core::string_view key,
|
||||
OptionalString const& value) noexcept
|
||||
: param_view(key, detail::get_optional_string(value))
|
||||
{
|
||||
@@ -568,13 +568,13 @@ struct param_view
|
||||
|
||||
// aggregate construction
|
||||
param_view(
|
||||
string_view key_,
|
||||
string_view value_,
|
||||
core::string_view key_,
|
||||
core::string_view value_,
|
||||
bool has_value_) noexcept
|
||||
: key(key_)
|
||||
, value(has_value_
|
||||
? value_
|
||||
: string_view())
|
||||
: core::string_view())
|
||||
, has_value(has_value_)
|
||||
{
|
||||
}
|
||||
@@ -582,7 +582,7 @@ struct param_view
|
||||
|
||||
private:
|
||||
param_view(
|
||||
string_view key,
|
||||
core::string_view key,
|
||||
detail::optional_string const& value)
|
||||
: param_view(key, value.s, value.b)
|
||||
{
|
||||
@@ -748,7 +748,7 @@ struct param_pct_view
|
||||
|
||||
@par Example
|
||||
@code
|
||||
param_pct_view qp( "key", optional<string_view>("value") );
|
||||
param_pct_view qp( "key", optional<core::string_view>("value") );
|
||||
@endcode
|
||||
|
||||
@par Postconditions
|
||||
@@ -766,9 +766,9 @@ struct param_pct_view
|
||||
`key` or `value` contains an invalid percent-encoding.
|
||||
|
||||
@tparam OptionalString An optional
|
||||
@ref string_view type, such as
|
||||
`boost::optional<string_view>` or
|
||||
`std::optional<string_view>`.
|
||||
@ref core::string_view type, such as
|
||||
`boost::optional<core::string_view>` or
|
||||
`std::optional<core::string_view>`.
|
||||
|
||||
@param key, value The key and value to set.
|
||||
*/
|
||||
|
||||
@@ -267,7 +267,7 @@ public:
|
||||
*/
|
||||
bool
|
||||
contains(
|
||||
string_view key,
|
||||
core::string_view key,
|
||||
ignore_case_param ic = {}) const noexcept;
|
||||
|
||||
/** Return the number of matching keys
|
||||
@@ -302,7 +302,7 @@ public:
|
||||
BOOST_URL_DECL
|
||||
std::size_t
|
||||
count(
|
||||
string_view key,
|
||||
core::string_view key,
|
||||
ignore_case_param ic = {}) const noexcept;
|
||||
|
||||
/** Find a matching key
|
||||
@@ -347,7 +347,7 @@ public:
|
||||
*/
|
||||
iterator
|
||||
find(
|
||||
string_view key,
|
||||
core::string_view key,
|
||||
ignore_case_param ic = {}) const noexcept;
|
||||
|
||||
/** Find a matching key
|
||||
@@ -393,7 +393,7 @@ public:
|
||||
iterator
|
||||
find(
|
||||
iterator from,
|
||||
string_view key,
|
||||
core::string_view key,
|
||||
ignore_case_param ic = {}) const noexcept;
|
||||
|
||||
/** Find a matching key
|
||||
@@ -433,7 +433,7 @@ public:
|
||||
*/
|
||||
iterator
|
||||
find_last(
|
||||
string_view key,
|
||||
core::string_view key,
|
||||
ignore_case_param ic = {}) const noexcept;
|
||||
|
||||
/** Find a matching key
|
||||
@@ -480,7 +480,7 @@ public:
|
||||
iterator
|
||||
find_last(
|
||||
iterator before,
|
||||
string_view key,
|
||||
core::string_view key,
|
||||
ignore_case_param ic = {}) const noexcept;
|
||||
|
||||
private:
|
||||
@@ -488,14 +488,14 @@ private:
|
||||
detail::params_iter_impl
|
||||
find_impl(
|
||||
detail::params_iter_impl,
|
||||
string_view,
|
||||
core::string_view,
|
||||
ignore_case_param) const noexcept;
|
||||
|
||||
BOOST_URL_DECL
|
||||
detail::params_iter_impl
|
||||
find_last_impl(
|
||||
detail::params_iter_impl,
|
||||
string_view,
|
||||
core::string_view,
|
||||
ignore_case_param) const noexcept;
|
||||
};
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include <boost/url/error_types.hpp>
|
||||
#include <boost/url/params_encoded_base.hpp>
|
||||
#include <boost/url/params_view.hpp>
|
||||
#include <boost/url/string_view.hpp>
|
||||
#include <boost/core/detail/string_view.hpp>
|
||||
#include <iosfwd>
|
||||
#include <utility>
|
||||
|
||||
@@ -164,7 +164,7 @@ public:
|
||||
*/
|
||||
BOOST_URL_DECL
|
||||
params_encoded_view(
|
||||
string_view s);
|
||||
core::string_view s);
|
||||
|
||||
/** Assignment
|
||||
|
||||
@@ -229,8 +229,8 @@ public:
|
||||
|
||||
BOOST_URL_DECL
|
||||
friend
|
||||
result<params_encoded_view>
|
||||
parse_query(string_view s) noexcept;
|
||||
system::result<params_encoded_view>
|
||||
parse_query(core::string_view s) noexcept;
|
||||
};
|
||||
|
||||
} // urls
|
||||
|
||||
@@ -657,7 +657,7 @@ public:
|
||||
BOOST_URL_DECL
|
||||
std::size_t
|
||||
erase(
|
||||
string_view key,
|
||||
core::string_view key,
|
||||
ignore_case_param ic = {}) noexcept;
|
||||
|
||||
//--------------------------------------------
|
||||
@@ -858,7 +858,7 @@ public:
|
||||
iterator
|
||||
set(
|
||||
iterator pos,
|
||||
string_view value);
|
||||
core::string_view value);
|
||||
|
||||
/** Set a value
|
||||
|
||||
@@ -920,8 +920,8 @@ public:
|
||||
BOOST_URL_DECL
|
||||
iterator
|
||||
set(
|
||||
string_view key,
|
||||
string_view value,
|
||||
core::string_view key,
|
||||
core::string_view value,
|
||||
ignore_case_param ic = {});
|
||||
|
||||
//--------------------------------------------
|
||||
@@ -931,14 +931,14 @@ private:
|
||||
detail::params_iter_impl
|
||||
find_impl(
|
||||
detail::params_iter_impl,
|
||||
string_view,
|
||||
core::string_view,
|
||||
ignore_case_param) const noexcept;
|
||||
|
||||
BOOST_URL_DECL
|
||||
detail::params_iter_impl
|
||||
find_last_impl(
|
||||
detail::params_iter_impl,
|
||||
string_view,
|
||||
core::string_view,
|
||||
ignore_case_param) const noexcept;
|
||||
|
||||
template<class FwdIt>
|
||||
|
||||
@@ -184,7 +184,7 @@ public:
|
||||
*/
|
||||
BOOST_URL_DECL
|
||||
params_view(
|
||||
string_view s);
|
||||
core::string_view s);
|
||||
|
||||
/** Constructor
|
||||
|
||||
@@ -251,7 +251,7 @@ public:
|
||||
*/
|
||||
BOOST_URL_DECL
|
||||
params_view(
|
||||
string_view s,
|
||||
core::string_view s,
|
||||
encoding_opts opt);
|
||||
|
||||
/** Assignment
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace urls {
|
||||
|
||||
@par Example
|
||||
@code
|
||||
result< url_view > rv = parse_absolute_uri( "http://example.com/index.htm?id=1" );
|
||||
system::result< url_view > rv = parse_absolute_uri( "http://example.com/index.htm?id=1" );
|
||||
@endcode
|
||||
|
||||
@par BNF
|
||||
@@ -62,9 +62,9 @@ namespace urls {
|
||||
@ref url_view.
|
||||
*/
|
||||
BOOST_URL_DECL
|
||||
result<url_view>
|
||||
system::result<url_view>
|
||||
parse_absolute_uri(
|
||||
string_view s);
|
||||
core::string_view s);
|
||||
|
||||
//------------------------------------------------
|
||||
|
||||
@@ -81,7 +81,7 @@ parse_absolute_uri(
|
||||
|
||||
@par Example
|
||||
@code
|
||||
result< url_view > = parse_origin_form( "/index.htm?layout=mobile" );
|
||||
system::result< url_view > = parse_origin_form( "/index.htm?layout=mobile" );
|
||||
@endcode
|
||||
|
||||
@par BNF
|
||||
@@ -109,9 +109,9 @@ parse_absolute_uri(
|
||||
@ref url_view.
|
||||
*/
|
||||
BOOST_URL_DECL
|
||||
result<url_view>
|
||||
system::result<url_view>
|
||||
parse_origin_form(
|
||||
string_view s);
|
||||
core::string_view s);
|
||||
|
||||
//------------------------------------------------
|
||||
|
||||
@@ -128,7 +128,7 @@ parse_origin_form(
|
||||
|
||||
@par Example
|
||||
@code
|
||||
result< url_view > = parse_relative_ref( "images/dot.gif?v=hide#a" );
|
||||
system::result< url_view > = parse_relative_ref( "images/dot.gif?v=hide#a" );
|
||||
@endcode
|
||||
|
||||
@par BNF
|
||||
@@ -162,9 +162,9 @@ parse_origin_form(
|
||||
@ref url_view.
|
||||
*/
|
||||
BOOST_URL_DECL
|
||||
result<url_view>
|
||||
system::result<url_view>
|
||||
parse_relative_ref(
|
||||
string_view s);
|
||||
core::string_view s);
|
||||
|
||||
//------------------------------------------------
|
||||
|
||||
@@ -181,7 +181,7 @@ parse_relative_ref(
|
||||
|
||||
@par Example
|
||||
@code
|
||||
result< url_view > = parse_uri( "https://www.example.com/index.htm?id=guest#s1" );
|
||||
system::result< url_view > = parse_uri( "https://www.example.com/index.htm?id=guest#s1" );
|
||||
@endcode
|
||||
|
||||
@par BNF
|
||||
@@ -212,9 +212,9 @@ parse_relative_ref(
|
||||
@ref url_view.
|
||||
*/
|
||||
BOOST_URL_DECL
|
||||
result<url_view>
|
||||
system::result<url_view>
|
||||
parse_uri(
|
||||
string_view s);
|
||||
core::string_view s);
|
||||
|
||||
//------------------------------------------------
|
||||
|
||||
@@ -231,7 +231,7 @@ parse_uri(
|
||||
|
||||
@par Example
|
||||
@code
|
||||
result< url_view > = parse_uri_reference( "ws://echo.example.com/?name=boost#demo" );
|
||||
system::result< url_view > = parse_uri_reference( "ws://echo.example.com/?name=boost#demo" );
|
||||
@endcode
|
||||
|
||||
@par BNF
|
||||
@@ -274,9 +274,9 @@ parse_uri(
|
||||
@ref url_view.
|
||||
*/
|
||||
BOOST_URL_DECL
|
||||
result<url_view>
|
||||
system::result<url_view>
|
||||
parse_uri_reference(
|
||||
string_view s);
|
||||
core::string_view s);
|
||||
|
||||
} // url
|
||||
} // boost
|
||||
|
||||
@@ -45,8 +45,8 @@ namespace urls {
|
||||
@ref segments_encoded_view.
|
||||
*/
|
||||
BOOST_URL_DECL
|
||||
result<segments_encoded_view>
|
||||
parse_path(string_view s) noexcept;
|
||||
system::result<segments_encoded_view>
|
||||
parse_path(core::string_view s) noexcept;
|
||||
|
||||
} // urls
|
||||
} // boost
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include <boost/url/detail/config.hpp>
|
||||
#include <boost/url/error_types.hpp>
|
||||
#include <boost/url/params_encoded_view.hpp>
|
||||
#include <boost/url/string_view.hpp>
|
||||
#include <boost/core/detail/string_view.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace urls {
|
||||
@@ -43,8 +43,8 @@ namespace urls {
|
||||
@ref params_encoded_view.
|
||||
*/
|
||||
BOOST_URL_DECL
|
||||
result<params_encoded_view>
|
||||
parse_query(string_view s) noexcept;
|
||||
system::result<params_encoded_view>
|
||||
parse_query(core::string_view s) noexcept;
|
||||
|
||||
} // urls
|
||||
} // boost
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <boost/url/detail/config.hpp>
|
||||
#include <boost/url/encoding_opts.hpp>
|
||||
#include <boost/url/error_types.hpp>
|
||||
#include <boost/url/string_view.hpp>
|
||||
#include <boost/core/detail/string_view.hpp>
|
||||
#include <boost/url/grammar/string_token.hpp>
|
||||
#include <boost/url/grammar/string_view_base.hpp>
|
||||
#include <cstddef>
|
||||
@@ -37,7 +37,7 @@ make_pct_string_view_unsafe(
|
||||
std::size_t) noexcept;
|
||||
|
||||
namespace detail {
|
||||
string_view&
|
||||
core::string_view&
|
||||
ref(pct_string_view& s) noexcept;
|
||||
} // detail
|
||||
#endif
|
||||
@@ -47,7 +47,7 @@ ref(pct_string_view& s) noexcept;
|
||||
/** A reference to a valid percent-encoded string
|
||||
|
||||
Objects of this type behave like a
|
||||
@ref string_view and have the same interface,
|
||||
@ref core::string_view and have the same interface,
|
||||
but offer an additional invariant: they can
|
||||
only be constructed from strings containing
|
||||
valid percent-escapes.
|
||||
@@ -59,7 +59,7 @@ ref(pct_string_view& s) noexcept;
|
||||
@par Operators
|
||||
The following operators are supported between
|
||||
@ref pct_string_view and any object that is
|
||||
convertible to @ref string_view
|
||||
convertible to @ref core::string_view
|
||||
|
||||
@code
|
||||
bool operator==( pct_string_view, pct_string_view ) noexcept;
|
||||
@@ -83,7 +83,7 @@ class pct_string_view final
|
||||
std::size_t) noexcept;
|
||||
|
||||
friend
|
||||
string_view&
|
||||
core::string_view&
|
||||
detail::ref(pct_string_view&) noexcept;
|
||||
#endif
|
||||
|
||||
@@ -147,11 +147,11 @@ public:
|
||||
|
||||
@par Postconditions
|
||||
@code
|
||||
this->data() == string_view(s).data()
|
||||
this->data() == core::string_view(s).data()
|
||||
@endcode
|
||||
|
||||
@par Complexity
|
||||
Linear in `string_view(s).size()`.
|
||||
Linear in `core::string_view(s).size()`.
|
||||
|
||||
@par Exception Safety
|
||||
Exceptions thrown on invalid input.
|
||||
@@ -159,7 +159,7 @@ public:
|
||||
@throw system_error
|
||||
The string contains an invalid percent encoding.
|
||||
|
||||
@tparam String A type convertible to @ref string_view
|
||||
@tparam String A type convertible to @ref core::string_view
|
||||
|
||||
@param s The string to construct from.
|
||||
*/
|
||||
@@ -169,7 +169,7 @@ public:
|
||||
, class = typename std::enable_if<
|
||||
std::is_convertible<
|
||||
String,
|
||||
string_view
|
||||
core::string_view
|
||||
>::value>::type
|
||||
#endif
|
||||
>
|
||||
@@ -211,7 +211,7 @@ public:
|
||||
char const* s,
|
||||
std::size_t len)
|
||||
: pct_string_view(
|
||||
string_view(s, len))
|
||||
core::string_view(s, len))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -239,7 +239,7 @@ public:
|
||||
*/
|
||||
BOOST_URL_DECL
|
||||
pct_string_view(
|
||||
string_view s);
|
||||
core::string_view s);
|
||||
|
||||
/** Assignment
|
||||
|
||||
@@ -265,9 +265,9 @@ public:
|
||||
|
||||
friend
|
||||
BOOST_URL_DECL
|
||||
result<pct_string_view>
|
||||
system::result<pct_string_view>
|
||||
make_pct_string_view(
|
||||
string_view s) noexcept;
|
||||
core::string_view s) noexcept;
|
||||
|
||||
//--------------------------------------------
|
||||
|
||||
@@ -391,7 +391,7 @@ namespace detail {
|
||||
// underlying string, to handle
|
||||
// self-intersection on modifiers.
|
||||
inline
|
||||
string_view&
|
||||
core::string_view&
|
||||
ref(pct_string_view& s) noexcept
|
||||
{
|
||||
return s.s_;
|
||||
@@ -422,9 +422,9 @@ ref(pct_string_view& s) noexcept
|
||||
@param s The string to validate.
|
||||
*/
|
||||
BOOST_URL_DECL
|
||||
result<pct_string_view>
|
||||
system::result<pct_string_view>
|
||||
make_pct_string_view(
|
||||
string_view s) noexcept;
|
||||
core::string_view s) noexcept;
|
||||
|
||||
#ifndef BOOST_URL_DOCS
|
||||
// VFALCO semi-private for now
|
||||
@@ -437,7 +437,7 @@ make_pct_string_view_unsafe(
|
||||
{
|
||||
#if 0
|
||||
BOOST_ASSERT(! make_pct_string_view(
|
||||
string_view(data, size)).has_error());
|
||||
core::string_view(data, size)).has_error());
|
||||
#endif
|
||||
return pct_string_view(
|
||||
data, size, decoded_size);
|
||||
@@ -448,7 +448,7 @@ make_pct_string_view_unsafe(
|
||||
namespace detail {
|
||||
template <>
|
||||
inline
|
||||
string_view
|
||||
core::string_view
|
||||
to_sv(pct_string_view const& s) noexcept
|
||||
{
|
||||
return s.substr();
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace urls {
|
||||
@par Example
|
||||
Rules are used with the function @ref grammar::parse.
|
||||
@code
|
||||
result< url_view > rv = grammar::parse( "http://example.com/index.htm?id=1", absolute_uri_rule );
|
||||
system::result< url_view > rv = grammar::parse( "http://example.com/index.htm?id=1", absolute_uri_rule );
|
||||
@endcode
|
||||
|
||||
@par BNF
|
||||
@@ -62,7 +62,7 @@ struct absolute_uri_rule_t
|
||||
char const*& it,
|
||||
char const* end
|
||||
) const noexcept ->
|
||||
result<value_type>;
|
||||
system::result<value_type>;
|
||||
};
|
||||
|
||||
constexpr absolute_uri_rule_t absolute_uri_rule{};
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace urls {
|
||||
@par Example
|
||||
Rules are used with the function @ref grammar::parse.
|
||||
@code
|
||||
result< authority_view > rv = grammar::parse( "user:pass@example.com:8080", authority_rule );
|
||||
system::result< authority_view > rv = grammar::parse( "user:pass@example.com:8080", authority_rule );
|
||||
@endcode
|
||||
|
||||
@par BNF
|
||||
@@ -57,7 +57,7 @@ struct authority_rule_t
|
||||
char const*& it,
|
||||
char const* end
|
||||
) const noexcept ->
|
||||
result<value_type>;
|
||||
system::result<value_type>;
|
||||
};
|
||||
|
||||
constexpr authority_rule_t authority_rule{};
|
||||
|
||||
@@ -39,7 +39,7 @@ struct fragment_part_rule_t
|
||||
bool has_fragment = false;
|
||||
};
|
||||
|
||||
result<value_type>
|
||||
system::result<value_type>
|
||||
parse(
|
||||
char const*& it,
|
||||
char const* end
|
||||
|
||||
@@ -46,7 +46,7 @@ struct h16_rule_t
|
||||
char const*& it,
|
||||
char const* end
|
||||
) const noexcept ->
|
||||
result<value_type>;
|
||||
system::result<value_type>;
|
||||
};
|
||||
|
||||
constexpr h16_rule_t h16_rule{};
|
||||
|
||||
@@ -49,7 +49,7 @@ struct hier_part_rule_t
|
||||
char const*& it,
|
||||
char const* const end
|
||||
) const noexcept ->
|
||||
result<value_type>;
|
||||
system::result<value_type>;
|
||||
};
|
||||
|
||||
constexpr hier_part_rule_t hier_part_rule{};
|
||||
|
||||
@@ -42,7 +42,7 @@ struct host_rule_t
|
||||
{
|
||||
urls::host_type host_type =
|
||||
urls::host_type::none;
|
||||
string_view match;
|
||||
core::string_view match;
|
||||
unsigned char addr[16] = {};
|
||||
pct_string_view name;
|
||||
};
|
||||
@@ -52,7 +52,7 @@ struct host_rule_t
|
||||
char const*& it,
|
||||
char const* end
|
||||
) const noexcept ->
|
||||
result<value_type>;
|
||||
system::result<value_type>;
|
||||
};
|
||||
|
||||
constexpr host_rule_t host_rule{};
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <boost/url/detail/config.hpp>
|
||||
#include <boost/url/ipv6_address.hpp>
|
||||
#include <boost/url/error_types.hpp>
|
||||
#include <boost/url/string_view.hpp>
|
||||
#include <boost/core/detail/string_view.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace urls {
|
||||
@@ -39,7 +39,7 @@ struct ip_literal_rule_t
|
||||
{
|
||||
bool is_ipv6 = false;
|
||||
ipv6_address ipv6;
|
||||
string_view ipvfuture;
|
||||
core::string_view ipvfuture;
|
||||
};
|
||||
|
||||
auto
|
||||
@@ -47,7 +47,7 @@ struct ip_literal_rule_t
|
||||
char const*& it,
|
||||
char const* end
|
||||
) const noexcept ->
|
||||
result<value_type>;
|
||||
system::result<value_type>;
|
||||
};
|
||||
|
||||
constexpr ip_literal_rule_t ip_literal_rule{};
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#define BOOST_URL_RFC_DETAIL_IPVFUTURE_RULE_HPP
|
||||
|
||||
#include <boost/url/error_types.hpp>
|
||||
#include <boost/url/string_view.hpp>
|
||||
#include <boost/core/detail/string_view.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace urls {
|
||||
@@ -32,9 +32,9 @@ struct ipvfuture_rule_t
|
||||
{
|
||||
struct value_type
|
||||
{
|
||||
string_view str;
|
||||
string_view major;
|
||||
string_view minor;
|
||||
core::string_view str;
|
||||
core::string_view major;
|
||||
core::string_view minor;
|
||||
};
|
||||
|
||||
auto
|
||||
@@ -42,7 +42,7 @@ struct ipvfuture_rule_t
|
||||
char const*& it,
|
||||
char const* const end
|
||||
) const noexcept ->
|
||||
result<value_type>;
|
||||
system::result<value_type>;
|
||||
};
|
||||
|
||||
constexpr ipvfuture_rule_t ipvfuture_rule{};
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user