Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
ph::StdOutputStream Class Reference

#include <StdOutputStream.h>

Inheritance diagram for ph::StdOutputStream:
ph::IOutputStream ph::IDataStream ph::BinaryFileOutputStream ph::FormattedTextOutputStream

Public Member Functions

 StdOutputStream ()=default
 
 StdOutputStream (std::unique_ptr< std::ostream > stream)
 
 StdOutputStream (StdOutputStream &&other) noexcept
 
void write (std::size_t numBytes, const std::byte *bytes) override
 Write data in the form of raw bytes in one go. The method does not return before finishing the writing process.
 
void writeString (std::string_view str) override
 Write a string in one go.
 
void seekPut (std::size_t pos) override
 Set the output position of the stream. The unit of the position is defined by the implementation.
 
std::optional< std::size_t > tellPut () override
 Get the current output position of the stream. The unit of the position is defined by the implementation.
 
 operator bool () const override
 
std::ostream * getStream () const
 
StdOutputStreamoperator= (StdOutputStream &&rhs) noexcept
 
- Public Member Functions inherited from ph::IOutputStream
virtual std::size_t writeSome (std::size_t numBytes, const std::byte *bytes)
 Write some data in the form of raw bytes. The method may return before finish writing all bytes. In such case, the method returns how many bytes were actually written.
 
void writeLine (std::string_view str)
 Write a line. Equivalent to calling writeString(std::string_view) with '
' as an extra character.
 
- Public Member Functions inherited from ph::IDataStream
virtual ~IDataStream ()=default
 
virtual std::string acquireName () const
 Access to the stream's name. This method is not meant to be used in a high performance context, unless otherwise stated by the overridder. Stream name is not always available.
 

Protected Member Functions

bool isStreamGoodForWrite () const
 
void ensureStreamIsGoodForWrite () const
 Check if the stream has any error.
 
std::string getReasonForError () const
 A description for why the stream is not in a good state.
 

Constructor & Destructor Documentation

◆ StdOutputStream() [1/3]

ph::StdOutputStream::StdOutputStream ( )
default

◆ StdOutputStream() [2/3]

ph::StdOutputStream::StdOutputStream ( std::unique_ptr< std::ostream > stream)
explicit

◆ StdOutputStream() [3/3]

ph::StdOutputStream::StdOutputStream ( StdOutputStream && other)
inlinenoexcept

Member Function Documentation

◆ ensureStreamIsGoodForWrite()

void ph::StdOutputStream::ensureStreamIsGoodForWrite ( ) const
protected

Check if the stream has any error.

Exceptions
IOExceptionIf there is any error.

◆ getReasonForError()

std::string ph::StdOutputStream::getReasonForError ( ) const
protected

A description for why the stream is not in a good state.

◆ getStream()

std::ostream * ph::StdOutputStream::getStream ( ) const
inline

◆ isStreamGoodForWrite()

bool ph::StdOutputStream::isStreamGoodForWrite ( ) const
inlineprotected

◆ operator bool()

ph::StdOutputStream::operator bool ( ) const
inlineoverridevirtual
Returns
Whether the stream is good for write.

Implements ph::IOutputStream.

◆ operator=()

StdOutputStream & ph::StdOutputStream::operator= ( StdOutputStream && rhs)
inlinenoexcept

◆ seekPut()

void ph::StdOutputStream::seekPut ( std::size_t pos)
overridevirtual

Set the output position of the stream. The unit of the position is defined by the implementation.

Exceptions
IOExceptionIf the seeking process failed.

Implements ph::IOutputStream.

◆ tellPut()

std::optional< std::size_t > ph::StdOutputStream::tellPut ( )
overridevirtual

Get the current output position of the stream. The unit of the position is defined by the implementation.

Returns
Current output position. Empty if the position is unavailable.

Implements ph::IOutputStream.

◆ write()

void ph::StdOutputStream::write ( std::size_t numBytes,
const std::byte * bytes )
overridevirtual

Write data in the form of raw bytes in one go. The method does not return before finishing the writing process.

Exceptions
IOExceptionIf the write operation failed.

Implements ph::IOutputStream.

◆ writeString()

void ph::StdOutputStream::writeString ( std::string_view str)
overridevirtual

Write a string in one go.

Parameters
strThe written string.
Exceptions
IOExceptionIf the write operation failed.

Implements ph::IOutputStream.


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