MAGE  v0.171.0
Matthias Advanced Game Engine
mage::BigEndianBinaryWriter Class Referenceabstract

#include <binary_writer.hpp>

Inheritance diagram for mage::BigEndianBinaryWriter:
mage::rendering::loader::MSHWriter< VertexT, IndexT >

Public Member Functions

BigEndianBinaryWriteroperator= (const BigEndianBinaryWriter &writer)=delete
 
BigEndianBinaryWriteroperator= (BigEndianBinaryWriter &&writer) noexcept
 
void WriteToFile (std::filesystem::path path)
 

Protected Member Functions

 BigEndianBinaryWriter ()
 
 BigEndianBinaryWriter (const BigEndianBinaryWriter &writer)=delete
 
 BigEndianBinaryWriter (BigEndianBinaryWriter &&writer) noexcept
 
 ~BigEndianBinaryWriter ()
 
const std::filesystem::path & GetPath () const noexcept
 
template<typename T >
void Write (const T &data)
 
template<typename T >
void WriteArray (gsl::span< const T > data)
 
void WriteCharacter (char c)
 
void WriteString (NotNull< const_zstring > str)
 

Private Member Functions

virtual void WriteData ()=0
 

Private Attributes

UniqueFileStream m_file_stream
 
std::filesystem::path m_path
 

Detailed Description

A class of writers for writing (big endian) binary files.

Constructor & Destructor Documentation

◆ BigEndianBinaryWriter() [1/3]

mage::BigEndianBinaryWriter::BigEndianBinaryWriter ( )
protected

Constructs a big endian binary writer.

◆ BigEndianBinaryWriter() [2/3]

mage::BigEndianBinaryWriter::BigEndianBinaryWriter ( const BigEndianBinaryWriter writer)
protecteddelete

Constructs a big endian binary writer from the given big endian binary writer.

Parameters
[in]writerA reference to the big endian binary writer to copy.

◆ BigEndianBinaryWriter() [3/3]

mage::BigEndianBinaryWriter::BigEndianBinaryWriter ( BigEndianBinaryWriter &&  writer)
protecteddefaultnoexcept

Constructs a big endian binary writer by moving the given big endian binary writer.

Parameters
[in]writerA reference to the big endian binary writer to move.

◆ ~BigEndianBinaryWriter()

mage::BigEndianBinaryWriter::~BigEndianBinaryWriter ( )
protecteddefault

Destructs this big endian binary writer.

Member Function Documentation

◆ GetPath()

const std::filesystem::path& mage::BigEndianBinaryWriter::GetPath ( ) const
protectednoexcept

Returns the current path of this big endian binary writer.

Returns
A reference to the current path of this big endian binary writer.

◆ operator=() [1/2]

BigEndianBinaryWriter& mage::BigEndianBinaryWriter::operator= ( const BigEndianBinaryWriter writer)
delete

Copies the given big endian binary writer to this big endian binary writer.

Parameters
[in]writerA reference to a big endian binary writer to copy.
Returns
A reference to the copy of the given big endian binary writer (i.e. this big endian binary writer).

◆ operator=() [2/2]

BigEndianBinaryWriter & mage::BigEndianBinaryWriter::operator= ( BigEndianBinaryWriter &&  writer)
defaultnoexcept

Moves the given big endian binary writer to this big endian binary writer.

Parameters
[in]writerA reference to a big endian binary writer to move.
Returns
A reference to the moved big endian binary writer (i.e. this big endian binary writer).

◆ Write()

template<typename T >
void mage::BigEndianBinaryWriter::Write ( const T &  data)
protected

Writes the given data.

Template Parameters
TThe data type.
Parameters
[in]dataA reference to the data.
Exceptions
ExceptionFailed to write the given data.

◆ WriteArray()

template<typename T >
void mage::BigEndianBinaryWriter::WriteArray ( gsl::span< const T >  data)
protected

Writes the given data array.

Template Parameters
TThe data type.
Parameters
[in]dataThe data array.
Exceptions
ExceptionFailed to write the given data.

◆ WriteCharacter()

void mage::BigEndianBinaryWriter::WriteCharacter ( char  c)
protected

Writes the given character.

Parameters
[in]cThe character to write.
Exceptions
ExceptionFailed to write the given character.

◆ WriteData()

virtual void mage::BigEndianBinaryWriter::WriteData ( )
privatepure virtual

Starts writing.

Exceptions
ExceptionFailed to write.

Implemented in mage::rendering::loader::MSHWriter< VertexT, IndexT >.

◆ WriteString()

void mage::BigEndianBinaryWriter::WriteString ( NotNull< const_zstring str)
protected

Writes the given string.

Parameters
[in]strA pointer to the first null-terminated byte string to write.
Exceptions
ExceptionFailed to write the given string.

◆ WriteToFile()

void mage::BigEndianBinaryWriter::WriteToFile ( std::filesystem::path  path)

Writes to the file associated with the given path.

Parameters
[in]pathThe path.
Exceptions
ExceptionFailed to write to the file.

Member Data Documentation

◆ m_file_stream

UniqueFileStream mage::BigEndianBinaryWriter::m_file_stream
private

A pointer to the file stream of this big endian binary writer.

◆ m_path

std::filesystem::path mage::BigEndianBinaryWriter::m_path
private

The current path of this big endian binary writer.