| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // | ||
| 2 | // Copyright (c) 2025 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 | // Official repository: https://github.com/cppalliance/buffers | ||
| 8 | // | ||
| 9 | |||
| 10 | #include <boost/buffers/any_source.hpp> | ||
| 11 | |||
| 12 | namespace boost { | ||
| 13 | namespace buffers { | ||
| 14 | |||
| 15 | 14 | any_source:: | |
| 16 | any_impl:: | ||
| 17 | ~any_impl() = default; | ||
| 18 | |||
| 19 | bool | ||
| 20 | 4 | any_source:: | |
| 21 | any_impl:: | ||
| 22 | has_size() const noexcept | ||
| 23 | { | ||
| 24 | 4 | return false; | |
| 25 | } | ||
| 26 | |||
| 27 | bool | ||
| 28 | 5 | any_source:: | |
| 29 | any_impl:: | ||
| 30 | has_buffers() const noexcept | ||
| 31 | { | ||
| 32 | 5 | return false; | |
| 33 | } | ||
| 34 | |||
| 35 | std::size_t | ||
| 36 | 4 | any_source:: | |
| 37 | any_impl:: | ||
| 38 | size() const | ||
| 39 | { | ||
| 40 | 4 | detail::throw_invalid_argument(); | |
| 41 | } | ||
| 42 | |||
| 43 | any_const_buffers | ||
| 44 | 5 | any_source:: | |
| 45 | any_impl:: | ||
| 46 | data() const | ||
| 47 | { | ||
| 48 | 5 | detail::throw_invalid_argument(); | |
| 49 | } | ||
| 50 | |||
| 51 | //----------------------------------------------- | ||
| 52 | |||
| 53 | 6 | any_source:: | |
| 54 | 6 | any_source() noexcept | |
| 55 | { | ||
| 56 | struct model : any_impl | ||
| 57 | { | ||
| 58 | 3 | bool has_size() const noexcept override | |
| 59 | { | ||
| 60 | 3 | return true; | |
| 61 | } | ||
| 62 | |||
| 63 | 3 | bool has_buffers() const noexcept override | |
| 64 | { | ||
| 65 | 3 | return true; | |
| 66 | } | ||
| 67 | |||
| 68 | 3 | std::size_t size() const override | |
| 69 | { | ||
| 70 | 3 | return 0; | |
| 71 | } | ||
| 72 | |||
| 73 | 3 | any_const_buffers data() const override | |
| 74 | { | ||
| 75 | 3 | return {}; | |
| 76 | } | ||
| 77 | |||
| 78 | 22 | void rewind() override | |
| 79 | { | ||
| 80 | 22 | } | |
| 81 | |||
| 82 | 19 | std::size_t read( | |
| 83 | span<mutable_buffer const>, | ||
| 84 | system::error_code& ec) override | ||
| 85 | { | ||
| 86 | 19 | ec = error::eof; | |
| 87 | 19 | return 0; | |
| 88 | } | ||
| 89 | }; | ||
| 90 | |||
| 91 |
3/4✓ Branch 0 taken 1 times.
✓ Branch 1 taken 5 times.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
6 | static model instance; |
| 92 | 6 | sp_ = { &instance, [](any_impl*) {} }; | |
| 93 | 6 | } | |
| 94 | |||
| 95 | 2 | any_source:: | |
| 96 | any_source( | ||
| 97 | 2 | any_source&& other) noexcept | |
| 98 | 2 | : sp_(std::move(other.sp_)) | |
| 99 | { | ||
| 100 | 2 | other.sp_ = any_source().sp_; | |
| 101 | 2 | } | |
| 102 | |||
| 103 | any_source& | ||
| 104 | 3 | any_source:: | |
| 105 | operator=( | ||
| 106 | any_source&& other) noexcept | ||
| 107 | { | ||
| 108 | 3 | sp_ = std::move(other.sp_); | |
| 109 | 3 | other.sp_ = any_source().sp_; | |
| 110 | 3 | return *this; | |
| 111 | } | ||
| 112 | |||
| 113 | } // buffers | ||
| 114 | } // boost | ||
| 115 |