LMMS
Loading...
Searching...
No Matches
Steinberg::MemoryStream Class Reference

#include <memorystream.h>

Inheritance diagram for Steinberg::MemoryStream:
Steinberg::IBStream Steinberg::FUnknown

Public Member Functions

 MemoryStream ()
 MemoryStream (void *memory, TSize memorySize)
 reuse a given memory without getting ownership
virtual ~MemoryStream ()
tresult PLUGIN_API read (void *buffer, int32 numBytes, int32 *numBytesRead) SMTG_OVERRIDE
tresult PLUGIN_API write (void *buffer, int32 numBytes, int32 *numBytesWritten) SMTG_OVERRIDE
tresult PLUGIN_API seek (int64 pos, int32 mode, int64 *result) SMTG_OVERRIDE
tresult PLUGIN_API tell (int64 *pos) SMTG_OVERRIDE
TSize getSize () const
 returns the current memory size
void setSize (TSize size)
 set the memory size, a realloc will occur if memory already used
char * getData () const
 returns the memory pointer
char * detachData ()
 returns the memory pointer and give up ownership
bool truncate ()
 realloc to the current use memory size if needed
bool truncateToCursor ()
 truncate memory at current cursor position
Public Member Functions inherited from Steinberg::FUnknown
virtual tresult PLUGIN_API queryInterface (const TUID _iid, void **obj)=0
virtual uint32 PLUGIN_API addRef ()=0
virtual uint32 PLUGIN_API release ()=0

Protected Attributes

char * memory
TSize memorySize
TSize size
int64 cursor
bool ownMemory
bool allocationError

Additional Inherited Members

Public Types inherited from Steinberg::IBStream
enum  IStreamSeekMode { kIBSeekSet = 0 , kIBSeekCur , kIBSeekEnd }
Static Public Attributes inherited from Steinberg::IBStream
static const FUID iid
Static Public Attributes inherited from Steinberg::FUnknown
static const FUID iid

Detailed Description

Memory based Stream for IBStream implementation (using malloc).

Constructor & Destructor Documentation

◆ MemoryStream() [1/2]

Steinberg::MemoryStream::MemoryStream ( )

◆ MemoryStream() [2/2]

Steinberg::MemoryStream::MemoryStream ( void * memory,
TSize memorySize )

reuse a given memory without getting ownership

◆ ~MemoryStream()

Steinberg::MemoryStream::~MemoryStream ( )
virtual

Member Function Documentation

◆ detachData()

char * Steinberg::MemoryStream::detachData ( )

returns the memory pointer and give up ownership

◆ getData()

char * Steinberg::MemoryStream::getData ( ) const

returns the memory pointer

◆ getSize()

TSize Steinberg::MemoryStream::getSize ( ) const

returns the current memory size

◆ read()

tresult PLUGIN_API Steinberg::MemoryStream::read ( void * buffer,
int32 numBytes,
int32 * numBytesRead )
virtual

Reads binary data from stream.

Parameters
buffer: destination buffer
numBytes: amount of bytes to be read
numBytesRead: result - how many bytes have been read from stream (set to 0 if this is of no interest)

Implements Steinberg::IBStream.

◆ seek()

tresult PLUGIN_API Steinberg::MemoryStream::seek ( int64 pos,
int32 mode,
int64 * result )
virtual

Sets stream read-write position.

Parameters
pos: new stream position (dependent on mode)
mode: value of enum IStreamSeekMode
result: new seek position (set to 0 if this is of no interest)

Implements Steinberg::IBStream.

◆ setSize()

void Steinberg::MemoryStream::setSize ( TSize size)

set the memory size, a realloc will occur if memory already used

◆ tell()

tresult PLUGIN_API Steinberg::MemoryStream::tell ( int64 * pos)
virtual

Gets current stream read-write position.

Parameters
pos: is assigned the current position if function succeeds

Implements Steinberg::IBStream.

◆ truncate()

bool Steinberg::MemoryStream::truncate ( )

realloc to the current use memory size if needed

◆ truncateToCursor()

bool Steinberg::MemoryStream::truncateToCursor ( )

truncate memory at current cursor position

◆ write()

tresult PLUGIN_API Steinberg::MemoryStream::write ( void * buffer,
int32 numBytes,
int32 * numBytesWritten )
virtual

Writes binary data to stream.

Parameters
buffer: source buffer
numBytes: amount of bytes to write
numBytesWritten: result - how many bytes have been written to stream (set to 0 if this is of no interest)

Implements Steinberg::IBStream.

Member Data Documentation

◆ allocationError

bool Steinberg::MemoryStream::allocationError
protected

◆ cursor

int64 Steinberg::MemoryStream::cursor
protected

◆ memory

char* Steinberg::MemoryStream::memory
protected

◆ memorySize

TSize Steinberg::MemoryStream::memorySize
protected

◆ ownMemory

bool Steinberg::MemoryStream::ownMemory
protected

◆ size

TSize Steinberg::MemoryStream::size
protected

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