C++ Utilities  4.17.0
Useful C++ classes and routines such as argument parser, IO and conversion utilities
Public Member Functions | List of all members
IoUtilities::BinaryWriter Class Reference

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

#include <binarywriter.h>

Public Member Functions

 BinaryWriter (std::ostream *stream)
 Constructs a new BinaryWriter. More...
 
 BinaryWriter (const BinaryWriter &other)
 Copies the specified BinaryWriter. More...
 
BinaryWriteroperator= (const BinaryWriter &rhs)=delete
 
 ~BinaryWriter ()
 Destroys the BinaryWriter. More...
 
const std::ostream * stream () const
 Returns a pointer to the stream the writer will write to when calling one of the write-methods. More...
 
std::ostream * stream ()
 Returns a pointer to the stream the writer will write to when calling one of the write-methods. More...
 
void setStream (std::ostream *stream, bool giveOwnership=false)
 Assigns the stream the writer will write to when calling one of the write-methods. More...
 
bool hasOwnership () const
 Returns whether the writer takes ownership over the assigned stream. More...
 
void giveOwnership ()
 The writer will take ownership over the assigned stream. More...
 
void detatchOwnership ()
 The writer will not take ownership over the assigned stream. More...
 
void flush ()
 Calls the flush() method of the assigned stream. More...
 
bool fail () const
 Returns an indication whether the fail bit of the assigned stream is set. More...
 
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. More...
 
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. More...
 
void writeChar (char value)
 Writes a single character to the current stream and advances the current position of the stream by one byte. More...
 
void writeByte (byte value)
 Writes a single byte to the current stream and advances the current position of the stream by one byte. More...
 
void writeInt16BE (int16 value)
 Writes a 16-bit big endian signed integer to the current stream and advances the current position of the stream by two bytes. More...
 
void writeUInt16BE (uint16 value)
 Writes a 16-bit big endian unsigned integer to the current stream and advances the current position of the stream by two bytes. More...
 
void writeInt24BE (int32 value)
 Writes a 24-bit big endian signed integer to the current stream and advances the current position of the stream by three bytes. More...
 
void writeUInt24BE (uint32 value)
 Writes a 24-bit big endian unsigned integer to the current stream and advances the current position of the stream by three bytes. More...
 
void writeInt32BE (int32 value)
 Writes a 32-bit big endian signed integer to the current stream and advances the current position of the stream by four bytes. More...
 
void writeUInt32BE (uint32 value)
 Writes a 32-bit big endian unsigned integer to the current stream and advances the current position of the stream by four bytes. More...
 
void writeInt40BE (int64 value)
 Writes a 40-bit big endian signed integer to the current stream and advances the current position of the stream by four bytes. More...
 
void writeUInt40BE (uint64 value)
 Writes a 40-bit big endian unsigned integer to the current stream and advances the current position of the stream by four bytes. More...
 
void writeInt56BE (int64 value)
 Writes a 56-bit big endian signed integer to the current stream and advances the current position of the stream by four bytes. More...
 
void writeUInt56BE (uint64 value)
 Writes a 56-bit big endian unsigned integer to the current stream and advances the current position of the stream by four bytes. More...
 
void writeInt64BE (int64 value)
 Writes a 64-bit big endian signed integer to the current stream and advances the current position of the stream by eight bytes. More...
 
void writeUInt64BE (uint64 value)
 Writes a 64-bit big endian unsigned integer to the current stream and advances the current position of the stream by eight bytes. More...
 
void writeVariableLengthUIntBE (uint64 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. More...
 
void writeFloat32BE (float32 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. More...
 
void writeFloat64BE (float64 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. More...
 
void writeInt16LE (int16 value)
 Writes a 16-bit little endian signed integer to the current stream and advances the current position of the stream by two bytes. More...
 
void writeUInt16LE (uint16 value)
 Writes a 16-bit little endian unsigned integer to the current stream and advances the current position of the stream by two bytes. More...
 
void writeInt24LE (int32 value)
 Writes a 24-bit little endian signed integer to the current stream and advances the current position of the stream by three bytes. More...
 
void writeUInt24LE (uint32 value)
 Writes a 24-bit little endian unsigned integer to the current stream and advances the current position of the stream by three bytes. More...
 
void writeInt32LE (int32 value)
 Writes a 32-bit little endian signed integer to the current stream and advances the current position of the stream by four bytes. More...
 
void writeUInt32LE (uint32 value)
 Writes a 32-bit little endian unsigned integer to the current stream and advances the current position of the stream by four bytes. More...
 
void writeInt40LE (int64 value)
 Writes a 40-bit big endian signed integer to the current stream and advances the current position of the stream by four bytes. More...
 
void writeUInt40LE (uint64 value)
 Writes a 40-bit big endian unsigned integer to the current stream and advances the current position of the stream by four bytes. More...
 
void writeInt56LE (int64 value)
 Writes a 56-bit big endian signed integer to the current stream and advances the current position of the stream by four bytes. More...
 
void writeUInt56LE (uint64 value)
 Writes a 56-bit big endian unsigned integer to the current stream and advances the current position of the stream by four bytes. More...
 
void writeInt64LE (int64 value)
 Writes a 64-bit little endian signed integer to the current stream and advances the current position of the stream by eight bytes. More...
 
void writeUInt64LE (uint64 value)
 Writes a 64-bit little endian unsigned integer to the current stream and advances the current position of the stream by eight bytes. More...
 
void writeVariableLengthUIntLE (uint64 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. More...
 
void writeFloat32LE (float32 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. More...
 
void writeFloat64LE (float64 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. More...
 
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. More...
 
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. More...
 
void writeLengthPrefixedString (const std::string &value)
 Writes the length of a string and the string itself to the current stream. More...
 
void writeLengthPrefixedCString (const char *value, std::size_t size)
 Writes the length of a string and the string itself to the current stream. More...
 
void writeBool (bool value)
 Writes a boolean value to the current stream and advances the current position of the stream by one byte. More...
 
void writeSynchsafeUInt32BE (uint32 valueToConvertAndWrite)
 Writes a 32-bit big endian synchsafe integer to the current stream and advances the current position of the stream by four bytes. More...
 
void writeFixed8BE (float32 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. More...
 
void writeFixed16BE (float32 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. More...
 
void writeSynchsafeUInt32LE (uint32 valueToConvertAndWrite)
 Writes a 32-bit little endian synchsafe integer to the current stream and advances the current position of the stream by four bytes. More...
 
void writeFixed8LE (float32 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. More...
 
void writeFixed16LE (float32 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. More...
 
void write (char oneChar)
 Writes a single character to the current stream and advances the current position of the stream by one byte. More...
 
void write (byte oneByte)
 Writes a single byte to the current stream and advances the current position of the stream by one byte. More...
 
void write (bool oneBool)
 Writes a boolean value to the current stream and advances the current position of the stream by one byte. More...
 
void write (const std::string &lengthPrefixedString)
 Writes the length of a string and the string itself to the current stream. More...
 
void write (const char *lengthPrefixedString)
 Writes the length of a string and the string itself to the current stream. More...
 
void write (int16 one16BitInt)
 Writes a 16-bit big endian signed integer to the current stream and advances the current position of the stream by two bytes. More...
 
void write (uint16 one16BitUint)
 Writes a 16-bit big endian unsigned integer to the current stream and advances the current position of the stream by two bytes. More...
 
void write (int32 one32BitInt)
 Writes a 32-bit big endian signed integer to the current stream and advances the current position of the stream by four bytes. More...
 
void write (uint32 one32BitUint)
 Writes a 32-bit big endian unsigned integer to the current stream and advances the current position of the stream by four bytes. More...
 
void write (int64 one64BitInt)
 Writes a 64-bit big endian signed integer to the current stream and advances the current position of the stream by eight bytes. More...
 
void write (uint64 one64BitUint)
 Writes a 64-bit big endian unsigned integer to the current stream and advances the current position of the stream by eight bytes. More...
 
void write (float32 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. More...
 
void write (float64 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. More...
 

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]

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

Constructs a new BinaryWriter.

Parameters
streamSpecifies the stream to write to.

Definition at line 23 of file binarywriter.cpp.

◆ BinaryWriter() [2/2]

BinaryWriter::BinaryWriter ( const BinaryWriter other)

Copies the specified BinaryWriter.

Remarks
The copy will not take ownership over the stream.

Definition at line 33 of file binarywriter.cpp.

◆ ~BinaryWriter()

BinaryWriter::~BinaryWriter ( )

Destroys the BinaryWriter.

Definition at line 42 of file binarywriter.cpp.

Member Function Documentation

◆ detatchOwnership()

void IoUtilities::BinaryWriter::detatchOwnership ( )
inline

The writer will not take ownership over the assigned stream.

See also
setStream()
giveOwnership()
hasOwnership()

Definition at line 151 of file binarywriter.h.

◆ fail()

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

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

Definition at line 167 of file binarywriter.h.

◆ flush()

void IoUtilities::BinaryWriter::flush ( )
inline

Calls the flush() method of the assigned stream.

Definition at line 159 of file binarywriter.h.

◆ giveOwnership()

void IoUtilities::BinaryWriter::giveOwnership ( )
inline

The writer will take ownership over the assigned stream.

See also
setStream()
detatchOwnership()
hasOwnership()

Definition at line 137 of file binarywriter.h.

◆ hasOwnership()

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

Returns whether the writer takes ownership over the assigned stream.

See also
setStream()
giveOwnership()
detatchOwnership()

Definition at line 125 of file binarywriter.h.

◆ operator=()

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

◆ setStream()

void 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.
giveOwnershipIndicated whether the reader should take ownership (default is false).
See also
setStream()

Definition at line 60 of file binarywriter.cpp.

◆ stream() [1/2]

const std::ostream * IoUtilities::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 113 of file binarywriter.h.

◆ stream() [2/2]

std::ostream * IoUtilities::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 103 of file binarywriter.h.

◆ write() [1/15]

void IoUtilities::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 175 of file binarywriter.h.

◆ write() [2/15]

void IoUtilities::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 184 of file binarywriter.h.

◆ write() [3/15]

void IoUtilities::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 571 of file binarywriter.h.

◆ write() [4/15]

void IoUtilities::BinaryWriter::write ( byte  oneByte)
inline

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

Definition at line 579 of file binarywriter.h.

◆ write() [5/15]

void IoUtilities::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 587 of file binarywriter.h.

◆ write() [6/15]

void IoUtilities::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 597 of file binarywriter.h.

◆ write() [7/15]

void IoUtilities::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 607 of file binarywriter.h.

◆ write() [8/15]

void IoUtilities::BinaryWriter::write ( int16  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 615 of file binarywriter.h.

◆ write() [9/15]

void IoUtilities::BinaryWriter::write ( uint16  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 623 of file binarywriter.h.

◆ write() [10/15]

void IoUtilities::BinaryWriter::write ( int32  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 631 of file binarywriter.h.

◆ write() [11/15]

void IoUtilities::BinaryWriter::write ( uint32  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 639 of file binarywriter.h.

◆ write() [12/15]

void IoUtilities::BinaryWriter::write ( int64  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 647 of file binarywriter.h.

◆ write() [13/15]

void IoUtilities::BinaryWriter::write ( uint64  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 655 of file binarywriter.h.

◆ write() [14/15]

void IoUtilities::BinaryWriter::write ( float32  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 663 of file binarywriter.h.

◆ write() [15/15]

void IoUtilities::BinaryWriter::write ( float64  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 671 of file binarywriter.h.

◆ writeBool()

void IoUtilities::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 210 of file binarywriter.h.

◆ writeByte()

void IoUtilities::BinaryWriter::writeByte ( byte  value)
inline

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

Definition at line 201 of file binarywriter.h.

◆ writeChar()

void IoUtilities::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 192 of file binarywriter.h.

◆ writeFixed16BE()

void IoUtilities::BinaryWriter::writeFixed16BE ( float32  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 537 of file binarywriter.h.

◆ writeFixed16LE()

void IoUtilities::BinaryWriter::writeFixed16LE ( float32  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 563 of file binarywriter.h.

◆ writeFixed8BE()

void IoUtilities::BinaryWriter::writeFixed8BE ( float32  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 529 of file binarywriter.h.

◆ writeFixed8LE()

void IoUtilities::BinaryWriter::writeFixed8LE ( float32  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 555 of file binarywriter.h.

◆ writeFloat32BE()

void IoUtilities::BinaryWriter::writeFloat32BE ( float32  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 342 of file binarywriter.h.

◆ writeFloat32LE()

void IoUtilities::BinaryWriter::writeFloat32LE ( float32  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 485 of file binarywriter.h.

◆ writeFloat64BE()

void IoUtilities::BinaryWriter::writeFloat64BE ( float64  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 351 of file binarywriter.h.

◆ writeFloat64LE()

void IoUtilities::BinaryWriter::writeFloat64LE ( float64  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 494 of file binarywriter.h.

◆ writeInt16BE()

void IoUtilities::BinaryWriter::writeInt16BE ( int16  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 218 of file binarywriter.h.

◆ writeInt16LE()

void IoUtilities::BinaryWriter::writeInt16LE ( int16  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 360 of file binarywriter.h.

◆ writeInt24BE()

void IoUtilities::BinaryWriter::writeInt24BE ( int32  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 237 of file binarywriter.h.

◆ writeInt24LE()

void IoUtilities::BinaryWriter::writeInt24LE ( int32  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 379 of file binarywriter.h.

◆ writeInt32BE()

void IoUtilities::BinaryWriter::writeInt32BE ( int32  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 257 of file binarywriter.h.

◆ writeInt32LE()

void IoUtilities::BinaryWriter::writeInt32LE ( int32  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 400 of file binarywriter.h.

◆ writeInt40BE()

void IoUtilities::BinaryWriter::writeInt40BE ( int64  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 276 of file binarywriter.h.

◆ writeInt40LE()

void IoUtilities::BinaryWriter::writeInt40LE ( int64  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 419 of file binarywriter.h.

◆ writeInt56BE()

void IoUtilities::BinaryWriter::writeInt56BE ( int64  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 296 of file binarywriter.h.

◆ writeInt56LE()

void IoUtilities::BinaryWriter::writeInt56LE ( int64  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 439 of file binarywriter.h.

◆ writeInt64BE()

void IoUtilities::BinaryWriter::writeInt64BE ( int64  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 315 of file binarywriter.h.

◆ writeInt64LE()

void IoUtilities::BinaryWriter::writeInt64LE ( int64  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 458 of file binarywriter.h.

◆ writeLengthPrefixedCString()

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

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.
Todo:
Make inline in v5.

Definition at line 115 of file binarywriter.cpp.

◆ writeLengthPrefixedString()

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

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.
Todo:
Make inline in v5.

Definition at line 101 of file binarywriter.cpp.

◆ writeString()

void IoUtilities::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 503 of file binarywriter.h.

◆ writeSynchsafeUInt32BE()

void IoUtilities::BinaryWriter::writeSynchsafeUInt32BE ( uint32  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 521 of file binarywriter.h.

◆ writeSynchsafeUInt32LE()

void IoUtilities::BinaryWriter::writeSynchsafeUInt32LE ( uint32  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 547 of file binarywriter.h.

◆ writeTerminatedString()

void IoUtilities::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 511 of file binarywriter.h.

◆ writeUInt16BE()

void IoUtilities::BinaryWriter::writeUInt16BE ( uint16  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 227 of file binarywriter.h.

◆ writeUInt16LE()

void IoUtilities::BinaryWriter::writeUInt16LE ( uint16  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 369 of file binarywriter.h.

◆ writeUInt24BE()

void IoUtilities::BinaryWriter::writeUInt24BE ( uint32  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 247 of file binarywriter.h.

◆ writeUInt24LE()

void IoUtilities::BinaryWriter::writeUInt24LE ( uint32  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 390 of file binarywriter.h.

◆ writeUInt32BE()

void IoUtilities::BinaryWriter::writeUInt32BE ( uint32  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 266 of file binarywriter.h.

◆ writeUInt32LE()

void IoUtilities::BinaryWriter::writeUInt32LE ( uint32  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 409 of file binarywriter.h.

◆ writeUInt40BE()

void IoUtilities::BinaryWriter::writeUInt40BE ( uint64  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 286 of file binarywriter.h.

◆ writeUInt40LE()

void IoUtilities::BinaryWriter::writeUInt40LE ( uint64  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 429 of file binarywriter.h.

◆ writeUInt56BE()

void IoUtilities::BinaryWriter::writeUInt56BE ( uint64  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 306 of file binarywriter.h.

◆ writeUInt56LE()

void IoUtilities::BinaryWriter::writeUInt56LE ( uint64  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 449 of file binarywriter.h.

◆ writeUInt64BE()

void IoUtilities::BinaryWriter::writeUInt64BE ( uint64  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 324 of file binarywriter.h.

◆ writeUInt64LE()

void IoUtilities::BinaryWriter::writeUInt64LE ( uint64  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 467 of file binarywriter.h.

◆ writeVariableLengthUIntBE()

void IoUtilities::BinaryWriter::writeVariableLengthUIntBE ( uint64  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 334 of file binarywriter.h.

◆ writeVariableLengthUIntLE()

void IoUtilities::BinaryWriter::writeVariableLengthUIntLE ( uint64  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 477 of file binarywriter.h.


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