|
Monero
|
#include <byte_slice.h>

Classes | |
| struct | adapt_buffer |
Public Types | |
| using | value_type = std::uint8_t |
| using | size_type = std::size_t |
| using | difference_type = std::ptrdiff_t |
| using | pointer = const std::uint8_t* |
| using | const_pointer = const std::uint8_t* |
| using | reference = std::uint8_t |
| using | const_reference = std::uint8_t |
| using | iterator = pointer |
| using | const_iterator = const_pointer |
Public Member Functions | |
| byte_slice () noexcept | |
| Construct empty slice. | |
| byte_slice (std::nullptr_t) noexcept | |
| Construct empty slice. | |
| byte_slice (std::initializer_list< span< const std::uint8_t > > sources) | |
| Scatter-gather (copy) multiple sources into a single allocated slice. | |
| byte_slice (std::vector< std::uint8_t > &&buffer) | |
| Convert buffer into a slice using one allocation for shared count. | |
| byte_slice (std::string &&buffer) | |
| Convert buffer into a slice using one allocation for shared count. | |
| byte_slice (byte_stream &&stream, bool shrink=true) | |
| Convert stream into a slice with zero allocations. | |
| byte_slice (byte_slice &&source) noexcept | |
| ~byte_slice () noexcept=default | |
| byte_slice & | operator= (byte_slice &&) noexcept |
| byte_slice | clone () const noexcept |
| iterator | begin () const noexcept |
| const_iterator | cbegin () const noexcept |
| iterator | end () const noexcept |
| const_iterator | cend () const noexcept |
| bool | empty () const noexcept |
| const std::uint8_t * | data () const noexcept |
| std::size_t | size () const noexcept |
| std::size_t | remove_prefix (std::size_t max_bytes) noexcept |
| byte_slice | take_slice (std::size_t max_bytes) noexcept |
| byte_slice | get_slice (std::size_t begin, std::size_t end) const |
| std::unique_ptr< byte_slice_data, release_byte_slice > | take_buffer () noexcept |
Private Member Functions | |
| byte_slice (byte_slice_data *storage, span< const std::uint8_t > portion) noexcept | |
| Internal use only; use to increase storage reference count. | |
| template<typename T> | |
| byte_slice (const adapt_buffer, T &&buffer) | |
Private Attributes | |
| std::unique_ptr< byte_slice_data, release_byte_slice > | storage_ |
| span< const std::uint8_t > | portion_ |
Inspired by slices in golang. Storage is thread-safe reference counted, allowing for cheap copies or range selection on the bytes. The bytes owned by this class are always immutable.
The functions operator=, take_slice and remove_prefix may alter the reference count for the backing store, which will invalidate pointers previously returned if the reference count is zero. Be careful about "caching" pointers in these circumstances.
| using epee::byte_slice::const_pointer = const std::uint8_t* |
| using epee::byte_slice::const_reference = std::uint8_t |
| using epee::byte_slice::difference_type = std::ptrdiff_t |
| using epee::byte_slice::iterator = pointer |
| using epee::byte_slice::pointer = const std::uint8_t* |
| using epee::byte_slice::reference = std::uint8_t |
| using epee::byte_slice::size_type = std::size_t |
| using epee::byte_slice::value_type = std::uint8_t |
|
privatenoexcept |
Internal use only; use to increase storage reference count.
|
explicitprivate |
|
inlinenoexcept |
Construct empty slice.
|
inlinenoexcept |
Construct empty slice.
|
explicit |
Scatter-gather (copy) multiple sources into a single allocated slice.
|
explicit |
Convert buffer into a slice using one allocation for shared count.
|
explicit |
Convert buffer into a slice using one allocation for shared count.
|
explicit |
Convert stream into a slice with zero allocations.
|
noexcept |
|
defaultnoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
| byte_slice epee::byte_slice::get_slice | ( | std::size_t | begin, |
| std::size_t | end ) const |
|
noexcept |
|
noexcept |
|
inlinenoexcept |
|
noexcept |
|
noexcept |
|
private |