iPlug 2: IByteChunk Class Reference

Manages a block of memory, for plug-in settings store/recall. More...

#include <IPlugStructs.h>

Public Member Functions

int PutBytes (const void *pSrc, int nBytesToCopy)
 Copies data into the chunk, placing it at the end, resizing if necessary. More...
 
int GetBytes (void *pDst, int nBytesToCopy, int startPos) const
 Copy raw bytes from the IByteChunk, returning the new position for subsequent calls. More...
 
template<class T >
int Put (const T *pVal)
 Copies arbitary typed data into the IByteChunk. More...
 
template<class T >
int Get (T *pDst, int startPos) const
 Get arbitary typed data from the IByteChunk. More...
 
int PutStr (const char *str)
 Put a string into the IByteChunk. More...
 
int GetStr (WDL_String &str, int startPos) const
 Get a string from the IByteChunk. More...
 
int PutChunk (const IByteChunk *pRHS)
 Put another IByteChunk into this one. More...
 
void Clear ()
 Clears the chunk (resizes to 0) More...
 
int Size () const
 Returns the current size of the chunk. More...
 
int Resize (int newSize)
 Resizes the chunk. More...
 
uint8_t * GetData ()
 Gets a ptr to the chunk data. More...
 
const uint8_t * GetData () const
 Gets a const ptr to the chunk data. More...
 
bool IsEqual (IByteChunk &otherChunk) const
 Compares the size & values of the data of another chunk with this one. More...
 

Static Public Member Functions

static void InitChunkWithIPlugVer (IByteChunk &chunk)
 This method is used in order to place the IPlug version number in the chunk when serialising data. More...
 
static int GetIPlugVerFromChunk (const IByteChunk &chunk, int &position)
 Helper method to retrieve the IPlug version number from the beginning of the byte chunk. More...
 

Manages a block of memory, for plug-in settings store/recall.

Definition at line 111 of file IPlugStructs.h.

IByteChunk::IByteChunk ( )
inline

◆ ~IByteChunk()

IByteChunk::~IByteChunk ( )
inline

◆ Clear()

void IByteChunk::Clear ( )
inline

◆ Get()

template<class T >

int IByteChunk::Get ( T *  pDst,
int  startPos 
) const
inline

◆ GetBytes()

int IByteChunk::GetBytes ( void *  pDst,
int  nBytesToCopy,
int  startPos 
) const
inline

◆ GetData() [1/2]

uint8_t * IByteChunk::GetData ( )
inline

◆ GetData() [2/2]

const uint8_t * IByteChunk::GetData ( ) const
inline

Gets a const ptr to the chunk data.

Returns
const uint8_t* const Ptr to the chunk data

Definition at line 249 of file IPlugStructs.h.

◆ GetIPlugVerFromChunk()

static int IByteChunk::GetIPlugVerFromChunk ( const IByteChunk chunk,
int &  position 
)
inlinestatic

Helper method to retrieve the IPlug version number from the beginning of the byte chunk.

Parameters
chunkThe incoming byte chunk that contains the version number
positionThe position (in bytes) to start looking
Returns
The IPlug version number, retrieved from the chunk, or 0 if it failed

Definition at line 132 of file IPlugStructs.h.

References Get().

Referenced by IPluginBase::LoadBankFromFXB(), and IPluginBase::LoadPresetFromFXP().

◆ GetStr()

int IByteChunk::GetStr ( WDL_String &  str,
int  startPos 
) const
inline

◆ InitChunkWithIPlugVer()

static void IByteChunk::InitChunkWithIPlugVer ( IByteChunk chunk)
inlinestatic

◆ IsEqual()

bool IByteChunk::IsEqual ( IByteChunk otherChunk) const
inline

Compares the size & values of the data of another chunk with this one.

Parameters
otherChunkThe chunk to compare with
Returns
true if the chunks are equal

Definition at line 257 of file IPlugStructs.h.

References Size().

◆ Put()

template<class T >

int IByteChunk::Put ( const T *  pVal)
inline

◆ PutBytes()

int IByteChunk::PutBytes ( const void *  pSrc,
int  nBytesToCopy 
)
inline

◆ PutChunk()

int IByteChunk::PutChunk ( const IByteChunk pRHS)
inline

◆ PutStr()

int IByteChunk::PutStr ( const char *  str)
inline

◆ Resize()

int IByteChunk::Resize ( int  newSize)
inline

◆ Size()

int IByteChunk::Size ( ) const
inline

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