Exiv2::DataBuf Struct Reference

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
 Default constructor.
 
 DataBuf (size_t size)
 Constructor with an initial buffer size.
 
 DataBuf (const byte *pData, size_t size)
 Constructor, copies an existing buffer.
 

Manipulators

using iterator = std::vector< byte >::iterator
 
using const_iterator = std::vector< byte >::const_iterator
 
void alloc (size_t 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 (size_t size)
 Resize the buffer. Existing data is preserved (like std::realloc()).
 
void reset ()
 Reset value.
 
iterator begin () noexcept
 
const_iterator cbegin () const noexcept
 
iterator end () noexcept
 
const_iterator cend () const noexcept
 
size_t 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)
 
int cmpBytes (size_t offset, const void *buf, size_t bufsize) const
 Equivalent to: memcmp(&pData_[offset], buf, bufsize)
 
bytedata (size_t offset=0)
 Returns a data pointer.
 
const bytec_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.
 
bool empty () const
 

Detailed Description

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.

Examples
mrwthumb.cpp, and xmpparse.cpp.

The documentation for this struct was generated from the following file: