# 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. Todo: this should be some sort of smart pointer, essentially an std::auto_ptr for a character array. But it isn't... More...

`#include <types.hpp>`

List of all members.

## Public Member Functions

Creators
| DataBuf ()
| Default constructor.
| DataBuf (long size)
| Constructor with an initial buffer size.
| DataBuf (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
DataBuf & | operator= (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 the given size.
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 (std::pair< byte *, long >=std::make_pair(0, 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.
| DataBuf (DataBufRef rhs)
DataBuf & | operator= (DataBufRef rhs)
| operator DataBufRef ()

## Public Attributes

byte * | pData_
| Pointer to the buffer, 0 if none has been allocated.
long | size_
| The current size of the buffer.

## 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. Todo: this should be some sort of smart pointer, essentially an std::auto_ptr for a character array. But it isn't...

The documentation for this class was generated from the following files:

- types.hpp
- types.cpp