More split compilation in rfc7230.hpp

* Moved `find` and `exists` to the `ipp` file.
* Fixed missing include file in MSVC.

Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
This commit is contained in:
Damian Jarek
2019-06-21 19:06:26 +02:00
parent 048fe16fa3
commit 50ce5f7396
4 changed files with 43 additions and 40 deletions

View File

@@ -1,3 +1,9 @@
Version 260:
* More split compilation in rfc7230.hpp
--------------------------------------------------------------------------------
Version 259:
* Reduce the number of instantiations of filter_token_list

View File

@@ -244,27 +244,6 @@ cend() const ->
return const_iterator{s_.end(), s_.end()};
}
template<class T>
auto
ext_list::
find(T const& s) ->
const_iterator
{
return std::find_if(begin(), end(),
[&s](value_type const& v)
{
return iequals(s, v.first);
});
}
template<class T>
bool
ext_list::
exists(T const& s)
{
return find(s) != end();
}
//------------------------------------------------------------------------------
@@ -378,19 +357,6 @@ cend() const ->
return const_iterator{s_.end(), s_.end()};
}
template<class T>
bool
token_list::
exists(T const& s)
{
return std::find_if(begin(), end(),
[&s](value_type const& v)
{
return iequals(s, v);
}
) != end();
}
template<class Policy>
bool
validate_list(detail::basic_parsed_list<

View File

@@ -11,6 +11,7 @@
#define BOOST_BEAST_HTTP_IMPL_RFC7230_IPP
#include <boost/beast/http/rfc7230.hpp>
#include <algorithm>
namespace boost {
namespace beast {
@@ -123,6 +124,24 @@ increment()
}
}
auto
ext_list::
find(string_view const& s) -> const_iterator
{
return std::find_if(begin(), end(),
[&s](value_type const& v)
{
return beast::iequals(s, v.first);
});
}
bool
ext_list::
exists(string_view const& s)
{
return find(s) != end();
}
void
token_list::const_iterator::
increment()
@@ -169,6 +188,18 @@ increment()
}
}
bool
token_list::
exists(string_view const& s)
{
return std::find_if(begin(), end(),
[&s](value_type const& v)
{
return beast::iequals(s, v);
}
) != end();
}
} // http
} // beast
} // boost

View File

@@ -190,17 +190,17 @@ public:
@return An iterator to the matching token, or `end()` if no
token exists.
*/
template<class T>
BOOST_BEAST_DECL
const_iterator
find(T const& s);
find(string_view const& s);
/** Return `true` if a token is present in the list.
@param s The token to find. A case-insensitive comparison is used.
*/
template<class T>
BOOST_BEAST_DECL
bool
exists(T const& s);
exists(string_view const& s);
};
//------------------------------------------------------------------------------
@@ -275,9 +275,9 @@ public:
@param s The token to find. A case-insensitive comparison is used.
*/
template<class T>
BOOST_BEAST_DECL
bool
exists(T const& s);
exists(string_view const& s);
};
/** A list of tokens in a comma separated HTTP field value.