JUCE-7.0.12-0-g4f43011b96 JUCE-7.0.12-0-g4f43011b96
JUCE — C++ application framework with suport for VST, VST3, LV2 audio plug-ins

« « « Anklang Documentation
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | Static Protected Attributes | List of all members
Steinberg::Buffer Class Reference

Buffer. More...

#include "fbuffer.h"

Public Types

enum  swapSize { kSwap16 , kSwap32 , kSwap64 }
 

Public Member Functions

 Buffer ()
 Default constructor, allocates no memory at all.
 
 Buffer (const void *b, uint32 size)
 Constructor - creates a new Buffer with a given size and copies contents from optional memory pointer.
 
 Buffer (uint32 size, uint8 initVal)
 Constructor - creates a new Buffer with a given size and fills it all with a given value.
 
 Buffer (uint32 size)
 Constructor - creates a new Buffer with a given size.
 
 Buffer (const Buffer &buff)
 Copy constructor - creates a new Buffer from a given Buffer.
 
virtual ~Buffer ()
 Destructor - deallocates the internal memory.
 
void operator= (const Buffer &buff)
 Assignment operator - copies contents from a given Buffer and increases the size if necessary.
 
bool operator== (const Buffer &buff) const
 Comparison operator - copies contents from a given Buffer and increases the size if necessary.
 
uint32 getSize () const
 
bool setSize (uint32 newSize)
 Sets a new size for this Buffer, keeping as much content as possible.
 
bool grow (uint32 memSize)
 Increases the Buffer to the next block, block size given by delta.
 
bool setMaxSize (uint32 size)
 see grow()
 
void fillup (uint8 initVal=0)
 set from fillSize to end
 
uint32 getFillSize () const
 
bool setFillSize (uint32 c)
 sets a new fill size, does not change any memory
 
void flush ()
 sets fill size to zero
 
bool truncateToFillSize ()
 
bool isFull () const
 
uint32 getFree () const
 
void shiftStart (int32 amount)
 moves all memory by given amount, grows the Buffer if necessary
 
void shiftAt (uint32 position, int32 amount)
 moves memory starting at the given position
 
void move (int32 amount, uint8 initVal=0)
 shifts memory at start without growing the buffer, so data is lost and initialized with init val
 
bool copy (uint32 from, uint32 to, uint32 bytes)
 copies a number of bytes from one position to another, the size may be adapted
 
uint32 get (void *b, uint32 size)
 copy to buffer from fillSize, and shift fillSize
 
void setDelta (uint32 d)
 define the block size by which the Buffer grows, see grow()
 
bool put (uint8)
 append value at end, grows Buffer if necessary
 
bool put (char16 c)
 append value at end, grows Buffer if necessary
 
bool put (char c)
 append value at end, grows Buffer if necessary
 
bool put (const void *, uint32 size)
 append bytes from a given buffer, grows Buffer if necessary
 
bool put (void *, uint32 size)
 append bytes from a given buffer, grows Buffer if necessary
 
bool put (uint8 *, uint32 size)
 append bytes from a given buffer, grows Buffer if necessary
 
bool put (char8 *, uint32 size)
 append bytes from a given buffer, grows Buffer if necessary
 
bool put (const uint8 *, uint32 size)
 append bytes from a given buffer, grows Buffer if necessary
 
bool put (const char8 *, uint32 size)
 append bytes from a given buffer, grows Buffer if necessary
 
bool put (const String &)
 append String at end, grows Buffer if necessary
 
void set (uint8 value)
 fills complete Buffer with given value
 
bool appendString (const tchar *s)
 
bool appendString (tchar *s)
 
bool appendString (tchar c)
 
bool appendString8 (const char8 *s)
 
bool appendString16 (const char16 *s)
 
bool appendString8 (char8 *s)
 
bool appendString8 (unsigned char *s)
 
bool appendString8 (const unsigned char *s)
 
bool appendString8 (char8 c)
 
bool appendString8 (unsigned char c)
 
bool appendString16 (char16 c)
 
bool appendString16 (char16 *s)
 
bool prependString (const tchar *s)
 
bool prependString (tchar *s)
 
bool prependString (tchar c)
 
bool prependString8 (const char8 *s)
 
bool prependString16 (const char16 *s)
 
bool prependString8 (char8 c)
 
bool prependString8 (unsigned char c)
 
bool prependString8 (char8 *s)
 
bool prependString8 (unsigned char *s)
 
bool prependString8 (const unsigned char *s)
 
bool prependString16 (char16 c)
 
bool prependString16 (char16 *s)
 
bool operator+= (const char *s)
 
bool operator+= (char c)
 
bool operator+= (const char16 *s)
 
bool operator+= (char16 c)
 
bool operator= (const char *s)
 
bool operator= (const char16 *s)
 
bool operator= (char8 c)
 
bool operator= (char16 c)
 
void endString ()
 
void endString8 ()
 
void endString16 ()
 
bool makeHexString (String &result)
 
bool fromHexString (const char8 *string)
 
 operator void * () const
 conversion
 
tchar * str () const
 conversion
 
char8 * str8 () const
 conversion
 
char16 * str16 () const
 conversion
 
int8 * int8Ptr () const
 conversion
 
uint8 * uint8Ptr () const
 conversion
 
int16 * int16Ptr () const
 conversion
 
uint16 * uint16Ptr () const
 conversion
 
int32 * int32Ptr () const
 conversion
 
uint32 * uint32Ptr () const
 conversion
 
floatfloatPtr () const
 conversion
 
doubledoublePtr () const
 conversion
 
char16 * wcharPtr () const
 conversion
 
int8 * operator+ (uint32 i)
 
int32 operator! ()
 
bool swap (int16 swapSize)
 swap all bytes of this Buffer by the given swapSize
 
void take (Buffer &from)
 takes another Buffer's memory, frees the current Buffer's memory
 
int8 * pass ()
 pass the current Buffer's memory
 
virtual bool toWideString (int32 sourceCodePage)
 Converts a Buffer's content to UTF-16 from a given multi-byte code page, Buffer must contain char8 of given encoding.
 
virtual bool toMultibyteString (int32 destCodePage)
 Converts a Buffer's content from UTF-16 to a given multi-byte code page, Buffer must contain UTF-16 encoded characters.
 

Static Public Member Functions

static bool swap (void *buffer, uint32 bufferSize, int16 swapSize)
 utility, swap given number of bytes in given buffer by the given swapSize
 

Protected Attributes

int8 * buffer
 
uint32 memSize
 
uint32 fillSize
 
uint32 delta
 

Static Protected Attributes

static const uint32 defaultDelta
 

Detailed Description

Buffer.

A Buffer is an object-oriented wrapper for a piece of memory. It adds several utility functions, e.g. for managing the size of the Buffer, appending or prepending values or strings to it. Internally it uses the standard memory functions malloc(), free(), etc.

Definition at line 55 of file fbuffer.h.

Member Enumeration Documentation

◆ swapSize

enum Steinberg::Buffer::swapSize

Definition at line 215 of file fbuffer.h.

Constructor & Destructor Documentation

◆ Buffer() [1/5]

Steinberg::Buffer::Buffer ( )

Default constructor, allocates no memory at all.

Definition at line 45 of file fbuffer.cpp.

◆ Buffer() [2/5]

Steinberg::Buffer::Buffer ( const void *  b,
uint32  size 
)

Constructor - creates a new Buffer with a given size and copies contents from optional memory pointer.

Parameters
[in]b: optional memory pointer with the size of at least the given size
[in]size: the size of the new Buffer to be allocated, in bytes.

Definition at line 83 of file fbuffer.cpp.

◆ Buffer() [3/5]

Steinberg::Buffer::Buffer ( uint32  size,
uint8  initVal 
)

Constructor - creates a new Buffer with a given size and fills it all with a given value.

Parameters
[in]size: the size of the new Buffer to be allocated, in bytes.
[in]initVal: the initial value the Buffer will be completely filled with

Definition at line 53 of file fbuffer.cpp.

◆ Buffer() [4/5]

Steinberg::Buffer::Buffer ( uint32  size)

Constructor - creates a new Buffer with a given size.

Parameters
[in]size: the size of the new Buffer to be allocated, in bytes.

Definition at line 69 of file fbuffer.cpp.

◆ Buffer() [5/5]

Steinberg::Buffer::Buffer ( const Buffer buff)

Copy constructor - creates a new Buffer from a given Buffer.

Parameters
[in]buff: the Buffer from which all memory will be copied to the new one

Definition at line 102 of file fbuffer.cpp.

◆ ~Buffer()

Steinberg::Buffer::~Buffer ( )
virtual

Destructor - deallocates the internal memory.

Definition at line 119 of file fbuffer.cpp.

Member Function Documentation

◆ appendString() [1/3]

bool Steinberg::Buffer::appendString ( const tchar *  s)

Definition at line 256 of file fbuffer.h.

◆ appendString() [2/3]

bool Steinberg::Buffer::appendString ( tchar *  s)

Definition at line 266 of file fbuffer.h.

◆ appendString() [3/3]

bool Steinberg::Buffer::appendString ( tchar  c)

Definition at line 150 of file fbuffer.h.

◆ appendString16() [1/3]

bool Steinberg::Buffer::appendString16 ( char16 *  s)

Definition at line 162 of file fbuffer.h.

◆ appendString16() [2/3]

bool Steinberg::Buffer::appendString16 ( char16  c)

Definition at line 161 of file fbuffer.h.

◆ appendString16() [3/3]

bool Steinberg::Buffer::appendString16 ( const char16 *  s)

Definition at line 218 of file fbuffer.cpp.

◆ appendString8() [1/6]

bool Steinberg::Buffer::appendString8 ( char8 *  s)

Definition at line 155 of file fbuffer.h.

◆ appendString8() [2/6]

bool Steinberg::Buffer::appendString8 ( char8  c)

Definition at line 159 of file fbuffer.h.

◆ appendString8() [3/6]

bool Steinberg::Buffer::appendString8 ( const char8 *  s)

Definition at line 208 of file fbuffer.cpp.

◆ appendString8() [4/6]

bool Steinberg::Buffer::appendString8 ( const unsigned char s)

Definition at line 157 of file fbuffer.h.

◆ appendString8() [5/6]

bool Steinberg::Buffer::appendString8 ( unsigned char s)

Definition at line 156 of file fbuffer.h.

◆ appendString8() [6/6]

bool Steinberg::Buffer::appendString8 ( unsigned char  c)

Definition at line 160 of file fbuffer.h.

◆ copy()

bool Steinberg::Buffer::copy ( uint32  from,
uint32  to,
uint32  bytes 
)

copies a number of bytes from one position to another, the size may be adapted

Definition at line 280 of file fbuffer.cpp.

◆ doublePtr()

double * Steinberg::Buffer::doublePtr ( ) const

conversion

Definition at line 208 of file fbuffer.h.

◆ endString()

void Steinberg::Buffer::endString ( )

Definition at line 189 of file fbuffer.h.

◆ endString16()

void Steinberg::Buffer::endString16 ( )

Definition at line 191 of file fbuffer.h.

◆ endString8()

void Steinberg::Buffer::endString8 ( )

Definition at line 190 of file fbuffer.h.

◆ fillup()

void Steinberg::Buffer::fillup ( uint8  initVal = 0)

set from fillSize to end

Definition at line 521 of file fbuffer.cpp.

◆ floatPtr()

float * Steinberg::Buffer::floatPtr ( ) const

conversion

Definition at line 207 of file fbuffer.h.

◆ flush()

void Steinberg::Buffer::flush ( )

sets fill size to zero

Definition at line 119 of file fbuffer.h.

◆ fromHexString()

bool Steinberg::Buffer::fromHexString ( const char8 *  string)

Definition at line 337 of file fbuffer.cpp.

◆ get()

uint32 Steinberg::Buffer::get ( void *  b,
uint32  size 
)

copy to buffer from fillSize, and shift fillSize

Definition at line 150 of file fbuffer.cpp.

◆ getFillSize()

uint32 Steinberg::Buffer::getFillSize ( ) const
Returns
the actual fill size

Definition at line 117 of file fbuffer.h.

◆ getFree()

uint32 Steinberg::Buffer::getFree ( ) const
Returns
remaining memory

Definition at line 123 of file fbuffer.h.

◆ getSize()

uint32 Steinberg::Buffer::getSize ( ) const
Returns
the actual size of the Buffer's memory, in bytes.

Definition at line 101 of file fbuffer.h.

◆ grow()

bool Steinberg::Buffer::grow ( uint32  memSize)

Increases the Buffer to the next block, block size given by delta.

Parameters
[in]memSize: the new minimum size of the Buffer, newSize maybe zero
Returns
true, if the Buffer could be grown successfully, else false

Definition at line 402 of file fbuffer.cpp.

◆ int16Ptr()

int16 * Steinberg::Buffer::int16Ptr ( ) const

conversion

Definition at line 203 of file fbuffer.h.

◆ int32Ptr()

int32 * Steinberg::Buffer::int32Ptr ( ) const

conversion

Definition at line 205 of file fbuffer.h.

◆ int8Ptr()

int8 * Steinberg::Buffer::int8Ptr ( ) const

conversion

Definition at line 201 of file fbuffer.h.

◆ isFull()

bool Steinberg::Buffer::isFull ( ) const
Returns
true, if all memory is filled up, else false

Definition at line 122 of file fbuffer.h.

◆ makeHexString()

bool Steinberg::Buffer::makeHexString ( String result)

Definition at line 299 of file fbuffer.cpp.

◆ move()

void Steinberg::Buffer::move ( int32  amount,
uint8  initVal = 0 
)

shifts memory at start without growing the buffer, so data is lost and initialized with init val

Definition at line 441 of file fbuffer.cpp.

◆ operator void *()

Steinberg::Buffer::operator void * ( ) const

conversion

Definition at line 197 of file fbuffer.h.

◆ operator!()

int32 Steinberg::Buffer::operator! ( )

Definition at line 213 of file fbuffer.h.

◆ operator+()

int8 * Steinberg::Buffer::operator+ ( uint32  i)
Returns
the internal Buffer's address plus the given offset i, zero if offset is out of range

Definition at line 528 of file fbuffer.cpp.

◆ operator+=() [1/4]

bool Steinberg::Buffer::operator+= ( char  c)

Definition at line 180 of file fbuffer.h.

◆ operator+=() [2/4]

bool Steinberg::Buffer::operator+= ( char16  c)

Definition at line 182 of file fbuffer.h.

◆ operator+=() [3/4]

bool Steinberg::Buffer::operator+= ( const char s)

Definition at line 179 of file fbuffer.h.

◆ operator+=() [4/4]

bool Steinberg::Buffer::operator+= ( const char16 *  s)

Definition at line 181 of file fbuffer.h.

◆ operator=() [1/5]

bool Steinberg::Buffer::operator= ( char16  c)

Definition at line 187 of file fbuffer.h.

◆ operator=() [2/5]

bool Steinberg::Buffer::operator= ( char8  c)

Definition at line 186 of file fbuffer.h.

◆ operator=() [3/5]

void Steinberg::Buffer::operator= ( const Buffer buff)

Assignment operator - copies contents from a given Buffer and increases the size if necessary.

Parameters
[in]buff: the Buffer from which all memory will be copied

Definition at line 127 of file fbuffer.cpp.

◆ operator=() [4/5]

bool Steinberg::Buffer::operator= ( const char s)

Definition at line 184 of file fbuffer.h.

◆ operator=() [5/5]

bool Steinberg::Buffer::operator= ( const char16 *  s)

Definition at line 185 of file fbuffer.h.

◆ operator==()

bool Steinberg::Buffer::operator== ( const Buffer buff) const

Comparison operator - copies contents from a given Buffer and increases the size if necessary.

Parameters
[in]buff: the Buffer to be compared to
Returns
true, if the given Buffer's content is equal to this one, else false

Definition at line 140 of file fbuffer.cpp.

◆ pass()

int8 * Steinberg::Buffer::pass ( )

pass the current Buffer's memory

Definition at line 588 of file fbuffer.cpp.

◆ prependString() [1/3]

bool Steinberg::Buffer::prependString ( const tchar *  s)

Definition at line 276 of file fbuffer.h.

◆ prependString() [2/3]

bool Steinberg::Buffer::prependString ( tchar *  s)

Definition at line 286 of file fbuffer.h.

◆ prependString() [3/3]

bool Steinberg::Buffer::prependString ( tchar  c)

Definition at line 296 of file fbuffer.h.

◆ prependString16() [1/3]

bool Steinberg::Buffer::prependString16 ( char16 *  s)

Definition at line 177 of file fbuffer.h.

◆ prependString16() [2/3]

bool Steinberg::Buffer::prependString16 ( char16  c)

Definition at line 271 of file fbuffer.cpp.

◆ prependString16() [3/3]

bool Steinberg::Buffer::prependString16 ( const char16 *  s)

Definition at line 244 of file fbuffer.cpp.

◆ prependString8() [1/6]

bool Steinberg::Buffer::prependString8 ( char8 *  s)

Definition at line 173 of file fbuffer.h.

◆ prependString8() [2/6]

bool Steinberg::Buffer::prependString8 ( char8  c)

Definition at line 262 of file fbuffer.cpp.

◆ prependString8() [3/6]

bool Steinberg::Buffer::prependString8 ( const char8 *  s)

Definition at line 228 of file fbuffer.cpp.

◆ prependString8() [4/6]

bool Steinberg::Buffer::prependString8 ( const unsigned char s)

Definition at line 175 of file fbuffer.h.

◆ prependString8() [5/6]

bool Steinberg::Buffer::prependString8 ( unsigned char s)

Definition at line 174 of file fbuffer.h.

◆ prependString8() [6/6]

bool Steinberg::Buffer::prependString8 ( unsigned char  c)

Definition at line 172 of file fbuffer.h.

◆ put() [1/10]

bool Steinberg::Buffer::put ( char  c)

append value at end, grows Buffer if necessary

Definition at line 178 of file fbuffer.cpp.

◆ put() [2/10]

bool Steinberg::Buffer::put ( char16  c)

append value at end, grows Buffer if necessary

Definition at line 162 of file fbuffer.cpp.

◆ put() [3/10]

bool Steinberg::Buffer::put ( char8 *  p,
uint32  size 
)

append bytes from a given buffer, grows Buffer if necessary

Definition at line 251 of file fbuffer.h.

◆ put() [4/10]

bool Steinberg::Buffer::put ( const char8 *  p,
uint32  size 
)

append bytes from a given buffer, grows Buffer if necessary

Definition at line 253 of file fbuffer.h.

◆ put() [5/10]

bool Steinberg::Buffer::put ( const String str)

append String at end, grows Buffer if necessary

Definition at line 202 of file fbuffer.cpp.

◆ put() [6/10]

bool Steinberg::Buffer::put ( const uint8 *  p,
uint32  size 
)

append bytes from a given buffer, grows Buffer if necessary

Definition at line 252 of file fbuffer.h.

◆ put() [7/10]

bool Steinberg::Buffer::put ( const void *  toPut,
uint32  size 
)

append bytes from a given buffer, grows Buffer if necessary

Definition at line 188 of file fbuffer.cpp.

◆ put() [8/10]

bool Steinberg::Buffer::put ( uint8 *  p,
uint32  size 
)

append bytes from a given buffer, grows Buffer if necessary

Definition at line 250 of file fbuffer.h.

◆ put() [9/10]

bool Steinberg::Buffer::put ( uint8  byte)

append value at end, grows Buffer if necessary

Definition at line 168 of file fbuffer.cpp.

◆ put() [10/10]

bool Steinberg::Buffer::put ( void *  p,
uint32  size 
)

append bytes from a given buffer, grows Buffer if necessary

Definition at line 249 of file fbuffer.h.

◆ set()

void Steinberg::Buffer::set ( uint8  value)

fills complete Buffer with given value

Definition at line 375 of file fbuffer.cpp.

◆ setDelta()

void Steinberg::Buffer::setDelta ( uint32  d)

define the block size by which the Buffer grows, see grow()

Definition at line 132 of file fbuffer.h.

◆ setFillSize()

bool Steinberg::Buffer::setFillSize ( uint32  c)

sets a new fill size, does not change any memory

Definition at line 382 of file fbuffer.cpp.

◆ setMaxSize()

bool Steinberg::Buffer::setMaxSize ( uint32  size)

see grow()

Definition at line 114 of file fbuffer.h.

◆ setSize()

bool Steinberg::Buffer::setSize ( uint32  newSize)

Sets a new size for this Buffer, keeping as much content as possible.

Parameters
[in]newSize: the new size for the Buffer, in bytes, newSize maybe zero
Returns
true, if the new size could be adapted, else false

Definition at line 470 of file fbuffer.cpp.

◆ shiftAt()

void Steinberg::Buffer::shiftAt ( uint32  position,
int32  amount 
)

moves memory starting at the given position

Definition at line 415 of file fbuffer.cpp.

◆ shiftStart()

void Steinberg::Buffer::shiftStart ( int32  amount)

moves all memory by given amount, grows the Buffer if necessary

Definition at line 125 of file fbuffer.h.

◆ str()

tchar * Steinberg::Buffer::str ( ) const

conversion

Definition at line 198 of file fbuffer.h.

◆ str16()

char16 * Steinberg::Buffer::str16 ( ) const

conversion

Definition at line 200 of file fbuffer.h.

◆ str8()

char8 * Steinberg::Buffer::str8 ( ) const

conversion

Definition at line 199 of file fbuffer.h.

◆ swap() [1/2]

bool Steinberg::Buffer::swap ( int16  swapSize)

swap all bytes of this Buffer by the given swapSize

Definition at line 539 of file fbuffer.cpp.

◆ swap() [2/2]

bool Steinberg::Buffer::swap ( void *  buffer,
uint32  bufferSize,
int16  swapSize 
)
static

utility, swap given number of bytes in given buffer by the given swapSize

Definition at line 545 of file fbuffer.cpp.

◆ take()

void Steinberg::Buffer::take ( Buffer from)

takes another Buffer's memory, frees the current Buffer's memory

Definition at line 576 of file fbuffer.cpp.

◆ toMultibyteString()

bool Steinberg::Buffer::toMultibyteString ( int32  destCodePage)
virtual

Converts a Buffer's content from UTF-16 to a given multi-byte code page, Buffer must contain UTF-16 encoded characters.

Parameters
[in]destCodePage: the desired code page to convert the Buffer's content to
Returns
true, if the conversion was successful, else false

Definition at line 619 of file fbuffer.cpp.

◆ toWideString()

bool Steinberg::Buffer::toWideString ( int32  sourceCodePage)
virtual

Converts a Buffer's content to UTF-16 from a given multi-byte code page, Buffer must contain char8 of given encoding.

Parameters
[in]sourceCodePage: the actual code page of the Buffer's content
Returns
true, if the conversion was successful, else false

Definition at line 598 of file fbuffer.cpp.

◆ truncateToFillSize()

bool Steinberg::Buffer::truncateToFillSize ( )
Returns
always true, truncates the size of the Buffer to the actual fill size

Definition at line 393 of file fbuffer.cpp.

◆ uint16Ptr()

uint16 * Steinberg::Buffer::uint16Ptr ( ) const

conversion

Definition at line 204 of file fbuffer.h.

◆ uint32Ptr()

uint32 * Steinberg::Buffer::uint32Ptr ( ) const

conversion

Definition at line 206 of file fbuffer.h.

◆ uint8Ptr()

uint8 * Steinberg::Buffer::uint8Ptr ( ) const

conversion

Definition at line 202 of file fbuffer.h.

◆ wcharPtr()

char16 * Steinberg::Buffer::wcharPtr ( ) const

conversion

Definition at line 209 of file fbuffer.h.

Member Data Documentation

◆ buffer

int8* Steinberg::Buffer::buffer
protected

Definition at line 243 of file fbuffer.h.

◆ defaultDelta

const uint32 Steinberg::Buffer::defaultDelta
staticprotected

Definition at line 241 of file fbuffer.h.

◆ delta

uint32 Steinberg::Buffer::delta
protected

Definition at line 246 of file fbuffer.h.

◆ fillSize

uint32 Steinberg::Buffer::fillSize
protected

Definition at line 245 of file fbuffer.h.

◆ memSize

uint32 Steinberg::Buffer::memSize
protected

Definition at line 244 of file fbuffer.h.


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