Simple extensible binary buffer.
The buffer grows geometrically. If an append fails (std::bad_alloc or std::length_error), the buffer is left unchanged. The memory is wiped (overwritten with zeros) before it is freed, both when the buffer grows and when it is destroyed, as the data may be plaintext or a key.
|
|
| SimpleBuffer (const SimpleBuffer &)=delete |
|
SimpleBuffer & | operator= (const SimpleBuffer &)=delete |
| void | append (const std::uint8_t *newData, size_t newDataLength) override |
| | Appends data to the buffer.
|
| void | append (const ::tenduke::utl::DataSpan &data) override |
| | Appends data to the buffer.
|
| void | append (std::uint8_t byte) override |
| | Appends a single byte to the sink.
|
| unsigned char * | getData () const override |
| | Returns the data.
|
| std::size_t | getLength () const override |
| | Returns the length of data in bytes.
|
| unsigned char * | data () override |
| | Returns a mutable view of the underlying data.
|
| const unsigned char * | data () const override |
| | Returns a pointer to the beginning of the underlying sequence.
|
| std::size_t | size_bytes () const override |
| | Returns the size of the span in bytes.
|
| virtual const unsigned char * | data () const=0 |
| | Returns a pointer to the beginning of the underlying sequence.
|
| virtual void | append (const std::uint8_t *data, std::size_t size)=0 |
| | Appends binary data to the sink.
|