C++ Utilities 5.26.1
Useful C++ classes and routines such as argument parser, IO and conversion utilities
Loading...
Searching...
No Matches
CppUtilities::BinaryWriter Class Reference

Writes primitive data types to a std::ostream. More...

#include <binarywriter.h>

Public Member Functions

 BinaryWriter (std::ostream *stream, bool giveOwnership=false)
 Constructs a new BinaryWriter.
 
 BinaryWriter (const BinaryWriter &other)
 Copies the specified BinaryWriter.
 
BinaryWriteroperator= (const BinaryWriter &rhs)=delete
 
 ~BinaryWriter ()
 Destroys the BinaryWriter.
 
const std::ostream * stream () const
 Returns a pointer to the stream the writer will write to when calling one of the write-methods.
 
std::ostream * stream ()
 Returns a pointer to the stream the writer will write to when calling one of the write-methods.
 
void setStream (std::ostream *stream, bool giveOwnership=false)
 Assigns the stream the writer will write to when calling one of the write-methods.
 
bool hasOwnership () const
 Returns whether the writer takes ownership over the assigned stream.
 
void giveOwnership ()
 The writer will take ownership over the assigned stream.
 
void detatchOwnership ()
 The writer will not take ownership over the assigned stream.
 
void flush ()
 Calls the flush() method of the assigned stream.
 
bool fail () const
 Returns an indication whether the fail bit of the assigned stream is set.
 
void write (const char *buffer, std::streamsize length)
 Writes a character array to the current stream and advances the current position of the stream by the length of the array.
 
void write (const std::vector< char > &buffer, std::streamsize length)
 Writes the specified number of bytes from the buffer to the current stream and advances the current position of the stream by the specified length which must be less or equal to the buffer size.
 
void writeChar (char value)
 Writes a single character to the current stream and advances the current position of the stream by one byte.
 
void writeByte (std::uint8_t value)
 Writes a single byte to the current stream and advances the current position of the stream by one byte.
 
void writeInt16BE (std::int16_t value)
 Writes a 16-bit big endian signed integer to the current stream and advances the current position of the stream by two bytes.
 
void writeUInt16BE (std::uint16_t value)
 Writes a 16-bit big endian unsigned integer to the current stream and advances the current position of the stream by two bytes.
 
void writeInt24BE (std::int32_t value)
 Writes a 24-bit big endian signed integer to the current stream and advances the current position of the stream by three bytes.
 
void writeUInt24BE (std::uint32_t value)
 Writes a 24-bit big endian unsigned integer to the current stream and advances the current position of the stream by three bytes.
 
void writeInt32BE (std::int32_t value)
 Writes a 32-bit big endian signed integer to the current stream and advances the current position of the stream by four bytes.
 
void writeUInt32BE (std::uint32_t value)
 Writes a 32-bit big endian unsigned integer to the current stream and advances the current position of the stream by four bytes.
 
void writeInt40BE (std::int64_t value)
 Writes a 40-bit big endian signed integer to the current stream and advances the current position of the stream by four bytes.
 
void writeUInt40BE (std::uint64_t value)
 Writes a 40-bit big endian unsigned integer to the current stream and advances the current position of the stream by four bytes.
 
void writeInt56BE (std::int64_t value)
 Writes a 56-bit big endian signed integer to the current stream and advances the current position of the stream by four bytes.
 
void writeUInt56BE (std::uint64_t value)
 Writes a 56-bit big endian unsigned integer to the current stream and advances the current position of the stream by four bytes.
 
void writeInt64BE (std::int64_t value)
 Writes a 64-bit big endian signed integer to the current stream and advances the current position of the stream by eight bytes.
 
void writeUInt64BE (std::uint64_t value)
 Writes a 64-bit big endian unsigned integer to the current stream and advances the current position of the stream by eight bytes.
 
void writeVariableLengthUIntBE (std::uint64_t value)
 Writes an up to 8 byte long big endian unsigned integer to the current stream and advances the current position of the stream by one to eight bytes.
 
void writeFloat32BE (float value)
 Writes a 32-bit big endian floating point value to the current stream and advances the current position of the stream by four bytes.
 
void writeFloat64BE (double value)
 Writes a 64-bit big endian floating point value to the current stream and advances the current position of the stream by eight bytes.
 
void writeInt16LE (std::int16_t value)
 Writes a 16-bit little endian signed integer to the current stream and advances the current position of the stream by two bytes.
 
void writeUInt16LE (std::uint16_t value)
 Writes a 16-bit little endian unsigned integer to the current stream and advances the current position of the stream by two bytes.
 
void writeInt24LE (std::int32_t value)
 Writes a 24-bit little endian signed integer to the current stream and advances the current position of the stream by three bytes.
 
void writeUInt24LE (std::uint32_t value)
 Writes a 24-bit little endian unsigned integer to the current stream and advances the current position of the stream by three bytes.
 
void writeInt32LE (std::int32_t value)
 Writes a 32-bit little endian signed integer to the current stream and advances the current position of the stream by four bytes.
 
void writeUInt32LE (std::uint32_t value)
 Writes a 32-bit little endian unsigned integer to the current stream and advances the current position of the stream by four bytes.
 
void writeInt40LE (std::int64_t value)
 Writes a 40-bit big endian signed integer to the current stream and advances the current position of the stream by four bytes.
 
void writeUInt40LE (std::uint64_t value)
 Writes a 40-bit big endian unsigned integer to the current stream and advances the current position of the stream by four bytes.
 
void writeInt56LE (std::int64_t value)
 Writes a 56-bit big endian signed integer to the current stream and advances the current position of the stream by four bytes.
 
void writeUInt56LE (std::uint64_t value)
 Writes a 56-bit big endian unsigned integer to the current stream and advances the current position of the stream by four bytes.
 
void writeInt64LE (std::int64_t value)
 Writes a 64-bit little endian signed integer to the current stream and advances the current position of the stream by eight bytes.
 
void writeUInt64LE (std::uint64_t value)
 Writes a 64-bit little endian unsigned integer to the current stream and advances the current position of the stream by eight bytes.
 
void writeVariableLengthUIntLE (std::uint64_t value)
 Writes an up to 8 byte long little endian unsigned integer to the current stream and advances the current position of the stream by one to eight bytes.
 
void writeFloat32LE (float value)
 Writes a 32-bit little endian floating point value to the current stream and advances the current position of the stream by four bytes.
 
void writeFloat64LE (double value)
 Writes a 64-bit little endian floating point value to the current stream and advances the current position of the stream by eight bytes.
 
void writeString (const std::string &value)
 Writes a string to the current stream and advances the current position of the stream by the length of the string.
 
void writeTerminatedString (const std::string &value)
 Writes a terminated string to the current stream and advances the current position of the stream by the length of the string plus 1.
 
void writeLengthPrefixedString (const std::string &value)
 Writes the length of a string and the string itself to the current stream.
 
void writeLengthPrefixedCString (const char *value, std::size_t size)
 Writes the length of a string and the string itself to the current stream.
 
void writeBool (bool value)
 Writes a boolean value to the current stream and advances the current position of the stream by one byte.
 
void writeSynchsafeUInt32BE (std::uint32_t valueToConvertAndWrite)
 Writes a 32-bit big endian synchsafe integer to the current stream and advances the current position of the stream by four bytes.
 
void writeFixed8BE (float valueToConvertAndWrite)
 Writes the 8.8 fixed point big endian representation for the specified 32-bit floating point value to the current stream and advances the current position of the stream by two bytes.
 
void writeFixed16BE (float valueToConvertAndWrite)
 Writes the 16.16 fixed point big endian representation for the specified 32-bit floating point value to the current stream and advances the current position of the stream by four bytes.
 
void writeSynchsafeUInt32LE (std::uint32_t valueToConvertAndWrite)
 Writes a 32-bit little endian synchsafe integer to the current stream and advances the current position of the stream by four bytes.
 
void writeFixed8LE (float valueToConvertAndWrite)
 Writes the 8.8 fixed point little endian representation for the specified 32-bit floating point value to the current stream and advances the current position of the stream by two bytes.
 
void writeFixed16LE (float valueToConvertAndWrite)
 Writes the 16.16 fixed point little endian representation for the specified 32-bit floating point value to the current stream and advances the current position of the stream by four bytes.
 
void write (char oneChar)
 Writes a single character to the current stream and advances the current position of the stream by one byte.
 
void write (std::uint8_t oneByte)
 Writes a single byte to the current stream and advances the current position of the stream by one byte.
 
void write (bool oneBool)
 Writes a boolean value to the current stream and advances the current position of the stream by one byte.
 
void write (const std::string &lengthPrefixedString)
 Writes the length of a string and the string itself to the current stream.
 
void write (std::string_view lengthPrefixedString)
 Writes the length of a string and the string itself to the current stream.
 
void write (const char *lengthPrefixedString)
 Writes the length of a string and the string itself to the current stream.
 
void write (std::int16_t one16BitInt)
 Writes a 16-bit big endian signed integer to the current stream and advances the current position of the stream by two bytes.
 
void write (std::uint16_t one16BitUint)
 Writes a 16-bit big endian unsigned integer to the current stream and advances the current position of the stream by two bytes.
 
void write (std::int32_t one32BitInt)
 Writes a 32-bit big endian signed integer to the current stream and advances the current position of the stream by four bytes.
 
void write (std::uint32_t one32BitUint)
 Writes a 32-bit big endian unsigned integer to the current stream and advances the current position of the stream by four bytes.
 
void write (std::int64_t one64BitInt)
 Writes a 64-bit big endian signed integer to the current stream and advances the current position of the stream by eight bytes.
 
void write (std::uint64_t one64BitUint)
 Writes a 64-bit big endian unsigned integer to the current stream and advances the current position of the stream by eight bytes.
 
void write (float one32BitFloat)
 Writes a 32-bit big endian floating point value to the current stream and advances the current position of the stream by four bytes.
 
void write (double one64BitFloat)
 Writes a 64-bit big endian floating point value to the current stream and advances the current position of the stream by eight bytes.
 

Detailed Description

Writes primitive data types to a std::ostream.

Remarks
Supports both, little endian and big endian.
See also
For automatic deserialization of structs, see https://github.com/Martchus/reflective-rapidjson.

Definition at line 14 of file binarywriter.h.

Constructor & Destructor Documentation

◆ BinaryWriter() [1/2]

CppUtilities::BinaryWriter::BinaryWriter ( std::ostream * stream,
bool giveOwnership = false )
inline

Constructs a new BinaryWriter.

Parameters
streamSpecifies the stream to write to.
giveOwnershipSpecifies whether the writer should take ownership.

Definition at line 104 of file binarywriter.h.

◆ BinaryWriter() [2/2]

CppUtilities::BinaryWriter::BinaryWriter ( const BinaryWriter & other)
inline

Copies the specified BinaryWriter.

Remarks
The copy will not take ownership over the stream.

Definition at line 114 of file binarywriter.h.

◆ ~BinaryWriter()

CppUtilities::BinaryWriter::~BinaryWriter ( )
inline

Destroys the BinaryWriter.

Definition at line 123 of file binarywriter.h.

Member Function Documentation

◆ detatchOwnership()

void CppUtilities::BinaryWriter::detatchOwnership ( )
inline

The writer will not take ownership over the assigned stream.

See also
setStream()
giveOwnership()
hasOwnership()

Definition at line 183 of file binarywriter.h.

◆ fail()

bool CppUtilities::BinaryWriter::fail ( ) const
inline

Returns an indication whether the fail bit of the assigned stream is set.

Definition at line 199 of file binarywriter.h.

◆ flush()

void CppUtilities::BinaryWriter::flush ( )
inline

Calls the flush() method of the assigned stream.

Definition at line 191 of file binarywriter.h.

◆ giveOwnership()

void CppUtilities::BinaryWriter::giveOwnership ( )
inline

The writer will take ownership over the assigned stream.

See also
setStream()
detatchOwnership()
hasOwnership()

Definition at line 169 of file binarywriter.h.

◆ hasOwnership()

bool CppUtilities::BinaryWriter::hasOwnership ( ) const
inline

Returns whether the writer takes ownership over the assigned stream.

See also
setStream()
giveOwnership()
detatchOwnership()

Definition at line 157 of file binarywriter.h.

◆ operator=()

BinaryWriter & CppUtilities::BinaryWriter::operator= ( const BinaryWriter & rhs)
delete

◆ setStream()

void CppUtilities::BinaryWriter::setStream ( std::ostream * stream,
bool giveOwnership = false )

Assigns the stream the writer will write to when calling one of the write-methods.

You can assign a null pointer when ensuring that none of the write-methods is called until a stream is assigned.

Parameters
streamSpecifies the stream to be assigned.
giveOwnershipSpecifies whether the writer should take ownership.
See also
setStream()

Definition at line 30 of file binarywriter.cpp.

◆ stream() [1/2]

std::ostream * CppUtilities::BinaryWriter::stream ( )
inline

Returns a pointer to the stream the writer will write to when calling one of the write-methods.

See also
setStream()

Definition at line 135 of file binarywriter.h.

◆ stream() [2/2]

const std::ostream * CppUtilities::BinaryWriter::stream ( ) const
inline

Returns a pointer to the stream the writer will write to when calling one of the write-methods.

See also
setStream()

Definition at line 145 of file binarywriter.h.

◆ write() [1/16]

void CppUtilities::BinaryWriter::write ( bool oneBool)
inline

Writes a boolean value to the current stream and advances the current position of the stream by one byte.

Definition at line 645 of file binarywriter.h.

◆ write() [2/16]

void CppUtilities::BinaryWriter::write ( char oneChar)
inline

Writes a single character to the current stream and advances the current position of the stream by one byte.

Definition at line 629 of file binarywriter.h.

◆ write() [3/16]

void CppUtilities::BinaryWriter::write ( const char * buffer,
std::streamsize length )
inline

Writes a character array to the current stream and advances the current position of the stream by the length of the array.

Definition at line 207 of file binarywriter.h.

◆ write() [4/16]

void CppUtilities::BinaryWriter::write ( const char * lengthPrefixedString)
inline

Writes the length of a string and the string itself to the current stream.

Advances the current position of the stream by the length of the string plus the size of the length prefix.

Definition at line 675 of file binarywriter.h.

◆ write() [5/16]

void CppUtilities::BinaryWriter::write ( const std::string & lengthPrefixedString)
inline

Writes the length of a string and the string itself to the current stream.

Advances the current position of the stream by the length of the string plus the size of the length prefix.

Definition at line 655 of file binarywriter.h.

◆ write() [6/16]

void CppUtilities::BinaryWriter::write ( const std::vector< char > & buffer,
std::streamsize length )
inline

Writes the specified number of bytes from the buffer to the current stream and advances the current position of the stream by the specified length which must be less or equal to the buffer size.

Definition at line 216 of file binarywriter.h.

◆ write() [7/16]

void CppUtilities::BinaryWriter::write ( double one64BitFloat)
inline

Writes a 64-bit big endian floating point value to the current stream and advances the current position of the stream by eight bytes.

Definition at line 739 of file binarywriter.h.

◆ write() [8/16]

void CppUtilities::BinaryWriter::write ( float one32BitFloat)
inline

Writes a 32-bit big endian floating point value to the current stream and advances the current position of the stream by four bytes.

Definition at line 731 of file binarywriter.h.

◆ write() [9/16]

void CppUtilities::BinaryWriter::write ( std::int16_t one16BitInt)
inline

Writes a 16-bit big endian signed integer to the current stream and advances the current position of the stream by two bytes.

Definition at line 683 of file binarywriter.h.

◆ write() [10/16]

void CppUtilities::BinaryWriter::write ( std::int32_t one32BitInt)
inline

Writes a 32-bit big endian signed integer to the current stream and advances the current position of the stream by four bytes.

Definition at line 699 of file binarywriter.h.

◆ write() [11/16]

void CppUtilities::BinaryWriter::write ( std::int64_t one64BitInt)
inline

Writes a 64-bit big endian signed integer to the current stream and advances the current position of the stream by eight bytes.

Definition at line 715 of file binarywriter.h.

◆ write() [12/16]

void CppUtilities::BinaryWriter::write ( std::string_view lengthPrefixedString)
inline

Writes the length of a string and the string itself to the current stream.

Advances the current position of the stream by the length of the string plus the size of the length prefix.

Definition at line 665 of file binarywriter.h.

◆ write() [13/16]

void CppUtilities::BinaryWriter::write ( std::uint16_t one16BitUint)
inline

Writes a 16-bit big endian unsigned integer to the current stream and advances the current position of the stream by two bytes.

Definition at line 691 of file binarywriter.h.

◆ write() [14/16]

void CppUtilities::BinaryWriter::write ( std::uint32_t one32BitUint)
inline

Writes a 32-bit big endian unsigned integer to the current stream and advances the current position of the stream by four bytes.

Definition at line 707 of file binarywriter.h.

◆ write() [15/16]

void CppUtilities::BinaryWriter::write ( std::uint64_t one64BitUint)
inline

Writes a 64-bit big endian unsigned integer to the current stream and advances the current position of the stream by eight bytes.

Definition at line 723 of file binarywriter.h.

◆ write() [16/16]

void CppUtilities::BinaryWriter::write ( std::uint8_t oneByte)
inline

Writes a single byte to the current stream and advances the current position of the stream by one byte.

Definition at line 637 of file binarywriter.h.

◆ writeBool()

void CppUtilities::BinaryWriter::writeBool ( bool value)
inline

Writes a boolean value to the current stream and advances the current position of the stream by one byte.

Definition at line 242 of file binarywriter.h.

◆ writeByte()

void CppUtilities::BinaryWriter::writeByte ( std::uint8_t value)
inline

Writes a single byte to the current stream and advances the current position of the stream by one byte.

Definition at line 233 of file binarywriter.h.

◆ writeChar()

void CppUtilities::BinaryWriter::writeChar ( char value)
inline

Writes a single character to the current stream and advances the current position of the stream by one byte.

Definition at line 224 of file binarywriter.h.

◆ writeFixed16BE()

void CppUtilities::BinaryWriter::writeFixed16BE ( float valueToConvertAndWrite)
inline

Writes the 16.16 fixed point big endian representation for the specified 32-bit floating point value to the current stream and advances the current position of the stream by four bytes.

Definition at line 595 of file binarywriter.h.

◆ writeFixed16LE()

void CppUtilities::BinaryWriter::writeFixed16LE ( float valueToConvertAndWrite)
inline

Writes the 16.16 fixed point little endian representation for the specified 32-bit floating point value to the current stream and advances the current position of the stream by four bytes.

Definition at line 621 of file binarywriter.h.

◆ writeFixed8BE()

void CppUtilities::BinaryWriter::writeFixed8BE ( float valueToConvertAndWrite)
inline

Writes the 8.8 fixed point big endian representation for the specified 32-bit floating point value to the current stream and advances the current position of the stream by two bytes.

Definition at line 587 of file binarywriter.h.

◆ writeFixed8LE()

void CppUtilities::BinaryWriter::writeFixed8LE ( float valueToConvertAndWrite)
inline

Writes the 8.8 fixed point little endian representation for the specified 32-bit floating point value to the current stream and advances the current position of the stream by two bytes.

Definition at line 613 of file binarywriter.h.

◆ writeFloat32BE()

void CppUtilities::BinaryWriter::writeFloat32BE ( float value)
inline

Writes a 32-bit big endian floating point value to the current stream and advances the current position of the stream by four bytes.

Definition at line 374 of file binarywriter.h.

◆ writeFloat32LE()

void CppUtilities::BinaryWriter::writeFloat32LE ( float value)
inline

Writes a 32-bit little endian floating point value to the current stream and advances the current position of the stream by four bytes.

Definition at line 517 of file binarywriter.h.

◆ writeFloat64BE()

void CppUtilities::BinaryWriter::writeFloat64BE ( double value)
inline

Writes a 64-bit big endian floating point value to the current stream and advances the current position of the stream by eight bytes.

Definition at line 383 of file binarywriter.h.

◆ writeFloat64LE()

void CppUtilities::BinaryWriter::writeFloat64LE ( double value)
inline

Writes a 64-bit little endian floating point value to the current stream and advances the current position of the stream by eight bytes.

Definition at line 526 of file binarywriter.h.

◆ writeInt16BE()

void CppUtilities::BinaryWriter::writeInt16BE ( std::int16_t value)
inline

Writes a 16-bit big endian signed integer to the current stream and advances the current position of the stream by two bytes.

Definition at line 250 of file binarywriter.h.

◆ writeInt16LE()

void CppUtilities::BinaryWriter::writeInt16LE ( std::int16_t value)
inline

Writes a 16-bit little endian signed integer to the current stream and advances the current position of the stream by two bytes.

Definition at line 392 of file binarywriter.h.

◆ writeInt24BE()

void CppUtilities::BinaryWriter::writeInt24BE ( std::int32_t value)
inline

Writes a 24-bit big endian signed integer to the current stream and advances the current position of the stream by three bytes.

Remarks
The most significant byte of the specified 32-bit signed integer value will be discarded.

Definition at line 269 of file binarywriter.h.

◆ writeInt24LE()

void CppUtilities::BinaryWriter::writeInt24LE ( std::int32_t value)
inline

Writes a 24-bit little endian signed integer to the current stream and advances the current position of the stream by three bytes.

Remarks
The most significant byte of the specified 32-bit signed integer value will be discarded.

Definition at line 411 of file binarywriter.h.

◆ writeInt32BE()

void CppUtilities::BinaryWriter::writeInt32BE ( std::int32_t value)
inline

Writes a 32-bit big endian signed integer to the current stream and advances the current position of the stream by four bytes.

Definition at line 289 of file binarywriter.h.

◆ writeInt32LE()

void CppUtilities::BinaryWriter::writeInt32LE ( std::int32_t value)
inline

Writes a 32-bit little endian signed integer to the current stream and advances the current position of the stream by four bytes.

Definition at line 432 of file binarywriter.h.

◆ writeInt40BE()

void CppUtilities::BinaryWriter::writeInt40BE ( std::int64_t value)
inline

Writes a 40-bit big endian signed integer to the current stream and advances the current position of the stream by four bytes.

Remarks
The most significant bytes of the specified 64-bit unsigned integer value will be discarded.

Definition at line 308 of file binarywriter.h.

◆ writeInt40LE()

void CppUtilities::BinaryWriter::writeInt40LE ( std::int64_t value)
inline

Writes a 40-bit big endian signed integer to the current stream and advances the current position of the stream by four bytes.

Remarks
The most significant bytes of the specified 64-bit unsigned integer value will be discarded.

Definition at line 451 of file binarywriter.h.

◆ writeInt56BE()

void CppUtilities::BinaryWriter::writeInt56BE ( std::int64_t value)
inline

Writes a 56-bit big endian signed integer to the current stream and advances the current position of the stream by four bytes.

Remarks
The most significant byte of the specified 64-bit unsigned integer value will be discarded.

Definition at line 328 of file binarywriter.h.

◆ writeInt56LE()

void CppUtilities::BinaryWriter::writeInt56LE ( std::int64_t value)
inline

Writes a 56-bit big endian signed integer to the current stream and advances the current position of the stream by four bytes.

Remarks
The most significant byte of the specified 64-bit unsigned integer value will be discarded.

Definition at line 471 of file binarywriter.h.

◆ writeInt64BE()

void CppUtilities::BinaryWriter::writeInt64BE ( std::int64_t value)
inline

Writes a 64-bit big endian signed integer to the current stream and advances the current position of the stream by eight bytes.

Definition at line 347 of file binarywriter.h.

◆ writeInt64LE()

void CppUtilities::BinaryWriter::writeInt64LE ( std::int64_t value)
inline

Writes a 64-bit little endian signed integer to the current stream and advances the current position of the stream by eight bytes.

Definition at line 490 of file binarywriter.h.

◆ writeLengthPrefixedCString()

void CppUtilities::BinaryWriter::writeLengthPrefixedCString ( const char * value,
std::size_t size )
inline

Writes the length of a string and the string itself to the current stream.

Advances the current position of the stream by the length of the string plus the size of the length prefix.

Exceptions
ThrowsConversionException if the string size exceeds the maximum.

Definition at line 568 of file binarywriter.h.

◆ writeLengthPrefixedString()

void CppUtilities::BinaryWriter::writeLengthPrefixedString ( const std::string & value)
inline

Writes the length of a string and the string itself to the current stream.

Advances the current position of the stream by the length of the string plus the size of the length prefix.

Exceptions
ThrowsConversionException if the string size exceeds the maximum.

Definition at line 555 of file binarywriter.h.

◆ writeString()

void CppUtilities::BinaryWriter::writeString ( const std::string & value)
inline

Writes a string to the current stream and advances the current position of the stream by the length of the string.

Definition at line 535 of file binarywriter.h.

◆ writeSynchsafeUInt32BE()

void CppUtilities::BinaryWriter::writeSynchsafeUInt32BE ( std::uint32_t valueToConvertAndWrite)
inline

Writes a 32-bit big endian synchsafe integer to the current stream and advances the current position of the stream by four bytes.

Remarks
Synchsafe integers appear in ID3 tags that are attached to an MP3 file.
See also
ID3 tag version 2.4.0 - Main Structure

Definition at line 579 of file binarywriter.h.

◆ writeSynchsafeUInt32LE()

void CppUtilities::BinaryWriter::writeSynchsafeUInt32LE ( std::uint32_t valueToConvertAndWrite)
inline

Writes a 32-bit little endian synchsafe integer to the current stream and advances the current position of the stream by four bytes.

Remarks
Synchsafe integers appear in ID3 tags that are attached to an MP3 file.
See also
ID3 tag version 2.4.0 - Main Structure

Definition at line 605 of file binarywriter.h.

◆ writeTerminatedString()

void CppUtilities::BinaryWriter::writeTerminatedString ( const std::string & value)
inline

Writes a terminated string to the current stream and advances the current position of the stream by the length of the string plus 1.

Definition at line 543 of file binarywriter.h.

◆ writeUInt16BE()

void CppUtilities::BinaryWriter::writeUInt16BE ( std::uint16_t value)
inline

Writes a 16-bit big endian unsigned integer to the current stream and advances the current position of the stream by two bytes.

Definition at line 259 of file binarywriter.h.

◆ writeUInt16LE()

void CppUtilities::BinaryWriter::writeUInt16LE ( std::uint16_t value)
inline

Writes a 16-bit little endian unsigned integer to the current stream and advances the current position of the stream by two bytes.

Definition at line 401 of file binarywriter.h.

◆ writeUInt24BE()

void CppUtilities::BinaryWriter::writeUInt24BE ( std::uint32_t value)
inline

Writes a 24-bit big endian unsigned integer to the current stream and advances the current position of the stream by three bytes.

Remarks
The most significant byte of the specified 32-bit unsigned integer value will be discarded.

Definition at line 279 of file binarywriter.h.

◆ writeUInt24LE()

void CppUtilities::BinaryWriter::writeUInt24LE ( std::uint32_t value)
inline

Writes a 24-bit little endian unsigned integer to the current stream and advances the current position of the stream by three bytes.

Remarks
The most significant byte of the specified 32-bit unsigned integer value will be discarded.

Definition at line 422 of file binarywriter.h.

◆ writeUInt32BE()

void CppUtilities::BinaryWriter::writeUInt32BE ( std::uint32_t value)
inline

Writes a 32-bit big endian unsigned integer to the current stream and advances the current position of the stream by four bytes.

Definition at line 298 of file binarywriter.h.

◆ writeUInt32LE()

void CppUtilities::BinaryWriter::writeUInt32LE ( std::uint32_t value)
inline

Writes a 32-bit little endian unsigned integer to the current stream and advances the current position of the stream by four bytes.

Definition at line 441 of file binarywriter.h.

◆ writeUInt40BE()

void CppUtilities::BinaryWriter::writeUInt40BE ( std::uint64_t value)
inline

Writes a 40-bit big endian unsigned integer to the current stream and advances the current position of the stream by four bytes.

Remarks
The most significant bytes of the specified 64-bit unsigned integer value will be discarded.

Definition at line 318 of file binarywriter.h.

◆ writeUInt40LE()

void CppUtilities::BinaryWriter::writeUInt40LE ( std::uint64_t value)
inline

Writes a 40-bit big endian unsigned integer to the current stream and advances the current position of the stream by four bytes.

Remarks
The most significant bytes of the specified 64-bit unsigned integer value will be discarded.

Definition at line 461 of file binarywriter.h.

◆ writeUInt56BE()

void CppUtilities::BinaryWriter::writeUInt56BE ( std::uint64_t value)
inline

Writes a 56-bit big endian unsigned integer to the current stream and advances the current position of the stream by four bytes.

Remarks
The most significant byte of the specified 64-bit unsigned integer value will be discarded.

Definition at line 338 of file binarywriter.h.

◆ writeUInt56LE()

void CppUtilities::BinaryWriter::writeUInt56LE ( std::uint64_t value)
inline

Writes a 56-bit big endian unsigned integer to the current stream and advances the current position of the stream by four bytes.

Remarks
The most significant byte of the specified 64-bit unsigned integer value will be discarded.

Definition at line 481 of file binarywriter.h.

◆ writeUInt64BE()

void CppUtilities::BinaryWriter::writeUInt64BE ( std::uint64_t value)
inline

Writes a 64-bit big endian unsigned integer to the current stream and advances the current position of the stream by eight bytes.

Definition at line 356 of file binarywriter.h.

◆ writeUInt64LE()

void CppUtilities::BinaryWriter::writeUInt64LE ( std::uint64_t value)
inline

Writes a 64-bit little endian unsigned integer to the current stream and advances the current position of the stream by eight bytes.

Definition at line 499 of file binarywriter.h.

◆ writeVariableLengthUIntBE()

void CppUtilities::BinaryWriter::writeVariableLengthUIntBE ( std::uint64_t value)
inline

Writes an up to 8 byte long big endian unsigned integer to the current stream and advances the current position of the stream by one to eight bytes.

Exceptions
ThrowsConversionException if value exceeds the maximum.

Definition at line 366 of file binarywriter.h.

◆ writeVariableLengthUIntLE()

void CppUtilities::BinaryWriter::writeVariableLengthUIntLE ( std::uint64_t value)
inline

Writes an up to 8 byte long little endian unsigned integer to the current stream and advances the current position of the stream by one to eight bytes.

Exceptions
ThrowsConversionException if value exceeds the maximum.

Definition at line 509 of file binarywriter.h.


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