Exiv2::DataBuf Class 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 constructor.
 
 DataBuf (long size)
 Constructor with an initial buffer size.
 
 DataBuf (const byte *pData, long size)
 Constructor, copies an existing buffer.
 
 DataBuf (DataBuf &rhs)
 Copy constructor. Transfers the buffer to the newly created object similar to std::auto_ptr, i.e., the original object is modified.
 
 ~DataBuf ()
 Destructor, deletes the allocated buffer.
 
Manipulators
DataBufoperator= (DataBuf &rhs)
 Assignment operator. Transfers the buffer and releases the buffer at the original object similar to std::auto_ptr, i.e., the original object is modified.
 
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.
 
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 free ()
 Free the internal buffer and reset the size to 0.
 
void reset (std::pair< byte *, long >=std::make_pair((byte *)(0), long(0)))
 Reset value.
 

Conversions

Special conversions with auxiliary type to enable copies and assignments, similar to those used for std::auto_ptr. See http://www.josuttis.com/libbook/auto_ptr.html for a discussion.

bytepData_
 Pointer to the buffer, 0 if none has been allocated.
 
long size_
 The current size of the buffer.
 
 DataBuf (const DataBufRef &rhs)
 
DataBufoperator= (DataBufRef rhs)
 
 operator DataBufRef ()
 

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 class was generated from the following file: