![]() |
Pixie
|
A non-owning, read-only view of a byte sequence. More...
#include <read_only_view.h>
Public Member Functions | |
| ReadOnlyStorageView (std::span< const std::byte > data) | |
Construct a view over data. | |
| std::size_t | size_bytes_impl () const |
| Return the number of viewed bytes. | |
| std::span< const std::byte > | as_bytes_impl () const |
| Return the viewed bytes. | |
| ReadOnlyStorageView | view_impl (std::size_t offset_bytes, std::size_t count_bytes) const |
| Return a checked read-only byte subrange. | |
Public Member Functions inherited from pixie::StorageBase< ReadOnlyStorageView > | |
| std::size_t | size_bytes () const |
| Return the exposed storage size in bytes. | |
| std::size_t | size_bits () const |
| Return the exposed storage size in bits. | |
| bool | empty () const |
| Check whether the storage is empty. | |
| std::span< const std::byte > | as_bytes () const |
| Return a read-only view of all exposed bytes. | |
| std::span< const std::uint16_t > | as_words16 () const |
| Return a read-only view as 16-bit words. | |
| std::span< const std::uint64_t > | as_words64 () const |
| Return a read-only view as 64-bit words. | |
| auto | view () const |
| Return a non-owning read-only view of all exposed bytes. | |
| auto | view (std::size_t offset_bytes, std::size_t count_bytes) const |
| Return a non-owning read-only byte subrange. | |
| void | serialize (OutputBitStream &stream) const |
| Serialize the exposed byte sequence with a size prefix. | |
| void | resize (std::size_t size_bits) |
Resize mutable storage to hold at least size_bits bits. | |
| auto | writable_bytes () |
| Return writable storage bytes. | |
| auto | writable_words16 () |
| Return writable storage as 16-bit words. | |
| auto | writable_words64 () |
| Return writable storage as 64-bit words. | |
| std::size_t | allocated_bytes () const |
| Return bytes reserved by an owning storage implementation. | |
| void | shrink_to_fit () |
| Request release of unused reserved storage. | |
Static Public Member Functions | |
| static ReadOnlyStorageView | deserialize (std::span< const std::byte > &data) |
Deserialize a size-prefixed view and advance data. | |
A non-owning, read-only view of a byte sequence.
The caller must keep the backing storage alive and must not resize it while this view or a view derived from it is in use.
|
inlinestatic |
Deserialize a size-prefixed view and advance data.
| std::invalid_argument | if the size prefix or payload is truncated. |