From 42d83b221a6fc54429507e857b891ac1650663f1 Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Mon, 4 Feb 2019 20:06:56 -0800 Subject: [PATCH] Add stream_traits.hpp: get_lowest_layer, lowest_layer_type are located here now. --- CHANGELOG.md | 1 + include/boost/beast/core.hpp | 2 +- .../{get_lowest_layer.hpp => stream_traits.hpp} | 17 +++++++++++------ .../{get_lowest_layer.hpp => stream_traits.hpp} | 6 +++--- test/beast/core/CMakeLists.txt | 2 +- test/beast/core/Jamfile | 2 +- test/beast/core/close_socket.cpp | 2 +- .../{get_lowest_layer.cpp => stream_traits.cpp} | 6 +++--- 8 files changed, 22 insertions(+), 16 deletions(-) rename include/boost/beast/core/detail/{get_lowest_layer.hpp => stream_traits.hpp} (82%) rename include/boost/beast/core/{get_lowest_layer.hpp => stream_traits.hpp} (95%) rename test/beast/core/{get_lowest_layer.cpp => stream_traits.cpp} (97%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8dd001ea..326d00d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 -------------------------------------------------------------------------------- diff --git a/include/boost/beast/core.hpp b/include/boost/beast/core.hpp index 374b63ab..5e2ab241 100644 --- a/include/boost/beast/core.hpp +++ b/include/boost/beast/core.hpp @@ -33,7 +33,6 @@ #include #include #include -#include #include #include #include @@ -42,6 +41,7 @@ #include #include #include +#include #include #include #include diff --git a/include/boost/beast/core/detail/get_lowest_layer.hpp b/include/boost/beast/core/detail/stream_traits.hpp similarity index 82% rename from include/boost/beast/core/detail/get_lowest_layer.hpp rename to include/boost/beast/core/detail/stream_traits.hpp index 12bd3776..90e1fcf4 100644 --- a/include/boost/beast/core/detail/get_lowest_layer.hpp +++ b/include/boost/beast/core/detail/stream_traits.hpp @@ -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 #include @@ -17,6 +17,13 @@ namespace boost { namespace beast { namespace detail { +//------------------------------------------------------------------------------ +// +// get_lowest_layer +// lowest_layer_type +// detail::has_next_layer +// + template std::false_type has_next_layer_impl(void*) {} @@ -29,8 +36,6 @@ auto has_next_layer_impl(decltype(nullptr)) -> template using has_next_layer = decltype(has_next_layer_impl(nullptr)); -//--- - template::value> struct lowest_layer_type_impl { @@ -48,8 +53,6 @@ template using lowest_layer_type = typename lowest_layer_type_impl::type; -//--- - template T& get_lowest_layer_impl( @@ -68,6 +71,8 @@ get_lowest_layer_impl( decltype(t.next_layer())>::type>{}); } +//------------------------------------------------------------------------------ + } // detail } // beast } // boost diff --git a/include/boost/beast/core/get_lowest_layer.hpp b/include/boost/beast/core/stream_traits.hpp similarity index 95% rename from include/boost/beast/core/get_lowest_layer.hpp rename to include/boost/beast/core/stream_traits.hpp index 2ca3e77a..aaae224f 100644 --- a/include/boost/beast/core/get_lowest_layer.hpp +++ b/include/boost/beast/core/stream_traits.hpp @@ -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 -#include +#include namespace boost { namespace beast { diff --git a/test/beast/core/CMakeLists.txt b/test/beast/core/CMakeLists.txt index 4e15788e..a3e711d9 100644 --- a/test/beast/core/CMakeLists.txt +++ b/test/beast/core/CMakeLists.txt @@ -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 diff --git a/test/beast/core/Jamfile b/test/beast/core/Jamfile index 7cff93d5..8a36dc0e 100644 --- a/test/beast/core/Jamfile +++ b/test/beast/core/Jamfile @@ -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 diff --git a/test/beast/core/close_socket.cpp b/test/beast/core/close_socket.cpp index 13229128..f01a3d46 100644 --- a/test/beast/core/close_socket.cpp +++ b/test/beast/core/close_socket.cpp @@ -12,7 +12,7 @@ #include #include -#include +#include #include #include diff --git a/test/beast/core/get_lowest_layer.cpp b/test/beast/core/stream_traits.cpp similarity index 97% rename from test/beast/core/get_lowest_layer.cpp rename to test/beast/core/stream_traits.cpp index 7cb784f2..3cd55ae7 100644 --- a/test/beast/core/get_lowest_layer.cpp +++ b/test/beast/core/stream_traits.cpp @@ -8,7 +8,7 @@ // // Test that header file is self-contained. -#include +#include #include #include @@ -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