This repository has been archived by the owner on Jul 7, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
beast: Add version 111 of boost beast
- Loading branch information
Teddy Reed
committed
Oct 23, 2017
1 parent
e6e6664
commit 026c5c1
Showing
144 changed files
with
49,301 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
Boost Software License - Version 1.0 - August 17th, 2003 | ||
|
||
Permission is hereby granted, free of charge, to any person or organization | ||
obtaining a copy of the software and accompanying documentation covered by | ||
this license (the "Software") to use, reproduce, display, distribute, | ||
execute, and transmit the Software, and to prepare derivative works of the | ||
Software, and to permit third-parties to whom the Software is furnished to | ||
do so, all subject to the following: | ||
|
||
The copyright notices in the Software and this entire statement, including | ||
the above license grant, this restriction and the following disclaimer, | ||
must be included in all copies of the Software, in whole or in part, and | ||
all derivative works of the Software, unless such copies or derivative | ||
works are solely in the form of machine-executable object code generated by | ||
a source language processor. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT | ||
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE | ||
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, | ||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// | ||
// Copyright (c) 2013-2017 Vinnie Falco (vinnie dot falco at gmail dot com) | ||
// | ||
// Distributed under the Boost Software License, Version 1.0. (See accompanying | ||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | ||
// | ||
// Official repository: https://github.com/boostorg/beast | ||
// | ||
|
||
#ifndef BOOST_BEAST_HPP | ||
#define BOOST_BEAST_HPP | ||
|
||
#include <boost/beast/config.hpp> // must come first | ||
|
||
#include <boost/beast/core.hpp> | ||
#include <boost/beast/http.hpp> | ||
#include <boost/beast/version.hpp> | ||
#include <boost/beast/websocket.hpp> | ||
#include <boost/beast/zlib.hpp> | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// | ||
// Copyright (c) 2016-2017 Vinnie Falco (vinnie dot falco at gmail dot com) | ||
// | ||
// Distributed under the Boost Software License, Version 1.0. (See accompanying | ||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | ||
// | ||
// Official repository: https://github.com/boostorg/beast | ||
// | ||
|
||
#ifndef BOOST_BEAST_CONFIG_HPP | ||
#define BOOST_BEAST_CONFIG_HPP | ||
|
||
// Available to every header | ||
#include <boost/config.hpp> | ||
#include <boost/core/ignore_unused.hpp> | ||
#include <boost/static_assert.hpp> | ||
|
||
/* | ||
_MSC_VER and _MSC_FULL_VER by version: | ||
14.0 (2015) 1900 190023026 | ||
14.0 (2015 Update 1) 1900 190023506 | ||
14.0 (2015 Update 2) 1900 190023918 | ||
14.0 (2015 Update 3) 1900 190024210 | ||
*/ | ||
|
||
#if defined(BOOST_MSVC) | ||
# if BOOST_MSVC_FULL_VER < 190024210 | ||
# error Beast requires C++11: Visual Studio 2015 Update 3 or later needed | ||
# endif | ||
|
||
#elif defined(BOOST_GCC) | ||
# if(BOOST_GCC < 40801) | ||
# error Beast requires C++11: gcc version 4.8 or later needed | ||
# endif | ||
|
||
#else | ||
# if \ | ||
defined(BOOST_NO_CXX11_DECLTYPE) || \ | ||
defined(BOOST_NO_CXX11_HDR_TUPLE) || \ | ||
defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) || \ | ||
defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) | ||
# error Beast requires C++11: a conforming compiler is needed | ||
# endif | ||
|
||
#endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// | ||
// Copyright (c) 2016-2017 Vinnie Falco (vinnie dot falco at gmail dot com) | ||
// | ||
// Distributed under the Boost Software License, Version 1.0. (See accompanying | ||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | ||
// | ||
// Official repository: https://github.com/boostorg/beast | ||
// | ||
|
||
#ifndef BOOST_BEAST_CORE_HPP | ||
#define BOOST_BEAST_CORE_HPP | ||
|
||
#include <boost/beast/config.hpp> | ||
|
||
#include <boost/beast/core/async_result.hpp> | ||
#include <boost/beast/core/bind_handler.hpp> | ||
#include <boost/beast/core/buffer_cat.hpp> | ||
#include <boost/beast/core/buffer_prefix.hpp> | ||
#include <boost/beast/core/buffered_read_stream.hpp> | ||
#include <boost/beast/core/buffers_adapter.hpp> | ||
#include <boost/beast/core/consuming_buffers.hpp> | ||
#include <boost/beast/core/error.hpp> | ||
#include <boost/beast/core/file.hpp> | ||
#include <boost/beast/core/file_base.hpp> | ||
#include <boost/beast/core/file_posix.hpp> | ||
#include <boost/beast/core/file_stdio.hpp> | ||
#include <boost/beast/core/file_win32.hpp> | ||
#include <boost/beast/core/flat_buffer.hpp> | ||
#include <boost/beast/core/handler_alloc.hpp> | ||
#include <boost/beast/core/handler_ptr.hpp> | ||
#include <boost/beast/core/multi_buffer.hpp> | ||
#include <boost/beast/core/ostream.hpp> | ||
#include <boost/beast/core/read_size.hpp> | ||
#include <boost/beast/core/span.hpp> | ||
#include <boost/beast/core/flat_static_buffer.hpp> | ||
#include <boost/beast/core/static_string.hpp> | ||
#include <boost/beast/core/string.hpp> | ||
#include <boost/beast/core/string_param.hpp> | ||
#include <boost/beast/core/type_traits.hpp> | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,209 @@ | ||
// | ||
// Copyright (c) 2016-2017 Vinnie Falco (vinnie dot falco at gmail dot com) | ||
// | ||
// Distributed under the Boost Software License, Version 1.0. (See accompanying | ||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | ||
// | ||
// Official repository: https://github.com/boostorg/beast | ||
// | ||
|
||
#ifndef BOOST_BEAST_ASYNC_COMPLETION_HPP | ||
#define BOOST_BEAST_ASYNC_COMPLETION_HPP | ||
|
||
#include <boost/beast/config.hpp> | ||
#include <boost/beast/core/type_traits.hpp> | ||
#include <boost/asio/async_result.hpp> | ||
#include <boost/asio/handler_type.hpp> | ||
#include <type_traits> | ||
#include <utility> | ||
|
||
namespace boost { | ||
namespace beast { | ||
|
||
/** An interface for customising the behaviour of an asynchronous initiation function. | ||
This class is used for determining: | ||
@li The concrete completion handler type to be called at the end of the | ||
asynchronous operation; | ||
@li the initiating function return type; and | ||
@li how the return value of the initiating function is obtained. | ||
The trait allows the handler and return types to be determined at the point | ||
where the specific completion handler signature is known. | ||
This template takes advantage of specializations of both | ||
`boost::asio::async_result` and `boost::asio::handler_type` for user-defined | ||
completion token types. The primary template assumes that the | ||
@b CompletionToken is the completion handler. | ||
@par Example | ||
The example shows how to define an asynchronous initiation function | ||
whose completion handler receives an error code: | ||
@code | ||
template< | ||
class AsyncStream, // A stream supporting asynchronous read and write | ||
class Handler // The handler to call with signature void(error_code) | ||
> | ||
async_return_type< // This provides the return type customization | ||
Handler, void(error_code)> | ||
do_async( | ||
AsyncStream& stream, // The stream to work on | ||
Handler&& handler) // Could be an rvalue or const reference | ||
{ | ||
// Make sure we have an async stream | ||
static_assert(is_async_stream<AsyncWriteStream>::value, | ||
"AsyncStream requirements not met"); | ||
// This helper converts the handler into the real handler type | ||
async_completion<WriteHandler, void(error_code)> init{handler}; | ||
... // Create and invoke the composed operation | ||
// This provides the return value and executor customization | ||
return init.result.get(); | ||
} | ||
@endcode | ||
@see @ref async_completion, @ref async_return_type, @ref handler_type | ||
*/ | ||
template<class CompletionToken, class Signature> | ||
class async_result | ||
{ | ||
BOOST_STATIC_ASSERT( | ||
! std::is_reference<CompletionToken>::value); | ||
|
||
boost::asio::async_result<typename | ||
boost::asio::handler_type<CompletionToken, | ||
Signature>::type> impl_; | ||
|
||
async_result(async_result const&) = delete; | ||
async_result& operator=(async_result const&) = delete; | ||
|
||
public: | ||
/// The concrete completion handler type for the specific signature. | ||
using completion_handler_type = | ||
typename boost::asio::handler_type< | ||
CompletionToken, Signature>::type; | ||
|
||
/// The return type of the initiating function. | ||
using return_type = | ||
typename boost::asio::async_result< | ||
completion_handler_type>::type; | ||
|
||
/** Construct an async result from a given handler. | ||
When using a specalised async_result, the constructor has | ||
an opportunity to initialise some state associated with the | ||
completion handler, which is then returned from the initiating | ||
function. | ||
*/ | ||
explicit | ||
async_result(completion_handler_type& h) | ||
: impl_(h) | ||
{ | ||
} | ||
|
||
/// Obtain the value to be returned from the initiating function. | ||
return_type | ||
get() | ||
{ | ||
return impl_.get(); | ||
} | ||
}; | ||
|
||
/** Helper for customizing the return type of asynchronous initiation functions. | ||
This class template is used to transform caller-provided completion | ||
handlers in calls to asynchronous initiation functions. The transformation | ||
allows customization of the return type of the initiating function, and the | ||
function signature of the final handler. | ||
Example: | ||
@code | ||
... | ||
template<class CompletionToken> | ||
typename async_completion<CompletionToken, void(error_code)>::result_type | ||
async_initfn(..., CompletionToken&& handler) | ||
{ | ||
async_completion<CompletionToken, void(error_code)> completion{handler}; | ||
... | ||
return completion.result.get(); | ||
} | ||
@endcode | ||
@tparam CompletionToken Specifies the model used to obtain the result of | ||
the asynchronous operation. | ||
@tparam Signature The call signature for the completion handler type invoked | ||
on completion of the asynchronous operation. | ||
@note See <a href="http://cplusplus.github.io/networking-ts/draft.pdf"> | ||
Working Draft, C++ Extensions for Networking</a> | ||
@see @ref async_return_type, @ref handler_type | ||
*/ | ||
template<class CompletionToken, class Signature> | ||
struct async_completion | ||
{ | ||
/** The type of the final handler called by the asynchronous initiation function. | ||
Objects of this type will be callable with the specified signature. | ||
*/ | ||
using completion_handler_type = typename async_result< | ||
typename std::decay<CompletionToken>::type, | ||
Signature>::completion_handler_type; | ||
|
||
/** Constructor | ||
The constructor creates the concrete completion handler and | ||
makes the link between the handler and the asynchronous | ||
result. | ||
@param token The completion token. If this is a regular completion | ||
handler, copies may be made as needed. If the handler is movable, | ||
it may also be moved. | ||
*/ | ||
explicit | ||
async_completion(CompletionToken& token) | ||
: completion_handler(static_cast<typename std::conditional< | ||
std::is_same<CompletionToken, completion_handler_type>::value, | ||
completion_handler_type&, CompletionToken&&>::type>(token)) | ||
, result(completion_handler) | ||
{ | ||
// CompletionToken is not invokable with the given signature | ||
static_assert(is_completion_handler< | ||
completion_handler_type, Signature>::value, | ||
"CompletionToken requirements not met: signature mismatch"); | ||
} | ||
|
||
/// The final completion handler, callable with the specified signature. | ||
typename std::conditional<std::is_same< | ||
CompletionToken, completion_handler_type>::value, | ||
completion_handler_type&, | ||
completion_handler_type | ||
>::type completion_handler; | ||
|
||
/// The return value of the asynchronous initiation function. | ||
async_result<typename std::decay< | ||
CompletionToken>::type, Signature> result; | ||
}; | ||
|
||
template<class CompletionToken, typename Signature> | ||
using handler_type = typename beast::async_result< | ||
typename std::decay<CompletionToken>::type, | ||
Signature>::completion_handler_type; | ||
|
||
template<class CompletionToken, typename Signature> | ||
using async_return_type = typename beast::async_result< | ||
typename std::decay<CompletionToken>::type, | ||
Signature>::return_type; | ||
|
||
} // beast | ||
} // boost | ||
|
||
#endif |
Oops, something went wrong.