kwave
18.07.70
|
Public Member Functions | |
Buffer () | |
virtual | ~Buffer () Q_DECL_OVERRIDE |
virtual qint64 | size () const Q_DECL_OVERRIDE |
bool | mapToByteArray () |
const QByteArray & | byteArray () const |
virtual void | close () Q_DECL_OVERRIDE |
Protected Member Functions | |
virtual qint64 | readData (char *data, qint64 maxlen) Q_DECL_OVERRIDE |
virtual qint64 | writeData (const char *data, qint64 len) Q_DECL_OVERRIDE |
Private Attributes | |
Kwave::Handle | m_block |
qint64 | m_size |
QByteArray | m_data |
interal class for buffering huge amounts of mime data with support for swap files (using Kwave::MemoryManager). Used as a "write only" stream, after writing the data can be memory mapped and accessed through a QByteArray.
Definition at line 89 of file MimeData.h.
Kwave::MimeData::Buffer::Buffer | ( | ) |
|
virtual |
Destructor, closes the buffer
Definition at line 62 of file MimeData.cpp.
References close().
|
inline |
Returns the mapped data as a QByteArray
Definition at line 109 of file MimeData.h.
Referenced by Kwave::MimeData::encode().
|
virtual |
Closes the buffer and frees the memory (calling multiple times is allowed)
Definition at line 153 of file MimeData.cpp.
References Kwave::MemoryManager::free(), Kwave::MemoryManager::instance(), m_block, m_data, m_size, and Kwave::MemoryManager::unmap().
Referenced by Kwave::MimeData::clear(), Kwave::MimeData::encode(), and ~Buffer().
bool Kwave::MimeData::Buffer::mapToByteArray | ( | ) |
Try to map the memory to a QByteArray
Definition at line 127 of file MimeData.cpp.
References Kwave::MemoryManager::free(), Kwave::MemoryManager::instance(), m_block, m_data, m_size, Kwave::MemoryManager::map(), and Kwave::toUint().
Referenced by Kwave::MimeData::encode().
|
protectedvirtual |
read a block of data from the buffer
data | buffer that receives the data |
maxlen | maximum number of bytes to read |
Definition at line 68 of file MimeData.cpp.
References Kwave::MemoryManager::instance(), m_block, Kwave::MemoryManager::readFrom(), size(), and Kwave::toUint().
|
inlinevirtual |
returns the number of bytes written
Definition at line 99 of file MimeData.h.
Referenced by readData().
|
protectedvirtual |
write a block of data, internally increments the buffer size if necessary
data | pointer to a buffer with data to write |
len | number of bytes to write |
Definition at line 84 of file MimeData.cpp.
References Kwave::MemoryManager::allocate(), BUFFER_BLOCK_SIZE, Kwave::MemoryManager::instance(), m_block, m_size, Kwave::MemoryManager::resize(), Kwave::MemoryManager::sizeOf(), and Kwave::MemoryManager::writeTo().
|
private |
handle of the block of memory (see MemoryManager)
Definition at line 141 of file MimeData.h.
Referenced by close(), mapToByteArray(), readData(), and writeData().
|
private |
simple array for storage of the wave data
Definition at line 147 of file MimeData.h.
Referenced by close(), and mapToByteArray().
|
private |
number of total bytes written
Definition at line 144 of file MimeData.h.
Referenced by close(), mapToByteArray(), and writeData().