![]() |
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. | |
| position_type | begin_position_impl () const |
| Return the first logical byte position. | |
| position_type | end_position_impl () const |
| Return the position one past the final logical byte. | |
| std::span< const std::byte > | as_bytes_impl () const |
| Return the viewed bytes. | |
| SplitSpan< const std::byte > | segments_impl (std::size_t offset_bytes, std::size_t count_bytes) const |
| Return a checked viewed byte range as one physical segment. | |
| 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 logical 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. | |
| position_type | begin_position () const |
| Return the first logical byte position currently exposed. | |
| position_type | end_position () const |
| Return the position one past the last logical byte exposed. | |
| bool | contains (position_type position, std::size_t count_bytes) const |
| Return whether a complete logical range is currently exposed. | |
| std::span< const std::byte > | as_bytes () const |
| Return a contiguous read-only view of all logical exposed bytes. | |
| SplitSpan< std::byte > | segments () |
| Return all logical bytes as one or two writable physical spans. | |
| SplitSpan< const std::byte > | segments () const |
| Return all logical bytes as one or two physical spans. | |
| SplitSpan< std::byte > | segments (position_type position, std::size_t count_bytes) |
| Return a checked writable logical byte range as one or two spans. | |
| SplitSpan< const std::byte > | segments (position_type position, std::size_t count_bytes) const |
| Return a checked logical byte range as one or two physical spans. | |
| 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_impl (BinaryWriter &writer) const |
| Serialize the exposed bytes with a 64-bit little-endian 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. | |
Public Member Functions inherited from pixie::SerializationBase< ReadOnlyStorageView > | |
| void | serialize (BinaryWriter &writer) const |
| Serialize this value through its concrete implementation. | |
Static Public Member Functions | |
| static ReadOnlyStorageView | deserialize_impl (BinaryReader &reader) |
Deserialize a size-prefixed view and advance reader. | |
Static Public Member Functions inherited from pixie::SerializationBase< ReadOnlyStorageView > | |
| static ReadOnlyStorageView | deserialize (BinaryReader &reader, Context &&... context) |
Restore exactly Derived and advance reader on success. | |
| static ReadOnlyStorageView | deserialize (std::span< const std::byte > &data, Context &&... context) |
Restore exactly Derived and advance a mutable byte span. | |
Additional Inherited Members | |
Public Types inherited from pixie::StorageBase< ReadOnlyStorageView > | |
| using | position_type |
| Monotonic logical byte position used to address storage ranges. | |
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 reader.
The returned view references the reader's backing byte sequence, which must remain alive and stable for the view's lifetime. The reader is unchanged on failure.
| std::invalid_argument | if the size prefix or payload is truncated. |
| std::length_error | if the encoded size is not representable. |