Add stream_traits.hpp:

get_lowest_layer, lowest_layer_type are located here now.
This commit is contained in:
Vinnie Falco
2019-02-04 20:06:56 -08:00
parent 4b7c33d781
commit 42d83b221a
8 changed files with 22 additions and 16 deletions

View File

@@ -3,6 +3,7 @@ Version 210:
* Tidy up read implementation
* Fix stable_async_op_base javadoc
* Better handling of stream timeouts
* Add stream_traits.hpp
--------------------------------------------------------------------------------

View File

@@ -33,7 +33,6 @@
#include <boost/beast/core/file_win32.hpp>
#include <boost/beast/core/flat_buffer.hpp>
#include <boost/beast/core/flat_static_buffer.hpp>
#include <boost/beast/core/get_lowest_layer.hpp>
#include <boost/beast/core/handler_ptr.hpp>
#include <boost/beast/core/make_printable.hpp>
#include <boost/beast/core/multi_buffer.hpp>
@@ -42,6 +41,7 @@
#include <boost/beast/core/span.hpp>
#include <boost/beast/core/static_buffer.hpp>
#include <boost/beast/core/static_string.hpp>
#include <boost/beast/core/stream_traits.hpp>
#include <boost/beast/core/string.hpp>
#include <boost/beast/core/string_param.hpp>
#include <boost/beast/core/timeout_stream.hpp>

View File

@@ -7,8 +7,8 @@
// Official repository: https://github.com/boostorg/beast
//
#ifndef BOOST_BEAST_DETAIL_GET_LOWEST_LAYER_HPP
#define BOOST_BEAST_DETAIL_GET_LOWEST_LAYER_HPP
#ifndef BOOST_BEAST_DETAIL_STREAM_TRAITS_HPP
#define BOOST_BEAST_DETAIL_STREAM_TRAITS_HPP
#include <boost/type_traits/make_void.hpp>
#include <type_traits>
@@ -17,6 +17,13 @@ namespace boost {
namespace beast {
namespace detail {
//------------------------------------------------------------------------------
//
// get_lowest_layer
// lowest_layer_type
// detail::has_next_layer
//
template <class T>
std::false_type has_next_layer_impl(void*) {}
@@ -29,8 +36,6 @@ auto has_next_layer_impl(decltype(nullptr)) ->
template <class T>
using has_next_layer = decltype(has_next_layer_impl<T>(nullptr));
//---
template<class T, bool = has_next_layer<T>::value>
struct lowest_layer_type_impl
{
@@ -48,8 +53,6 @@ template<class T>
using lowest_layer_type = typename
lowest_layer_type_impl<T>::type;
//---
template<class T>
T&
get_lowest_layer_impl(
@@ -68,6 +71,8 @@ get_lowest_layer_impl(
decltype(t.next_layer())>::type>{});
}
//------------------------------------------------------------------------------
} // detail
} // beast
} // boost

View File

@@ -7,11 +7,11 @@
// Official repository: https://github.com/boostorg/beast
//
#ifndef BOOST_BEAST_GET_LOWEST_LAYER_HPP
#define BOOST_BEAST_GET_LOWEST_LAYER_HPP
#ifndef BOOST_BEAST_STREAM_TRAITS_HPP
#define BOOST_BEAST_STREAM_TRAITS_HPP
#include <boost/beast/core/detail/config.hpp>
#include <boost/beast/core/detail/get_lowest_layer.hpp>
#include <boost/beast/core/detail/stream_traits.hpp>
namespace boost {
namespace beast {

View File

@@ -50,7 +50,6 @@ add_executable (tests-beast-core
file_win32.cpp
flat_buffer.cpp
flat_static_buffer.cpp
get_lowest_layer.cpp
handler_ptr.cpp
make_printable.cpp
multi_buffer.cpp
@@ -60,6 +59,7 @@ add_executable (tests-beast-core
span.cpp
static_buffer.cpp
static_string.cpp
stream_traits.cpp
string.cpp
string_param.cpp
timeout_stream.cpp

View File

@@ -38,7 +38,6 @@ local SOURCES =
file_win32.cpp
flat_buffer.cpp
flat_static_buffer.cpp
get_lowest_layer.cpp
handler_ptr.cpp
make_printable.cpp
multi_buffer.cpp
@@ -48,6 +47,7 @@ local SOURCES =
span.cpp
static_buffer.cpp
static_string.cpp
stream_traits.cpp
string.cpp
string_param.cpp
timeout_stream.cpp

View File

@@ -12,7 +12,7 @@
#include <boost/beast/_experimental/unit_test/suite.hpp>
#include <boost/beast/_experimental/test/stream.hpp>
#include <boost/beast/core/get_lowest_layer.hpp>
#include <boost/beast/core/stream_traits.hpp>
#include <boost/beast/core/string.hpp>
#include <boost/asio/ip/tcp.hpp>

View File

@@ -8,7 +8,7 @@
//
// Test that header file is self-contained.
#include <boost/beast/core/get_lowest_layer.hpp>
#include <boost/beast/core/stream_traits.hpp>
#include <boost/beast/_experimental/unit_test/suite.hpp>
#include <boost/beast/core/error.hpp>
@@ -17,7 +17,7 @@
namespace boost {
namespace beast {
class get_lowest_layer_test
class stream_traits_test
: public beast::unit_test::suite
{
public:
@@ -186,7 +186,7 @@ public:
}
};
BEAST_DEFINE_TESTSUITE(beast,core,get_lowest_layer);
BEAST_DEFINE_TESTSUITE(beast,core,stream_traits);
} // beast
} // boost