|
HosrDiretta
|
Variable-length heap memory buffer. More...
#include <Buffer.hpp>
Public Member Functions | |
| Buffer (Buffer &&b) noexcept | |
| Move constructor. | |
| Buffer (const Buffer &)=delete | |
| Buffer & | operator= (const Buffer &b)=delete |
| Buffer () noexcept | |
| Default constructor that initializes the underlying byte vector to empty and sets NoRemapSize to 0. | |
| Buffer (std::uint8_t *s, std::uint8_t *e) noexcept | |
| Constructs a Buffer by copying bytes from the range [s, e) into the underlying std::vector and initializes NoRemapSize to 0. | |
| Buffer (size_t sz) noexcept | |
| Constructs a Buffer by allocating a byte vector of the specified size and initializing NoRemapSize to 0. | |
| std::uint8_t * | get () |
| Returns a pointer to the first byte by taking the address of front(). | |
| const std::uint8_t * | get () const |
| Returns a pointer to the first byte (the address of front()). | |
| char * | get_char () |
| Returns the result of get() reinterpreted as a pointer to char. | |
| const char * | get_char () const |
| Returns the result of get() reinterpreted as a pointer to const char. | |
| std::uint64_t * | get_64 () |
| Returns a pointer to a 64-bit unsigned integer by reinterpret_casting the pointer returned by get(). | |
| const std::uint64_t * | get_64 () const |
| Returns a pointer to const std::uint64_t by reinterpreting the pointer returned by get(). This member function is const and does not modify the object. | |
| std::uint32_t * | get_32 () |
| Returns a pointer to a 32-bit unsigned integer by reinterpreting the pointer returned by get(). | |
| const std::uint32_t * | get_32 () const |
| Returns the object's underlying data reinterpreted as a pointer to const std::uint32_t. | |
| std::uint16_t * | get_16 () |
| Returns a pointer to a 16-bit unsigned integer by reinterpret_cast-ing the pointer returned by get(). No runtime checks are performed. | |
| const std::uint16_t * | get_16 () const |
| Returns a pointer to the underlying data reinterpreted as a const std::uint16_t pointer. | |
| std::uint8_t * | get_8 () |
| Returns the pointer from get() reinterpreted as a pointer to std::uint8_t. | |
| const std::uint8_t * | get_8 () const |
| Returns a pointer to the underlying data reinterpreted as a pointer to const std::uint8_t. | |
| operator BufferCS () | |
| Implicit conversion operator that creates a BufferCS from the object's data pointer and size. | |
| operator BufferCS_const () const | |
| Implicit conversion operator that produces a const BufferCS view of the object's data. | |
| bool | get_string_list (std::list< std::string > &, bool tab=false) const |
| Extracts lines of text from the buffer and populates a list of strings. | |
| void | fill (std::uint8_t) |
| Fills all memory with the specified value. | |
| void | fill (std::uint8_t, std::size_t, std::size_t=0) |
| Fills all memory with the specified value. | |
| Buffer & | operator= (BufferCS_const) |
| assignment | |
| std::string | dump () const |
| Returns a textual dump of the object's buffer by converting to BufferCS_const and invoking its dump() method. | |
| std::string | dump (std::size_t s) const |
| Returns a textual dump of the object's buffer by converting to BufferCS_const and invoking its dump() method. Size specification. | |
| std::string | get_string () const |
| Returns a std::string containing the buffer's contents. | |
| Buffer & | operator+= (BufferCS_const buf) |
| Appends the contents of the given buffer to this buffer. | |
| void | resize (std::size_t si) |
| Change the actual memory size. | |
| bool | resize () |
| Adjust the actual memory size to match the length. | |
| void | resize (std::size_t si, std::uint8_t fl) |
| Resizes the underlying byte container to the specified size, fills its contents with the given byte value. | |
| bool | resize_noremap (std::size_t si) |
| Change the length without altering the actual memory size. if the size is zero, free the memory. | |
| bool | resize_noremap (std::size_t si, std::uint8_t fl) |
| Change the length without altering the actual memory size. if the size is zero, free the memory. | |
| std::size_t | size () const |
| Returns the number of elements. If NoRemapSize is non-zero, that value is returned; otherwise the function returns the underlying std::vector<std::uint8_t>::size(). | |
| void | clear () |
| Clears the object's contents or resets its state to a default/empty condition. | |
| void | swap (Buffer &in) |
| Swaps the contents of the specified Buffer. | |
| void | move (Buffer &in) |
| Movde the contents of the specified Buffer. | |
| std::vector< std::uint8_t >::iterator | end () |
| Returns a non-const iterator to one past the last element of the std::vector<std::uint8_t>. | |
| std::vector< std::uint8_t >::const_iterator | end () const |
| Returns a const iterator to the element following the last byte in the container. | |
| std::vector< std::uint8_t >::iterator | insert (std::vector< std::uint8_t >::const_iterator i, std::vector< std::uint8_t >::const_iterator s, std::vector< std::uint8_t >::const_iterator e) |
| Inserts a range of bytes into the vector before the specified position. | |
| std::vector< std::uint8_t >::iterator | insert (std::vector< std::uint8_t >::const_iterator i, const std::uint8_t *s, const std::uint8_t *e) |
| Inserts the bytes in the half-open range [s, e) into a std::vector<std::uint8_t> before the position i. | |
| std::vector< std::uint8_t >::iterator | erase (std::vector< std::uint8_t >::iterator s, std::vector< std::uint8_t >::iterator e) |
| Erases the elements in the half-open range [s, e) from a std::vector<std::uint8_t> and returns an iterator to the element that followed the last removed element. | |
Variable-length heap memory buffer.
|
inlinenoexcept |
Move constructor.
| b |
|
inlinenoexcept |
Constructs a Buffer by copying bytes from the range [s, e) into the underlying std::vector and initializes NoRemapSize to 0.
| s | Pointer to the first byte of the input range. |
| e | Pointer one past the last byte of the input range. |
|
inlinenoexcept |
Constructs a Buffer by allocating a byte vector of the specified size and initializing NoRemapSize to 0.
| sz | The number of bytes to allocate in the underlying std::vector<std::uint8_t>. |
|
inline |
Returns a textual dump of the object's buffer by converting to BufferCS_const and invoking its dump() method.
|
inline |
Returns a textual dump of the object's buffer by converting to BufferCS_const and invoking its dump() method. Size specification.
| s | The number of bytes (or elements) to include in the dump. |
|
inline |
Returns a non-const iterator to one past the last element of the std::vector<std::uint8_t>.
|
inline |
Returns a const iterator to the element following the last byte in the container.
| std::vector< std::uint8_t >::iterator ACQUA::Buffer::erase | ( | std::vector< std::uint8_t >::iterator | s, |
| std::vector< std::uint8_t >::iterator | e ) |
Erases the elements in the half-open range [s, e) from a std::vector<std::uint8_t> and returns an iterator to the element that followed the last removed element.
| s | Iterator pointing to the first element to be removed (inclusive). |
| e | Iterator pointing past the last element to be removed (exclusive). |
| void ACQUA::Buffer::fill | ( | std::uint8_t | ) |
Fills all memory with the specified value.
| The | byte value used to fill. |
| void ACQUA::Buffer::fill | ( | std::uint8_t | , |
| std::size_t | , | ||
| std::size_t | = 0 ) |
Fills all memory with the specified value.
| The | byte value used to fill. |
| fill | length |
| fill | offset |
|
inline |
Returns a pointer to the first byte by taking the address of front().
|
inline |
Returns a pointer to the first byte (the address of front()).
|
inline |
Returns a pointer to a 16-bit unsigned integer by reinterpret_cast-ing the pointer returned by get(). No runtime checks are performed.
|
inline |
|
inline |
Returns a pointer to a 32-bit unsigned integer by reinterpreting the pointer returned by get().
|
inline |
Returns the object's underlying data reinterpreted as a pointer to const std::uint32_t.
|
inline |
Returns a pointer to a 64-bit unsigned integer by reinterpret_casting the pointer returned by get().
|
inline |
Returns a pointer to const std::uint64_t by reinterpreting the pointer returned by get(). This member function is const and does not modify the object.
|
inline |
|
inline |
Returns a pointer to the underlying data reinterpreted as a pointer to const std::uint8_t.
|
inline |
|
inline |
|
inline |
Returns a std::string containing the buffer's contents.
| bool ACQUA::Buffer::get_string_list | ( | std::list< std::string > & | , |
| bool | tab = false ) const |
Extracts lines of text from the buffer and populates a list of strings.
| li | Reference to a std::list<std::string> that will be filled with the extracted lines. |
| tab | If true, tab characters are preserved; otherwise, they are treated as invalid control characters. |
| std::vector< std::uint8_t >::iterator ACQUA::Buffer::insert | ( | std::vector< std::uint8_t >::const_iterator | i, |
| const std::uint8_t * | s, | ||
| const std::uint8_t * | e ) |
Inserts the bytes in the half-open range [s, e) into a std::vector<std::uint8_t> before the position i.
| i | Iterator specifying the position in the target vector before which the bytes will be inserted (a std::vector<std::uint8_t>::const_iterator). |
| s | Pointer to the first byte to insert (inclusive). |
| e | Pointer one past the last byte to insert (exclusive). |
| std::vector< std::uint8_t >::iterator ACQUA::Buffer::insert | ( | std::vector< std::uint8_t >::const_iterator | i, |
| std::vector< std::uint8_t >::const_iterator | s, | ||
| std::vector< std::uint8_t >::const_iterator | e ) |
Inserts a range of bytes into the vector before the specified position.
| i | Iterator specifying the position in the vector before which the new elements will be inserted. |
| s | Const iterator to the first element of the source range to insert (inclusive). |
| e | Const iterator one past the last element of the source range to insert (exclusive). |
| Buffer & ACQUA::Buffer::operator+= | ( | BufferCS_const | buf | ) |
Appends the contents of the given buffer to this buffer.
| buf | The buffer whose contents will be appended to this buffer. |
| Buffer & ACQUA::Buffer::operator= | ( | BufferCS_const | ) |
assignment
| Original | data to be overwritten |
|
inline |
Change the actual memory size.
| si | The new size for the container (number of bytes). |
|
inline |
Resizes the underlying byte container to the specified size, fills its contents with the given byte value.
| si | The new size for the container (number of bytes). |
| fl | The byte value used to fill the container after resizing. |
|
inline |
Change the length without altering the actual memory size. if the size is zero, free the memory.
| si | Specified size |
|
inline |
Change the length without altering the actual memory size. if the size is zero, free the memory.
| si | Specified size |
| fl | The byte value used to fill the container after resizing. |
|
inline |
Returns the number of elements. If NoRemapSize is non-zero, that value is returned; otherwise the function returns the underlying std::vector<std::uint8_t>::size().
| void ACQUA::Buffer::swap | ( | Buffer & | in | ) |