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

#include <writer.hpp>

Inheritance diagram for mage::Writer:
mage::loader::VARWriter mage::rendering::loader::MDLWriter< VertexT, IndexT >

Public Member Functions

Writeroperator= (const Writer &writer)=delete
 
Writeroperator= (Writer &&writer) noexcept
 
void WriteToFile (std::filesystem::path path)
 

Protected Member Functions

 Writer ()
 
 Writer (const Writer &writer)=delete
 
 Writer (Writer &&writer) noexcept
 
 ~Writer ()
 
const std::filesystem::path & GetPath () const noexcept
 
void WriteCharacter (char c)
 
void WriteString (NotNull< const_zstring > str)
 
void WriteStringLine (NotNull< const_zstring > str)
 

Private Member Functions

virtual void Write ()=0
 

Private Attributes

UniqueFileStream m_file_stream
 
std::filesystem::path m_path
 

Detailed Description

A class of writers for writing (non-binary) text files.

Constructor & Destructor Documentation

◆ Writer() [1/3]

mage::Writer::Writer ( )
protected

Constructs a writer.

◆ Writer() [2/3]

mage::Writer::Writer ( const Writer writer)
protecteddelete

Constructs a writer from the given writer.

Parameters
[in]writerA reference to the writer to copy.

◆ Writer() [3/3]

mage::Writer::Writer ( Writer &&  writer)
protecteddefaultnoexcept

Constructs a writer by moving the given writer.

Parameters
[in]writerA reference to the writer to move.

◆ ~Writer()

mage::Writer::~Writer ( )
protecteddefault

Destructs this writer.

Member Function Documentation

◆ GetPath()

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

Returns the current path of this writer.

Returns
A reference to the current path of this writer.

◆ operator=() [1/2]

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

Copies the given writer to this writer.

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

◆ operator=() [2/2]

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

Moves the given writer to this writer.

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

◆ Write()

virtual void mage::Writer::Write ( )
privatepure virtual

Starts writing.

Exceptions
ExceptionFailed to write.

Implemented in mage::rendering::loader::MDLWriter< VertexT, IndexT >, and mage::loader::VARWriter.

◆ WriteCharacter()

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

Writes the given character.

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

◆ WriteString()

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

Writes the given string.

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

◆ WriteStringLine()

void mage::Writer::WriteStringLine ( NotNull< const_zstring str)
protected

Writes the given string and ends the current line.

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

◆ WriteToFile()

void mage::Writer::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::Writer::m_file_stream
private

A pointer to the file stream of this writer.

◆ m_path

std::filesystem::path mage::Writer::m_path
private

The current path of this writer.