![]() |
Exiv2
|
Utility class containing a character array. All it does is to take care of memory allocation and deletion. Its primary use is meant to be as a stack variable in functions that need a temporary data buffer. More...
#include <types.hpp>
Public Member Functions | |
Creators | |
| DataBuf () | |
| Default constructor. | |
| DataBuf (long size) | |
| Constructor with an initial buffer size. | |
| DataBuf (const byte *pData, long size) | |
| Constructor, copies an existing buffer. | |
| DataBuf (const DataBuf &rhs) | |
| Copy constructor. Copies an existing DataBuf. | |
| DataBuf (DataBuf &&rhs) | |
| Move constructor. Transfers the buffer to the newly created object similar to std::unique_ptr, i.e., the original object is modified. | |
| ~DataBuf () | |
| Destructor, deletes the allocated buffer. | |
Manipulators | |
| DataBuf & | operator= (DataBuf &&rhs) |
| Assignment operator. Transfers the buffer and releases the buffer at the original object similar to std::unique_ptr, i.e., the original object is modified. | |
| DataBuf & | operator= (const DataBuf &)=delete |
| void | alloc (long size) |
| Allocate a data buffer of at least the given size. Note that if the requested size is less than the current buffer size, no new memory is allocated and the buffer size doesn't change. | |
| void | resize (long size) |
| Resize the buffer. Existing data is preserved (like std::realloc()). | |
| EXV_WARN_UNUSED_RESULT std::pair< byte *, long > | release () |
| Release ownership of the buffer to the caller. Returns the buffer as a data pointer and size pair, resets the internal buffer. | |
| void | reset () |
| Reset value. | |
| void | clear () |
| Fill the buffer with zeros. | |
| long | size () const |
| uint8_t | read_uint8 (size_t offset) const |
| void | write_uint8 (size_t offset, uint8_t x) |
| uint16_t | read_uint16 (size_t offset, ByteOrder byteOrder) const |
| void | write_uint16 (size_t offset, uint16_t x, ByteOrder byteOrder) |
| uint32_t | read_uint32 (size_t offset, ByteOrder byteOrder) const |
| void | write_uint32 (size_t offset, uint32_t x, ByteOrder byteOrder) |
| uint64_t | read_uint64 (size_t offset, ByteOrder byteOrder) const |
| void | write_uint64 (size_t offset, uint64_t x, ByteOrder byteOrder) |
| void | copyBytes (size_t offset, const void *buf, size_t bufsize) |
| Copy bytes into the buffer (starting at address &pData_[offset]). | |
| int | cmpBytes (size_t offset, const void *buf, size_t bufsize) const |
| Equivalent to: memcmp(&pData_[offset], buf, bufsize) | |
| byte * | data (size_t offset=0) |
| Returns a data pointer. | |
| const byte * | c_data (size_t offset=0) const |
| Returns a (read-only) data pointer. | |
| const char * | c_str (size_t offset=0) const |
| Returns a (read-only) C-style string pointer. | |
Utility class containing a character array. All it does is to take care of memory allocation and deletion. Its primary use is meant to be as a stack variable in functions that need a temporary data buffer.