src/detail/encoder.hpp

100.0% Lines (1/1) 100.0% List of functions (1/1) -% Branches (0/0)
encoder.hpp
f(x) Functions (1)
Line TLA Hits Source Code
1 //
2 // Copyright (c) 2026 Mohammad Nejati
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 // Official repository: https://github.com/cppalliance/burl
8 //
9
10 #ifndef BOOST_BURL_SRC_DETAIL_ENCODER_HPP
11 #define BOOST_BURL_SRC_DETAIL_ENCODER_HPP
12
13 #include <boost/burl/encoder_config.hpp>
14
15 #include <boost/capy/buffers.hpp>
16 #include <boost/http/metadata.hpp>
17
18 #include <cstddef>
19 #include <memory>
20 #include <system_error>
21
22 namespace boost
23 {
24 namespace burl
25 {
26 namespace detail
27 {
28
29 struct encoder
30 {
31 struct result
32 {
33 std::size_t consumed;
34 std::size_t produced;
35 std::error_code ec;
36 };
37
38 105x virtual ~encoder() = default;
39
40 virtual result
41 process(
42 capy::mutable_buffer out,
43 capy::const_buffer in,
44 bool more) = 0;
45 };
46
47 std::unique_ptr<encoder>
48 make_encoder(
49 http::content_coding coding,
50 encoder_config const& cfg);
51
52 } // namespace detail
53 } // namespace burl
54 } // namespace boost
55
56 #endif
57