51#include <initializer_list>
444 void shrink_to_fit();
548 const std::span<const std::byte> bytes = span();
549 return std::vector<std::byte>(bytes.begin(), bytes.end());
560 const std::span<const std::byte> bytes = span();
561 std::vector<std::byte>
out(bytes.begin(), bytes.end());
578 void assign(std::span<const std::byte> bytes);
584 void assign(std::initializer_list<std::byte> list);
592 template<
typename InputIt>
599 void append(std::span<const std::byte> bytes);
703 template<
typename InputIt>
761 std::unique_ptr<Storage> m_storage;
778 return data == bytes;
788 return data != bytes;
798 return 0 <=> (data <=> bytes);
802 template<Type::ByteInputRange R>
805 if constexpr (
requires { std::size(
range); })
811 template<Type::ByteInputRange R>
814 using U = std::remove_cvref_t<R>;
816 *
this = std::move(
range);
818 if constexpr (
requires { std::size(
range); })
825 template<
typename InputIt>
832 template<
typename InputIt>
845 push_back(std::byte{
static_cast<unsigned char>(std::forward<T>(
value)) });
IEC octet length (uint64_t), implicit only to std::size_t.
DLL-boundary-safe owned contiguous sequence of std::byte.
Definition binary_data.hxx:106
iterator insert(const_iterator pos, const StormByte::ByteSize &count, std::byte value)
Insert count copies of value before pos.
BinaryData & operator+=(const BinaryData &other)
Append a copy of other.
void clear() noexcept
Drop every byte.
std::ptrdiff_t difference_type
Iterator difference.
Definition binary_data.hxx:121
void append(BinaryData &&other)
Append other, then empty it.
BinaryData & operator+=(BinaryData &&other)
Append other, then empty it.
const std::byte * const_pointer
Const pointer and iterator.
Definition binary_data.hxx:141
reference emplace_back(T &&value)
Append a byte constructed in place.
Definition binary_data.hxx:844
std::byte & reference
Mutable reference to an element.
Definition binary_data.hxx:126
CString HexDump() const
Hexadecimal dump of the occupied bytes, sixteen bytes per row.
iterator erase(const_iterator first, const_iterator last)
Erase [first, last).
std::byte * iterator
Contiguous mutable iterator.
Definition binary_data.hxx:146
const std::byte * const_iterator
Contiguous const iterator.
Definition binary_data.hxx:151
void append(std::span< const std::byte > bytes)
Append a copy of bytes.
void append(const BinaryData &other)
Append a copy of other.
void assign(const StormByte::ByteSize &count, std::byte value)
Replace contents with count copies of value.
std::byte * pointer
Mutable pointer and iterator.
Definition binary_data.hxx:136
CString HexDump(Size columns) const
Hexadecimal dump of the occupied bytes.
void swap(BinaryData &other) noexcept
Exchange storage with other.
std::size_t size_type
STL size typedef; size() returns StormByte::ByteSize.
Definition binary_data.hxx:116
void append(const std::byte *bytes, const StormByte::ByteSize &count)
Append count bytes starting at bytes.
BinaryData & operator+=(std::span< const std::byte > bytes)
Append a copy of bytes.
void reserve(const StormByte::ByteSize &new_cap)
Request capacity of at least new_cap bytes.
iterator erase(const_iterator pos)
Erase the byte at pos.
void assign(std::initializer_list< std::byte > list)
Replace contents with an initializer list.
iterator insert(const_iterator pos, std::span< const std::byte > bytes)
Insert a span before pos.
std::byte value_type
Element type.
Definition binary_data.hxx:111
iterator begin() noexcept
Mutable iterator to the first byte.
std::byte & back()
Last byte.
BinaryData() noexcept
Construct an empty sequence.
iterator insert(const_iterator pos, std::byte value)
Insert one byte before pos.
std::reverse_iterator< const_iterator > const_reverse_iterator
Const reverse iterator.
Definition binary_data.hxx:161
std::reverse_iterator< iterator > reverse_iterator
Reverse iterator.
Definition binary_data.hxx:156
void push_back(std::byte value)
Append one byte.
iterator insert(const_iterator pos, std::initializer_list< std::byte > list)
Insert an initializer list before pos.
void assign(std::span< const std::byte > bytes)
Replace contents with a copy of bytes.
const_iterator cbegin() const noexcept
Const iterator to the first byte.
void pop_back()
Remove the last byte.
const std::byte & const_reference
Const reference to an element.
Definition binary_data.hxx:131
Count of octets (uint64_t storage).
Definition byte_size.hxx:103
Owned NUL-terminated buffer, safe to use across a DLL boundary.
Definition cstring.hxx:97
Count of abstract units (uint64_t storage).
Definition size.hxx:100
Lvalue reference type (std::is_lvalue_reference).
Definition categories.hxx:97
Same type after stripping cv and references from both sides.
Definition relations.hxx:94
Root namespace of the StormByte suite.
void swap(BinaryData &lhs, BinaryData &rhs) noexcept
Exchange two sequences.
bool operator==(std::span< const std::byte > bytes, const BinaryData &data) noexcept
Equality of a span against a sequence.
Definition binary_data.hxx:777
std::strong_ordering operator<=>(std::span< const std::byte > bytes, const BinaryData &data) noexcept
Three-way comparison of a span against a sequence.
Definition binary_data.hxx:797
bool operator!=(std::span< const std::byte > bytes, const BinaryData &data) noexcept
Inequality of a span against a sequence.
Definition binary_data.hxx:787
Octet count. Defined in byte_size.hxx. Forwarded so Type::Numeral can name it.
Host-width-stable count (uint64_t), implicit only to std::size_t.
#define STORMBYTE_PUBLIC
Definition visibility.h:52