|
constexpr | ByteBuilder (ByteSpan buffer) |
| Creates an empty ByteBuilder.
|
|
| ByteBuilder (const ByteBuilder &)=delete |
|
ByteBuilder & | operator= (const ByteBuilder &)=delete |
|
const std::byte * | data () const |
| Returns the contents of the bytes buffer.
|
|
Status | status () const |
|
StatusWithSize | status_with_size () const |
| Returns status() and size() as a StatusWithSize.
|
|
bool | ok () const |
| True if status() is OkStatus().
|
|
bool | empty () const |
| True if the bytes builder is empty.
|
|
size_t | size () const |
| Returns the current length of the bytes.
|
|
size_t | max_size () const |
| Returns the maximum length of the bytes.
|
|
void | clear () |
| Clears the bytes and resets its error state.
|
|
void | clear_status () |
| Sets the statuses to OkStatus();.
|
|
void | push_back (std::byte b) |
|
void | pop_back () |
|
const_iterator | begin () const |
| Root of bytebuffer wrapped in iterator type.
|
|
const_iterator | cbegin () const |
|
const_iterator | end () const |
| End of bytebuffer wrapped in iterator type.
|
|
const_iterator | cend () const |
|
const std::byte & | front () const |
| Front and Back C++ container functions.
|
|
const std::byte & | back () const |
|
ByteBuilder & | append (size_t count, std::byte b) |
| Appends the provided byte count times.
|
|
ByteBuilder & | append (const void *bytes, size_t count) |
|
ByteBuilder & | append (ConstByteSpan bytes) |
| Appends bytes from a byte span that calls the pointer/length version.
|
|
void | resize (size_t new_size) |
|
ByteBuilder & | PutUint8 (uint8_t val) |
| Put methods for inserting different 8-bit ints.
|
|
ByteBuilder & | PutInt8 (int8_t val) |
|
ByteBuilder & | PutUint16 (uint16_t value, endian order=endian::little) |
| Put methods for inserting different 16-bit ints.
|
|
ByteBuilder & | PutInt16 (int16_t value, endian order=endian::little) |
|
ByteBuilder & | PutUint32 (uint32_t value, endian order=endian::little) |
| Put methods for inserting different 32-bit ints.
|
|
ByteBuilder & | PutInt32 (int32_t value, endian order=endian::little) |
|
ByteBuilder & | PutUint64 (uint64_t value, endian order=endian::little) |
| Put methods for inserting different 64-bit ints.
|
|
ByteBuilder & | PutInt64 (int64_t value, endian order=endian::little) |
|
ByteBuilder facilitates building bytes in a fixed-size buffer. BytesBuilders never overflow. Status is tracked for each operation and an overall status is maintained, which reflects the most recent error.
A ByteBuilder does not own the buffer it writes to. It can be used to write bytes to any buffer. The ByteBuffer template class, defined below, allocates a buffer alongside a ByteBuilder.