|
CeresEngine 0.2.0
A game development framework
|
An interface that all data streams must implement. More...
#include <CeresEngine/Foundation/IO/Stream.hpp>
Public Types | |
| enum class | Seek { Start = SEEK_SET , Current = SEEK_CUR , End = SEEK_END } |
| An enumeration that describes how a data stream should be seeked. More... | |
Public Member Functions | |
| IStream ()=default | |
| IStream (const IStream &) noexcept=delete | |
| IStream & | operator= (const IStream &) noexcept=delete |
| IStream (IStream &&) noexcept=default | |
| IStream & | operator= (IStream &&) noexcept=default |
| virtual | ~IStream () noexcept=default |
| virtual bool | isSeekable (Seek mode=Seek::Start) const noexcept |
| Checks if the stream is seekable. | |
| virtual void | seek (std::streamsize position, Seek mode=Seek::Start) |
| Changes the position of the data stream. | |
| void | skip (const size_t n) |
Skips n bytes from the data stream. | |
| virtual bool | isTellable () const noexcept |
| Checks if the stream knows it's current absolute position. | |
| virtual size_t | tell () |
| Gets the absolute stream position, in bytes. | |
| virtual bool | isSizeKnown () const noexcept |
| Checks if the stream knows the size of the data. | |
| virtual size_t | size () |
| Gets the number of bytes available on the stream. | |
An interface that all data streams must implement.
This class’s interface is common to all stream classes, including its subclasses InputStream and OutputStream.
Stream objects provide an easy way to read and write data to and from a variety of media in a device-independent way. You can create stream objects for data located in memory, in a file, or on a network (using sockets), and you can use stream objects without loading all of the data into memory at once.
By default, Stream instances that aren’t file-based are non-seekable, one-way streams (although custom seekable subclasses are possible). After you provide or consume data, you can’t retrieve the data from the stream.
|
strong |
|
default |
|
defaultnoexcept |
|
virtualdefaultnoexcept |
|
inlinevirtualnoexcept |
Checks if the stream is seekable.
If this method returns true, seek() is safe to be called on this stream.
Reimplemented in CeresEngine::AsyncDataStreamAdapter, CeresEngine::MemoryDataStream, CeresEngine::FilteredInputStream, CeresEngine::FilteredOutputStream, CeresEngine::FilteredDataStream, CeresEngine::WrappedResourceInputStream, CeresEngine::WrappedResourceOutputStream, CeresEngine::FileDataStream, CeresEngine::PipeStream, CeresEngine::PipeInputStream, CeresEngine::PipeOutputStream, and CeresEngine::LimitedInputStream.
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 in CeresEngine::AsyncDataStreamAdapter, CeresEngine::FileDataStream, CeresEngine::MemoryDataStream, CeresEngine::PipeStream, CeresEngine::PipeInputStream, CeresEngine::PipeOutputStream, CeresEngine::FilteredInputStream, CeresEngine::FilteredOutputStream, CeresEngine::FilteredDataStream, CeresEngine::LimitedInputStream, CeresEngine::WrappedResourceInputStream, and CeresEngine::WrappedResourceOutputStream.
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 in CeresEngine::BufferedDataStream, CeresEngine::AsyncDataStreamAdapter, CeresEngine::FileDataStream, CeresEngine::MemoryDataStream, CeresEngine::PipeStream, CeresEngine::PipeInputStream, CeresEngine::PipeOutputStream, CeresEngine::FilteredInputStream, CeresEngine::FilteredOutputStream, CeresEngine::FilteredDataStream, CeresEngine::LimitedInputStream, CeresEngine::WrappedResourceInputStream, and CeresEngine::WrappedResourceOutputStream.
|
virtual |
Changes the position of the data stream.
isSeekable() returns true.| position | The position to set the data stream to. |
| mode | The mode to change the data stream position. |
Reimplemented in CeresEngine::FilteredInputStream, CeresEngine::FilteredOutputStream, CeresEngine::FilteredDataStream, CeresEngine::WrappedResourceInputStream, CeresEngine::WrappedResourceOutputStream, CeresEngine::BufferedInputStream, CeresEngine::BufferedOutputStream, CeresEngine::BufferedDataStream, CeresEngine::AsyncDataStreamAdapter, CeresEngine::FileDataStream, CeresEngine::MemoryDataStream, and CeresEngine::LimitedInputStream.
Gets the number of bytes available on the stream.
isSizeKnown() returns true. Reimplemented in CeresEngine::AsyncDataStreamAdapter, CeresEngine::FileDataStream, CeresEngine::MemoryDataStream, CeresEngine::FilteredInputStream, CeresEngine::FilteredOutputStream, CeresEngine::FilteredDataStream, CeresEngine::LimitedInputStream, CeresEngine::WrappedResourceInputStream, and CeresEngine::WrappedResourceOutputStream.
Gets the absolute stream position, in bytes.
isTellable() returns true. Reimplemented in CeresEngine::BufferedInputStream, CeresEngine::BufferedOutputStream, CeresEngine::BufferedDataStream, CeresEngine::AsyncDataStreamAdapter, CeresEngine::FileDataStream, CeresEngine::MemoryDataStream, CeresEngine::FilteredInputStream, CeresEngine::FilteredOutputStream, CeresEngine::FilteredDataStream, CeresEngine::LimitedInputStream, CeresEngine::WrappedResourceInputStream, and CeresEngine::WrappedResourceOutputStream.