]> git.proxmox.com Git - ceph.git/blob - ceph/src/Beast/include/beast/core/write_dynabuf.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / Beast / include / beast / core / write_dynabuf.hpp
1 //
2 // Copyright (c) 2013-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
3 //
4 // Distributed under the Boost Software License, Version 1.0. (See accompanying
5 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 //
7
8 #ifndef BEAST_WRITE_DYNABUF_HPP
9 #define BEAST_WRITE_DYNABUF_HPP
10
11 #include <beast/config.hpp>
12 #include <beast/core/buffer_concepts.hpp>
13 #include <beast/core/detail/write_dynabuf.hpp>
14 #include <type_traits>
15 #include <utility>
16
17 namespace beast {
18
19 /** Write to a @b `DynamicBuffer`.
20
21 This function appends the serialized representation of each provided
22 argument into the dynamic buffer. It is capable of converting the
23 following types of arguments:
24
25 @li `boost::asio::const_buffer`
26
27 @li `boost::asio::mutable_buffer`
28
29 @li A type meeting the requirements of @b `ConvertibleToConstBuffer`
30
31 @li A type meeting the requirements of @b `ConstBufferSequence`
32
33 @li A type meeting the requirements of @b `MutableBufferSequence`
34
35 For all types not listed above, the function will invoke
36 `boost::lexical_cast` on the argument in an attempt to convert to
37 a string, which is then appended to the dynamic buffer.
38
39 When this function serializes numbers, it converts them to
40 their text representation as if by a call to `std::to_string`.
41
42 @param dynabuf The dynamic buffer to write to.
43
44 @param args A list of one or more arguments to write.
45
46 @throws unspecified Any exceptions thrown by `boost::lexical_cast`.
47
48 @note This function participates in overload resolution only if
49 the `dynabuf` parameter meets the requirements of @b `DynamicBuffer`.
50 */
51 template<class DynamicBuffer, class... Args>
52 #if BEAST_DOXYGEN
53 void
54 #else
55 typename std::enable_if<is_DynamicBuffer<DynamicBuffer>::value>::type
56 #endif
57 write(DynamicBuffer& dynabuf, Args const&... args)
58 {
59 detail::write_dynabuf(dynabuf, args...);
60 }
61
62 } // beast
63
64 #endif