Use beast::string_view alias

This commit is contained in:
Vinnie Falco committed 2017-07-20 08:12:16 -07:00
1 parent f50a37b778
commit 84ece031f2
36 files changed
+319 -288

No files matched your search

+7 -7
View File
@@ -261,7 +261,7 @@ consume_body(error_code& ec)
template<bool isRequest, bool isDirect, class Derived>
template<class ConstBufferSequence>
inline
boost::string_ref
string_view
basic_parser<isRequest, isDirect, Derived>::
maybe_flatten(
ConstBufferSequence const& buffers)
@@ -552,7 +552,7 @@ parse_fields(char const*& it,
it = term;
}
}
boost::string_ref value{
string_view value{
s.data(), s.size()};
do_field(name, value, ec);
if(ec)
@@ -568,8 +568,8 @@ template<bool isRequest, bool isDirect, class Derived>
void
basic_parser<isRequest, isDirect, Derived>::
do_field(
boost::string_ref const& name,
boost::string_ref const& value,
string_view const& name,
string_view const& value,
error_code& ec)
{
// Connection
@@ -996,7 +996,7 @@ parse_body(char const* p,
std::size_t n, error_code& ec)
{
n = beast::detail::clamp(len_, n);
body_ = boost::string_ref{p, n};
body_ = string_view{p, n};
impl().on_data(body_, ec);
if(ec)
return 0;
@@ -1017,7 +1017,7 @@ basic_parser<isRequest, isDirect, Derived>::
parse_body_to_eof(char const* p,
std::size_t n, error_code& ec)
{
body_ = boost::string_ref{p, n};
body_ = string_view{p, n};
impl().on_data(body_, ec);
if(ec)
return 0;
@@ -1032,7 +1032,7 @@ parse_chunk_body(char const* p,
std::size_t n, error_code& ec)
{
n = beast::detail::clamp(len_, n);
body_ = boost::string_ref{p, n};
body_ = string_view{p, n};
impl().on_data(body_, ec);
if(ec)
return 0;
+9 -9
View File
@@ -170,7 +170,7 @@ basic_fields(FwdIt first, FwdIt last)
template<class Allocator>
std::size_t
basic_fields<Allocator>::
count(boost::string_ref const& name) const
count(string_view const& name) const
{
auto const it = set_.find(name, less{});
if(it == set_.end())
@@ -182,7 +182,7 @@ count(boost::string_ref const& name) const
template<class Allocator>
auto
basic_fields<Allocator>::
find(boost::string_ref const& name) const ->
find(string_view const& name) const ->
iterator
{
auto const it = set_.find(name, less{});
@@ -192,9 +192,9 @@ find(boost::string_ref const& name) const ->
}
template<class Allocator>
boost::string_ref const
string_view const
basic_fields<Allocator>::
operator[](boost::string_ref const& name) const
operator[](string_view const& name) const
{
auto const it = find(name);
if(it == end())
@@ -215,7 +215,7 @@ clear() noexcept
template<class Allocator>
std::size_t
basic_fields<Allocator>::
erase(boost::string_ref const& name)
erase(string_view const& name)
{
auto it = set_.find(name, less{});
if(it == set_.end())
@@ -239,8 +239,8 @@ erase(boost::string_ref const& name)
template<class Allocator>
void
basic_fields<Allocator>::
insert(boost::string_ref const& name,
boost::string_ref value)
insert(string_view const& name,
string_view value)
{
value = detail::trim(value);
auto const p = alloc_traits::allocate(this->member(), 1);
@@ -252,8 +252,8 @@ insert(boost::string_ref const& name,
template<class Allocator>
void
basic_fields<Allocator>::
replace(boost::string_ref const& name,
boost::string_ref value)
replace(string_view const& name,
string_view value)
{
value = detail::trim(value);
erase(name);
+7 -7
View File
@@ -17,7 +17,7 @@ namespace http {
class param_list::const_iterator
{
using iter_type = boost::string_ref::const_iterator;
using iter_type = string_view::const_iterator;
std::string s_;
detail::param_iter pi_;
@@ -87,7 +87,7 @@ private:
template<class = void>
static
std::string
unquote(boost::string_ref const& sr);
unquote(string_view const& sr);
template<class = void>
void
@@ -133,7 +133,7 @@ cend() const ->
template<class>
std::string
param_list::const_iterator::
unquote(boost::string_ref const& sr)
unquote(string_view const& sr)
{
std::string s;
s.reserve(sr.size());
@@ -165,7 +165,7 @@ increment()
pi_.v.second.front() == '"')
{
s_ = unquote(pi_.v.second);
pi_.v.second = boost::string_ref{
pi_.v.second = string_view{
s_.data(), s_.size()};
}
}
@@ -346,7 +346,7 @@ increment()
if(! detail::is_tchar(*it_))
break;
}
v_.first = boost::string_ref{&*p0,
v_.first = string_view{&*p0,
static_cast<std::size_t>(it_ - p0)};
detail::param_iter pi;
pi.it = it_;
@@ -358,7 +358,7 @@ increment()
if(pi.empty())
break;
}
v_.second = param_list{boost::string_ref{&*it_,
v_.second = param_list{string_view{&*it_,
static_cast<std::size_t>(pi.it - it_)}};
it_ = pi.it;
return;
@@ -518,7 +518,7 @@ increment()
if(! detail::is_tchar(*it_))
break;
}
v_ = boost::string_ref{&*p0,
v_ = string_view{&*p0,
static_cast<std::size_t>(it_ - p0)};
return;
}