libs/http/src/detail/zlib_filter_base.hpp
0.0% Lines (0/10)
0.0% Functions (0/2)
0.0% Branches (0/2)
libs/http/src/detail/zlib_filter_base.hpp
| Line | Hits | Source Code |
|---|---|---|
| 1 | // | |
| 2 | // Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) | |
| 3 | // Copyright (c) 2024 Mohammad Nejati | |
| 4 | // | |
| 5 | // Distributed under the Boost Software License, Version 1.0. (See accompanying | |
| 6 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
| 7 | // | |
| 8 | // Official repository: https://github.com/cppalliance/buffers | |
| 9 | // | |
| 10 | ||
| 11 | #ifndef BOOST_HTTP_DETAIL_ZLIB_FILTER_BASE_HPP | |
| 12 | #define BOOST_HTTP_DETAIL_ZLIB_FILTER_BASE_HPP | |
| 13 | ||
| 14 | #include "src/detail/filter.hpp" | |
| 15 | ||
| 16 | #include <boost/http/zlib/stream.hpp> | |
| 17 | #include <boost/http/zlib/flush.hpp> | |
| 18 | ||
| 19 | namespace boost { | |
| 20 | namespace http { | |
| 21 | namespace detail { | |
| 22 | ||
| 23 | /** Base class for zlib filters | |
| 24 | */ | |
| 25 | class zlib_filter_base : public filter | |
| 26 | { | |
| 27 | public: | |
| 28 | ✗ | zlib_filter_base() |
| 29 | ✗ | { |
| 30 | ✗ | strm_.zalloc = nullptr; |
| 31 | ✗ | strm_.zfree = nullptr; |
| 32 | ✗ | strm_.opaque = nullptr; |
| 33 | ✗ | } |
| 34 | ||
| 35 | protected: | |
| 36 | http::zlib::stream strm_; | |
| 37 | ||
| 38 | static | |
| 39 | unsigned int | |
| 40 | ✗ | saturate_cast(std::size_t n) noexcept |
| 41 | { | |
| 42 | ✗ | if(n >= std::numeric_limits<unsigned int>::max()) |
| 43 | ✗ | return std::numeric_limits<unsigned int>::max(); |
| 44 | ✗ | return static_cast<unsigned int>(n); |
| 45 | } | |
| 46 | }; | |
| 47 | ||
| 48 | } // detail | |
| 49 | } // http | |
| 50 | } // boost | |
| 51 | ||
| 52 | #endif | |
| 53 |