CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
CeresEngine::WrappedResourceOutputStream Class Reference

A specialized OutputStream for a ResourceStream. More...

#include <CeresEngine/Resource/ResourceStream.hpp>

Inheritance diagram for CeresEngine::WrappedResourceOutputStream:
CeresEngine::IResourceOutputStream CeresEngine::ResourceStream CeresEngine::IOutputStream CeresEngine::IStream CeresEngine::IStream

Public Member Functions

 WrappedResourceOutputStream (ResourceStreamLock &&lock, OutputStream &&stream)
 
OutputStreamgetDataStream () noexcept
 
const OutputStreamgetDataStream () const noexcept
 
bool isSeekable (const Seek mode=Seek::Start) const noexcept override
 Checks if the stream is seekable.
 
void seek (const std::streamsize position, const Seek mode=Seek::Start) override
 Changes the position of the data stream.
 
bool isTellable () const noexcept override
 Checks if the stream knows it's current absolute position.
 
size_t tell () override
 Gets the absolute stream position, in bytes.
 
bool isSizeKnown () const noexcept override
 Checks if the stream knows the size of the data.
 
size_t size () override
 Gets the number of bytes available on the stream.
 
bool isWritable () const noexcept override
 
size_t write (const void *data, const size_t n) override
 
bool flush () override
 
- Public Member Functions inherited from CeresEngine::ResourceStream
 ResourceStream (ResourceStreamLock &&lock)
 
HResource getResource () const
 Gets the resource to which this stream belongs to.
 
ResourceManagergetResourceManager () const
 Gets the resource manager of the resource that owns the stream.
 
- Public Member Functions inherited from CeresEngine::IStream
 IStream ()=default
 
 IStream (const IStream &) noexcept=delete
 
IStreamoperator= (const IStream &) noexcept=delete
 
 IStream (IStream &&) noexcept=default
 
IStreamoperator= (IStream &&) noexcept=default
 
virtual ~IStream () noexcept=default
 
void skip (const size_t n)
 Skips n bytes from the data stream.
 
- Public Member Functions inherited from CeresEngine::IOutputStream
template<typename T >
size_t write (const MemoryView< const T > &memoryView)
 Writes data from a memory view to the stream.
 
template<typename T >
size_t write (const StridedMemoryView< const T > &memoryView)
 Writes data from a strided memory view to the stream.
 
size_t writeString (const StringView string)
 Writes a string to the data stream.
 
template<typename T >
requires std::is_trivially_copyable_v<T>
bool write (T value)
 Writes a trivially copyable object to the stream.
 

Private Attributes

OutputStream mStream
 

Additional Inherited Members

- Public Types inherited from CeresEngine::IStream
enum class  Seek { Start = SEEK_SET , Current = SEEK_CUR , End = SEEK_END }
 An enumeration that describes how a data stream should be seeked. More...
 

Detailed Description

A specialized OutputStream for a ResourceStream.

Constructor & Destructor Documentation

◆ WrappedResourceOutputStream()

CeresEngine::WrappedResourceOutputStream::WrappedResourceOutputStream ( ResourceStreamLock &&  lock,
OutputStream &&  stream 
)
inlineexplicit

Member Function Documentation

◆ flush()

bool CeresEngine::WrappedResourceOutputStream::flush ( )
inlineoverridevirtual

Reimplemented from CeresEngine::IOutputStream.

◆ getDataStream() [1/2]

const OutputStream & CeresEngine::WrappedResourceOutputStream::getDataStream ( ) const
inlinenoexcept

◆ getDataStream() [2/2]

OutputStream & CeresEngine::WrappedResourceOutputStream::getDataStream ( )
inlinenoexcept

◆ isSeekable()

bool CeresEngine::WrappedResourceOutputStream::isSeekable ( const Seek  mode = Seek::Start) const
inlineoverridevirtualnoexcept

Checks if the stream is seekable.

If this method returns true, seek() is safe to be called on this stream.

Reimplemented from CeresEngine::IStream.

◆ isSizeKnown()

bool CeresEngine::WrappedResourceOutputStream::isSizeKnown ( ) const
inlineoverridevirtualnoexcept

Checks if the stream knows the size of the data.

If this method returns true, size() is safe to be called on this stream.

Reimplemented from CeresEngine::IStream.

◆ isTellable()

bool CeresEngine::WrappedResourceOutputStream::isTellable ( ) const
inlineoverridevirtualnoexcept

Checks if the stream knows it's current absolute position.

If this method returns true, tell() is safe to be called on this stream.

Reimplemented from CeresEngine::IStream.

◆ isWritable()

bool CeresEngine::WrappedResourceOutputStream::isWritable ( ) const
inlineoverridevirtualnoexcept

Reimplemented from CeresEngine::IOutputStream.

◆ seek()

void CeresEngine::WrappedResourceOutputStream::seek ( const std::streamsize  position,
const Seek  mode = Seek::Start 
)
inlineoverridevirtual

Changes the position of the data stream.

Note
This method is only callable if isSeekable() returns true.
Parameters
positionThe position to set the data stream to.
modeThe mode to change the data stream position.

Reimplemented from CeresEngine::IStream.

◆ size()

size_t CeresEngine::WrappedResourceOutputStream::size ( )
inlineoverridevirtual

Gets the number of bytes available on the stream.

Note
This method is only callable if isSizeKnown() returns true.

Reimplemented from CeresEngine::IStream.

◆ tell()

size_t CeresEngine::WrappedResourceOutputStream::tell ( )
inlineoverridevirtual

Gets the absolute stream position, in bytes.

Note
This method is only callable if isTellable() returns true.

Reimplemented from CeresEngine::IStream.

◆ write()

size_t CeresEngine::WrappedResourceOutputStream::write ( const void data,
const size_t  n 
)
inlineoverridevirtual

Reimplemented from CeresEngine::IOutputStream.

Member Data Documentation

◆ mStream

OutputStream CeresEngine::WrappedResourceOutputStream::mStream
private

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