Kicking it Olde Sküül! Burgerlib on Github Follow Olde Sküül on Twitter Burgerbecky on LinkedIn Burgerbecky on LinkedIn
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Attributes | Private Attributes | List of all members
Burger::OutputMemoryStream Class Reference

Fast output memory stream. More...

Collaboration diagram for Burger::OutputMemoryStream:
Collaboration graph
[legend]

Classes

struct  Chunk_t
 Data chunk for OutputMemoryStream. More...
 

Public Member Functions

 OutputMemoryStream () noexcept
 Default constructor.
 
 ~OutputMemoryStream ()
 Destructor.
 
 OutputMemoryStream (const OutputMemoryStream &rInput) noexcept
 Copy constructor.
 
OutputMemoryStreamoperator= (const OutputMemoryStream &rInput) noexcept
 Assignment operator.
 
 OutputMemoryStream (OutputMemoryStream &&rInput) noexcept
 
OutputMemoryStreamoperator= (OutputMemoryStream &&rInput) noexcept
 
void Clear (void) noexcept
 Release all allocated memory.
 
uintptr_t GetSize (void) const noexcept
 Return the amount of data stored in the stream.
 
uint_t IsEmpty (void) const noexcept
 Return TRUE if there is no data in the stream.
 
eError GetError (void) const noexcept
 Return non zero if the stream is corrupt.
 
eError SetMark (uintptr_t uMark) noexcept
 Set the current write mark.
 
uintptr_t GetMark (void) const noexcept
 Return the current write mark.
 
eError SaveFile (const char *pFilename) const noexcept
 Save the data into a file.
 
eError SaveFile (Filename *pFilename) const noexcept
 Save the data into a file.
 
eError Save (String *pOutput) const noexcept
 Save the data into a String.
 
eError Flatten (void *pOutput, uintptr_t uLength) const noexcept
 Flatten the data into a single buffer.
 
voidFlatten (uintptr_t *pLength) const noexcept
 Flatten the data into a single buffer.
 
eError Append (char iChar) noexcept
 Add a text character to the data stream.
 
eError Append (const char *pString) noexcept
 Add a UTF-8 "C" string to the data stream.
 
eError AppendCString (const char *pString) noexcept
 Add a UTF-8 "C" string to the data stream.
 
eError Append (const String *pString) noexcept
 Add a UTF-8 "C" string to the data stream.
 
eError AppendPString (const char *pString) noexcept
 Add a UTF-8 "P" string to the data stream.
 
eError Append (uint8_t uInput) noexcept
 Add a single byte to the end of the data stream.
 
eError Append (uint16_t uInput) noexcept
 Add a 16 bit value to the end of the data stream.
 
eError Append (uint32_t uInput) noexcept
 Add a 32 bit value to the end of the data stream.
 
eError Append (uint64_t uInput) noexcept
 Add a 64 bit value to the end of the data stream.
 
eError Append (float fInput) noexcept
 Add a 32 bit floating point value to the end of the data stream.
 
eError Append (double dInput) noexcept
 Add a 64 bit floating point value to the end of the data stream.
 
eError Append (const RGBWord8_t *pInput) noexcept
 Add an R, G, B color to the end of the data stream.
 
eError Append (const RGBAWord8_t *pInput) noexcept
 Add an R, G, B, A color to the end of the data stream.
 
eError Append (const Vector3D_t *pInput) noexcept
 Add an X, Y, Z floating point value to the end of the data stream.
 
eError Append (const Vector4D_t *pInput) noexcept
 Add an X, Y, Z, W floating point value to the end of the data stream.
 
eError Append (const RGBFloat_t *pInput) noexcept
 Add an R, G, B floating point value to the end of the data stream.
 
eError Append (const RGBAFloat_t *pInput) noexcept
 Add an R, G, B, A floating point value to the end of the data stream.
 
eError Append (const void *pData, uintptr_t uSize) noexcept
 Add an array of bytes to the data stream.
 
eError BigEndianAppend (uint16_t uInput) noexcept
 Add a 16 bit value to the end of the data stream.
 
eError BigEndianAppend (uint32_t uInput) noexcept
 Add a 32 bit value to the end of the data stream.
 
eError BigEndianAppend (uint64_t uInput) noexcept
 Add a 64 bit value to the end of the data stream.
 
eError BigEndianAppend (float fInput) noexcept
 Add a 32 bit floating point value to the end of the data stream.
 
eError BigEndianAppend (double dInput) noexcept
 Add a 64 bit floating point value to the end of the data stream.
 
eError AppendAscii (uint16_t uInput) noexcept
 Convert a 16 bit unsigned integer to text and append it.
 
eError AppendAscii (uint32_t uInput) noexcept
 Convert a 32 bit unsigned integer to text and append it.
 
eError AppendAscii (uint64_t uInput) noexcept
 Convert a 64 bit unsigned integer to text and append it.
 
eError AppendAscii (int16_t iInput) noexcept
 Convert a 16 bit signed integer to text and append it.
 
eError AppendAscii (int32_t iInput) noexcept
 Convert a 32 bit signed integer to text and append it.
 
eError AppendAscii (int64_t iInput) noexcept
 Convert a 64 bit signed integer to text and append it.
 
eError AppendAscii (float fInput) noexcept
 Convert a 32 bit floating point number to text and append it.
 
eError AppendAscii (double dInput) noexcept
 Convert a 64 bit floating point number to text and append it.
 
eError AppendTabs (uint_t uTabCount) noexcept
 Insert a number of tabs into the data stream.
 
uint_t Compare (const void *pInput, uintptr_t uLength) const noexcept
 Compare data to the data in the stream.
 
eError Overwrite (const void *pInput, uintptr_t uLength, uintptr_t uOffset) noexcept
 Overwrite data in the stream.
 

Static Public Attributes

static const uintptr_t kChunkSize
 Size of each data chunk.
 

Private Attributes

Chunk_tm_pRoot
 Pointer to the first chunk.
 
Chunk_tm_pCurrent
 Pointer to the current chunk.
 
uintptr_t m_uIndex
 Number of bytes used the current chunk.
 
uintptr_t m_uFileSize
 Number of bytes stored in the stream.
 
eError m_uError
 Did an error occur?
 

Detailed Description

Fast output memory stream.


When generating a new data file, it's much faster to stream the data into memory and once the data is written, store it out to disk.

If the size of the output file is not known, allocating a buffer large enough to hold the data is educated guesswork. This class solves this problem twofold, firstly, it allocates in reasonable sized chunks to prevent out of memory situations due to allocating very large memory blocks and not succeeding due to fragmentation. Secondly, it will allow writing to a byte stream so data alignment at the stream level is not necessary and large data is always stored in little endian format so files created this way will be cross platform.

See also
InputMemoryStream or Chunk_t

Constructor & Destructor Documentation

◆ OutputMemoryStream() [1/3]

Burger::OutputMemoryStream::OutputMemoryStream ( )
noexcept

Default constructor.


Initializes a stream for output. No memory is allocated at this time

◆ ~OutputMemoryStream()

Burger::OutputMemoryStream::~OutputMemoryStream ( )

Destructor.


Releases all memory. This does NOT save anything to disk

◆ OutputMemoryStream() [2/3]

Burger::OutputMemoryStream::OutputMemoryStream ( const OutputMemoryStream & rInput)
noexcept

Copy constructor.


Can default to error condition if out of memory.

◆ OutputMemoryStream() [3/3]

Burger::OutputMemoryStream::OutputMemoryStream ( OutputMemoryStream && rInput)
noexcept

Member Function Documentation

◆ Append() [1/16]

Burger::eError BURGER_API Burger::OutputMemoryStream::Append ( char iChar)
noexcept

Add a text character to the data stream.


Assume the character is from a text stream, so if it's a '\n', convert it to the proper type for the target operating system such as '\n' for Linux, '\r' for MacOS and '\n\r' for Windows.

Parameters
iCharSingle byte of a UTF-8 text file stream
Returns
Error code with zero being no error, non-zero is out of memory

◆ Append() [2/16]

Burger::eError BURGER_API Burger::OutputMemoryStream::Append ( const char * pString)
noexcept

Add a UTF-8 "C" string to the data stream.


If the string has any '\n' in it, they will be converted to the proper type for the target operating system such as '\n' for Linux, '\r' for MacOS and '\n\r' for Windows.

Note
The terminating zero is NOT stored in the stream
Parameters
pString"C" UTF-8 data string. nullptr will perform no action and return no error.
Returns
Error code with zero being no error, non-zero is out of memory
See also
AppendPString(const char *)

◆ Append() [3/16]

Burger::OutputMemoryStream::Append ( const RGBAFloat_t * pInput)
inlinenoexcept

Add an R, G, B, A floating point value to the end of the data stream.


Append four 32 bit floats to the end of the data stream and allocate memory if necessary. If the memory allocation fails, a non-zero error code will be returned.

Data is stored in little endian format

Parameters
pInputPointer to an R, G, B and A value to append to the stream
Returns
Error code with zero being no error, non-zero is out of memory
See also
Append(const Vector4D_t *)

◆ Append() [4/16]

Burger::eError BURGER_API Burger::OutputMemoryStream::Append ( const RGBAWord8_t * pInput)
noexcept

Add an R, G, B, A color to the end of the data stream.


Append four bytes to the end of the data stream and allocate memory if necessary. If the memory allocation fails, a non-zero error code will be returned.

Parameters
pInputPointer to an R, G, B and A color value to append to the stream
Returns
Error code with zero being no error, non-zero is out of memory

◆ Append() [5/16]

Burger::OutputMemoryStream::Append ( const RGBFloat_t * pInput)
inlinenoexcept

Add an R, G, B floating point value to the end of the data stream.


Append three 32 bit floats to the end of the data stream and allocate memory if necessary. If the memory allocation fails, a non-zero error code will be returned.

Data is stored in little endian format

Parameters
pInputPointer to an R, B, and G value to append to the stream
Returns
Error code with zero being no error, non-zero is out of memory
See also
Append(const Vector3D_t *)

◆ Append() [6/16]

Burger::eError BURGER_API Burger::OutputMemoryStream::Append ( const RGBWord8_t * pInput)
noexcept

Add an R, G, B color to the end of the data stream.


Append three bytes to the end of the data stream and allocate memory if necessary. If the memory allocation fails, a non-zero error code will be returned.

Parameters
pInputPointer to an R, G and B color value to append to the stream
Returns
Error code with zero being no error, non-zero is out of memory

◆ Append() [7/16]

Burger::OutputMemoryStream::Append ( const String * pString)
inlinenoexcept

Add a UTF-8 "C" string to the data stream.


The data stream will have a zero terminated "C" string obtained from the String class instance.

The terminating zero will be included in the stream, if this is not desired, call Append(const char *) instead with the pointer from the String::GetPtr() const function.

Parameters
pStringPointer to a String class
Returns
Error code with zero being no error, non-zero is out of memory
See also
Append(const char *) or AppendCString(const char *)

◆ Append() [8/16]

Burger::eError BURGER_API Burger::OutputMemoryStream::Append ( const Vector3D_t * pInput)
noexcept

Add an X, Y, Z floating point value to the end of the data stream.


Append three 32 bit floats to the end of the data stream and allocate memory if necessary. If the memory allocation fails, a non-zero error code will be returned.

Data is stored in little endian format

Parameters
pInputPointer to an X, Y, and Z value to append to the stream
Returns
Error code with zero being no error, non-zero is out of memory
See also
Append(const RGBFloat_t *)

◆ Append() [9/16]

Burger::eError BURGER_API Burger::OutputMemoryStream::Append ( const Vector4D_t * pInput)
noexcept

Add an X, Y, Z, W floating point value to the end of the data stream.


Append four 32 bit floats to the end of the data stream and allocate memory if necessary. If the memory allocation fails, a non-zero error code will be returned.

Data is stored in little endian format

Parameters
pInputPointer to an X, Y, Z and W value to append to the stream
Returns
Error code with zero being no error, non-zero is out of memory
See also
Append(const RGBAFloat_t *)

◆ Append() [10/16]

Burger::eError BURGER_API Burger::OutputMemoryStream::Append ( const void * pData,
uintptr_t uSize )
noexcept

Add an array of bytes to the data stream.


Given a buffer pointer and a length, append the byte stream to the output stream.

Parameters
pDataPointer to the data to append to the stream. nullptr performs no operation
uSizeNumber of bytes to append to the stream. Zero performs no operation
Returns
Error code with zero being no error, non-zero is out of memory

◆ Append() [11/16]

Burger::eError BURGER_API Burger::OutputMemoryStream::Append ( double dInput)
noexcept

Add a 64 bit floating point value to the end of the data stream.


Append eight bytes to the end of the data stream in little endian format and allocate memory if necessary. If the memory allocation fails, a non-zero error code will be returned.

Parameters
dInput64 bits of data to append to the stream
Returns
Error code with zero being no error, non-zero is out of memory

◆ Append() [12/16]

Burger::eError BURGER_API Burger::OutputMemoryStream::Append ( float fInput)
noexcept

Add a 32 bit floating point value to the end of the data stream.


Append four bytes to the end of the data stream in little endian format and allocate memory if necessary. If the memory allocation fails, a non-zero error code will be returned.

Parameters
fInput32 bits of data to append to the stream
Returns
Error code with zero being no error, non-zero is out of memory

◆ Append() [13/16]

Burger::eError BURGER_API Burger::OutputMemoryStream::Append ( uint16_t uInput)
noexcept

Add a 16 bit value to the end of the data stream.


Append two bytes to the end of the data stream in little endian format and allocate memory if necessary. If the memory allocation fails, a non-zero error code will be returned.

Parameters
uInput16 bits of data to append to the stream
Returns
Error code with zero being no error, non-zero is out of memory

◆ Append() [14/16]

Burger::eError BURGER_API Burger::OutputMemoryStream::Append ( uint32_t uInput)
noexcept

Add a 32 bit value to the end of the data stream.


Append four bytes to the end of the data stream in little endian format and allocate memory if necessary. If the memory allocation fails, a non-zero error code will be returned.

Parameters
uInput32 bits of data to append to the stream
Returns
Error code with zero being no error, non-zero is out of memory

◆ Append() [15/16]

Burger::eError BURGER_API Burger::OutputMemoryStream::Append ( uint64_t uInput)
noexcept

Add a 64 bit value to the end of the data stream.


Append eight bytes to the end of the data stream in little endian format and allocate memory if necessary. If the memory allocation fails, a non-zero error code will be returned.

Parameters
uInput64 bits of data to append to the stream
Returns
Error code with zero being no error, non-zero is out of memory

◆ Append() [16/16]

Burger::eError BURGER_API Burger::OutputMemoryStream::Append ( uint8_t uInput)
noexcept

Add a single byte to the end of the data stream.


Append a single byte to the end of the data stream and allocate memory if necessary. If the memory allocation fails, a non-zero error code will be returned.

Parameters
uInputByte of data to append to the stream
Returns
Error code with zero being no error, non-zero is out of memory

◆ AppendAscii() [1/8]

Burger::eError BURGER_API Burger::OutputMemoryStream::AppendAscii ( double dInput)
noexcept

Convert a 64 bit floating point number to text and append it.


Convert a 64 bit floating pointer number into ASCII and append the resulting string to the end of the stream. If the memory allocation fails, a non-zero error code will be returned.

Parameters
dInput64 bit floating point value to append to the stream as ASCII
Returns
Error code with zero being no error, non-zero is out of memory

◆ AppendAscii() [2/8]

Burger::eError BURGER_API Burger::OutputMemoryStream::AppendAscii ( float fInput)
noexcept

Convert a 32 bit floating point number to text and append it.


Convert a 32 bit floating pointer number into ASCII and append the resulting string to the end of the stream. If the memory allocation fails, a non-zero error code will be returned.

Parameters
fInput32 bit floating point value to append to the stream as ASCII
Returns
Error code with zero being no error, non-zero is out of memory

◆ AppendAscii() [3/8]

Burger::eError BURGER_API Burger::OutputMemoryStream::AppendAscii ( int16_t iInput)
noexcept

Convert a 16 bit signed integer to text and append it.


Convert a 16 bit signed integer into ASCII and append the resulting string to the end of the stream. If the memory allocation fails, a non-zero error code will be returned.

Parameters
iInput16 bit value to append to the stream as ASCII
Returns
Error code with zero being no error, non-zero is out of memory

◆ AppendAscii() [4/8]

Burger::eError BURGER_API Burger::OutputMemoryStream::AppendAscii ( int32_t iInput)
noexcept

Convert a 32 bit signed integer to text and append it.


Convert a 32 bit signed integer into ASCII and append the resulting string to the end of the stream. If the memory allocation fails, a non-zero error code will be returned.

Parameters
iInput32 bit value to append to the stream as ASCII
Returns
Error code with zero being no error, non-zero is out of memory

◆ AppendAscii() [5/8]

Burger::eError BURGER_API Burger::OutputMemoryStream::AppendAscii ( int64_t iInput)
noexcept

Convert a 64 bit signed integer to text and append it.


Convert a 64 bit signed integer into ASCII and append the resulting string to the end of the stream. If the memory allocation fails, a non-zero error code will be returned.

Parameters
iInput64 bit value to append to the stream as ASCII
Returns
Error code with zero being no error, non-zero is out of memory

◆ AppendAscii() [6/8]

Burger::eError BURGER_API Burger::OutputMemoryStream::AppendAscii ( uint16_t uInput)
noexcept

Convert a 16 bit unsigned integer to text and append it.


Convert a 16 bit unsigned integer into ASCII and append the resulting string to the end of the stream. If the memory allocation fails, a non-zero error code will be returned.

Parameters
uInput16 bit value to append to the stream as ASCII
Returns
Error code with zero being no error, non-zero is out of memory

◆ AppendAscii() [7/8]

Burger::eError BURGER_API Burger::OutputMemoryStream::AppendAscii ( uint32_t uInput)
noexcept

Convert a 32 bit unsigned integer to text and append it.


Convert a 32 bit unsigned integer into ASCII and append the resulting string to the end of the stream. If the memory allocation fails, a non-zero error code will be returned.

Parameters
uInput32 bit value to append to the stream as ASCII
Returns
Error code with zero being no error, non-zero is out of memory

◆ AppendAscii() [8/8]

Burger::eError BURGER_API Burger::OutputMemoryStream::AppendAscii ( uint64_t uInput)
noexcept

Convert a 64 bit unsigned integer to text and append it.


Convert a 64 bit unsigned integer into ASCII and append the resulting string to the end of the stream. If the memory allocation fails, a non-zero error code will be returned.

Parameters
uInput64 bit value to append to the stream as ASCII
Returns
Error code with zero being no error, non-zero is out of memory

◆ AppendCString()

Burger::eError BURGER_API Burger::OutputMemoryStream::AppendCString ( const char * pString)
noexcept

Add a UTF-8 "C" string to the data stream.


The data stream will have a zero terminated "C" string.

The terminating zero will be included in the stream, if this is not desired, call Append(const char *) instead

Parameters
pString"C" UTF-8 data string. nullptr will insert a zero length string
Returns
Error code with zero being no error, non-zero is out of memory
See also
Append(const char *) or AppendPString(const char *)

◆ AppendPString()

Burger::eError BURGER_API Burger::OutputMemoryStream::AppendPString ( const char * pString)
noexcept

Add a UTF-8 "P" string to the data stream.


The data stream will be first given a byte with the length of the string, followed by the string. If the string is greater than 255 bytes in length, it will be truncated in the stream.

Parameters
pString"C" UTF-8 data string. nullptr will perform no action and return no error.
Returns
Error code with zero being no error, non-zero is out of memory
See also
Append(const char *) or AppendCString(const char *)

◆ AppendTabs()

Burger::eError BURGER_API Burger::OutputMemoryStream::AppendTabs ( uint_t uTabCount)
noexcept

Insert a number of tabs into the data stream.


For some text files, tabs are needed for formatting. Insert a number of tabs into the stream.

Parameters
uTabCount0 or more tabs to insert
Returns
Error code with zero being no error, non-zero is out of memory

◆ BigEndianAppend() [1/5]

Burger::eError BURGER_API Burger::OutputMemoryStream::BigEndianAppend ( double dInput)
noexcept

Add a 64 bit floating point value to the end of the data stream.


Append eight bytes to the end of the data stream in big endian format and allocate memory if necessary. If the memory allocation fails, a non-zero error code will be returned.

Parameters
dInput64 bits of data to append to the stream
Returns
Error code with zero being no error, non-zero is out of memory

◆ BigEndianAppend() [2/5]

Burger::eError BURGER_API Burger::OutputMemoryStream::BigEndianAppend ( float fInput)
noexcept

Add a 32 bit floating point value to the end of the data stream.


Append four bytes to the end of the data stream in big endian format and allocate memory if necessary. If the memory allocation fails, a non-zero error code will be returned.

Parameters
fInput32 bits of data to append to the stream
Returns
Error code with zero being no error, non-zero is out of memory

◆ BigEndianAppend() [3/5]

Burger::eError BURGER_API Burger::OutputMemoryStream::BigEndianAppend ( uint16_t uInput)
noexcept

Add a 16 bit value to the end of the data stream.


Append two bytes to the end of the data stream in big endian format and allocate memory if necessary. If the memory allocation fails, a non-zero error code will be returned.

Parameters
uInput16 bits of data to append to the stream
Returns
Error code with zero being no error, non-zero is out of memory

◆ BigEndianAppend() [4/5]

Burger::eError BURGER_API Burger::OutputMemoryStream::BigEndianAppend ( uint32_t uInput)
noexcept

Add a 32 bit value to the end of the data stream.


Append four bytes to the end of the data stream in big endian format and allocate memory if necessary. If the memory allocation fails, a non-zero error code will be returned.

Parameters
uInput32 bits of data to append to the stream
Returns
Error code with zero being no error, non-zero is out of memory

◆ BigEndianAppend() [5/5]

Burger::eError BURGER_API Burger::OutputMemoryStream::BigEndianAppend ( uint64_t uInput)
noexcept

Add a 64 bit value to the end of the data stream.


Append eight bytes to the end of the data stream in big endian format and allocate memory if necessary. If the memory allocation fails, a non-zero error code will be returned.

Parameters
uInput64 bits of data to append to the stream
Returns
Error code with zero being no error, non-zero is out of memory

◆ Clear()

void BURGER_API Burger::OutputMemoryStream::Clear ( void )
noexcept

Release all allocated memory.


If there was any memory allocated to store the output stream, release it and reset the class to a "power up" state. After this function call, this class can be recycled to create a new output stream

◆ Compare()

uint_t BURGER_API Burger::OutputMemoryStream::Compare ( const void * pInput,
uintptr_t uLength ) const
noexcept

Compare data to the data in the stream.


Given a buffer of data, do a byte for byte compare with the data in the stream and return FALSE if the data matches and non-zero if the data does not.

Parameters
pInputPointer to the buffer to match
uLengthSize of the buffer to match
Returns
FALSE if the data matches, TRUE if not

◆ Flatten() [1/2]

void *BURGER_API Burger::OutputMemoryStream::Flatten ( uintptr_t * pLength) const
noexcept

Flatten the data into a single buffer.


Allocate a buffer and fill it with the data in the stream. When the buffer is no longer needed, release it with a call to Burger::Free()

Parameters
pLengthSize of the buffer returned
Returns
nullptr on error, or a valid pointer to the buffer returned

◆ Flatten() [2/2]

Burger::eError BURGER_API Burger::OutputMemoryStream::Flatten ( void * pOutput,
uintptr_t uLength ) const
noexcept

Flatten the data into a single buffer.


Fill a supplied buffer with the contents of the byte stream

Note
The buffer must be large enough to contain the data or it will return an error code and not copy anything.
Parameters
pOutputPointer to a buffer to copy the data into
uLengthSize of the buffer
Returns
Error code with zero being no error, non-zero is an error condition

◆ GetError()

Burger::OutputMemoryStream::GetError ( void ) const
inlinenoexcept

Return non zero if the stream is corrupt.


During data writing, memory may need to be allocated. If an allocation failed, the error state is set and can only be cleared with a call to Clear() which resets the state to empty.

Returns
Non zero if corrupt. Zero if the stream is okay.

◆ GetMark()

uintptr_t BURGER_API Burger::OutputMemoryStream::GetMark ( void ) const
noexcept

Return the current write mark.


Calculate the current offset from the beginning of the stream where the next data will be written, return that value.

Returns
Current write mark
See also
SetMark(uintptr_t)

◆ GetSize()

Burger::OutputMemoryStream::GetSize ( void ) const
inlinenoexcept

Return the amount of data stored in the stream.


Calculate and return the number of bytes of valid data that has been stored in the data stream.

Returns
Number of bytes stored in the stream.

◆ IsEmpty()

Burger::OutputMemoryStream::IsEmpty ( void ) const
inlinenoexcept

Return TRUE if there is no data in the stream.


If there is any data stored in the data stream, return TRUE, otherwise return FALSE

Returns
TRUE if empty. FALSE if not.

◆ operator=() [1/2]

Burger::OutputMemoryStream & Burger::OutputMemoryStream::operator= ( const OutputMemoryStream & rInput)
noexcept

Assignment operator.


Can default to error condition if out of memory.

◆ operator=() [2/2]

OutputMemoryStream & Burger::OutputMemoryStream::operator= ( OutputMemoryStream && rInput)
noexcept

◆ Overwrite()

Burger::eError BURGER_API Burger::OutputMemoryStream::Overwrite ( const void * pInput,
uintptr_t uLength,
uintptr_t uOffset )
noexcept

Overwrite data in the stream.


Given a buffer of data, replace the data in the stream and return zero if no error and non-zero if there is an attempted buffer overrun.

Parameters
pInputPointer to the buffer to match
uLengthSize of the buffer to match
uOffsetOffset into the data to begin the overwrite
Returns
Zero if there was no overflow, non-zero if so

◆ Save()

Burger::eError BURGER_API Burger::OutputMemoryStream::Save ( String * pOutput) const
noexcept

Save the data into a String.


Fill a Burgerlib string with the contents of the byte stream.

Parameters
pOutputString to copy the data into
Returns
Error code with zero being no error, non-zero is an error condition

◆ SaveFile() [1/2]

Burger::eError BURGER_API Burger::OutputMemoryStream::SaveFile ( const char * pFilename) const
noexcept

Save the data into a file.


Open, write and close a file that will contain the contents of the entire data stream.

Parameters
pFilenameBurgerlib format filename
Returns
Error code with zero being no error, non-zero is an error condition
See also
SaveFile(Filename *) const

◆ SaveFile() [2/2]

Burger::eError BURGER_API Burger::OutputMemoryStream::SaveFile ( Filename * pFilename) const
noexcept

Save the data into a file.


Open, write and close a file that will contain the contents of the entire data stream.

Parameters
pFilenameBurgerlib filename
Returns
Error code with zero being no error, non-zero is an error condition
See also
SaveFile(const char *) const

◆ SetMark()

Burger::eError BURGER_API Burger::OutputMemoryStream::SetMark ( uintptr_t uMark)
noexcept

Set the current write mark.


Set the write mark. If it's beyond the existing write buffer, expand the buffer to accommodate and adjust the buffer length.

Returns
Zero if no error, non-zero if memory couldn't be allocated.
See also
GetMark(void) const

Member Data Documentation

◆ kChunkSize

const uintptr_t Burger::OutputMemoryStream::kChunkSize
static
Initial value:
=
0x40000U - (sizeof(uint8_t*) + sizeof(uintptr_t))

Size of each data chunk.

◆ m_pCurrent

Chunk_t* Burger::OutputMemoryStream::m_pCurrent
private

Pointer to the current chunk.

◆ m_pRoot

Chunk_t* Burger::OutputMemoryStream::m_pRoot
private

Pointer to the first chunk.

◆ m_uError

eError Burger::OutputMemoryStream::m_uError
private

Did an error occur?

◆ m_uFileSize

uintptr_t Burger::OutputMemoryStream::m_uFileSize
private

Number of bytes stored in the stream.

◆ m_uIndex

uintptr_t Burger::OutputMemoryStream::m_uIndex
private

Number of bytes used the current chunk.