CyberEngineMkIII
|
The interface for streaming reads and writes. More...
#include <Stream.hpp>
Public Types | |
enum | Mode : byte { Mode::READ = 1, Mode::WRITE, Mode::READ_WRITE } |
The available operations for the Stream. Bitset. More... | |
enum | SeekLocation { SeekLocation::BEGIN, SeekLocation::CURSOR, SeekLocation::END } |
The location to begin a seek operation at. More... | |
Public Member Functions | |
virtual void | Capabilities (Mode &AMode, bool &ASeek) const noexcept=0 |
Get the capabilities of the stream. More... | |
virtual unsigned long long | CursorPosition (void) const =0 |
Get the current position of the read/write cursor in the Stream. Equivalent of Seek(0, SeekLocation::CURSOR) More... | |
virtual unsigned long long | Seek (const long long AOffset, const SeekLocation ALocation) const =0 |
Set the cursor position in the Stream. More... | |
virtual unsigned long long | Read (void *const ABuffer, const unsigned long long AMaxAmount) const =0 |
Read data from a Stream at the current cursor position and advance the cursor by that amount. More... | |
virtual unsigned long long | Write (const void *const ABuffer, const unsigned long long AAmount)=0 |
Write data to the Stream at the current cursor position and advance the cursor by that amount. More... | |
The interface for streaming reads and writes.
Definition at line 7 of file Stream.hpp.
|
strong |
The available operations for the Stream. Bitset.
Enumerator | |
---|---|
READ |
Read only mode. |
WRITE |
Write only mode. |
READ_WRITE |
Read write mode. |
Definition at line 10 of file Stream.hpp.
|
strong |
The location to begin a seek operation at.
Enumerator | |
---|---|
BEGIN |
Seek from the beginning of the Stream. |
CURSOR |
Seek from the cursor position. |
END |
Seek from the end of the Stream. |
Definition at line 16 of file Stream.hpp.
|
pure virtualnoexcept |
Get the capabilities of the stream.
[out] | AMode | Returns the Mode of the Stream |
[out] | ASeek | Returns true if the stream is seekable, false otherwise |
|
pure virtual |
Get the current position of the read/write cursor in the Stream. Equivalent of Seek(0, SeekLocation::CURSOR)
CYB::Exception::Violation | Error code: CYB::Exception::Violation::INVALID_OPERATION. Thrown if the Stream cannot be seeked |
Implemented in CYB::API::SafeStream, CYB::Platform::System::File, and CYB::API::File.
|
pure virtual |
Read data from a Stream at the current cursor position and advance the cursor by that amount.
[out] | ABuffer | The location to store the read data |
AMaxAmount | The maximum number of bytes to be read |
AMaxAmount
, assume the underlying medium is currently out of readable data CYB::Exception::Violation | Error code: CYB::Exception::Violation::INVALID_OPERATION. Thrown if the Stream mode is Mode::WRITE |
Implemented in CYB::API::SafeStream, and CYB::Platform::System::File.
|
pure virtual |
Set the cursor position in the Stream.
AOffset | The offset from ALocation to set the cursor to |
ALocation | The initial location to begin the offset |
CYB::Exception::SystemData | Error code: CYB::Exception::SystemData::STREAM_NOT_READABLE. Thrown if an error occurs during the seek |
CYB::Exception::Violation | Error code: CYB::Exception::Violation::INVALID_ENUM. Thrown if ALocation is invalid |
CYB::Exception::Violation | Error code: CYB::Exception::Violation::INVALID_OPERATION. Thrown if the Stream cannot be seeked |
Implemented in CYB::API::SafeStream, and CYB::Platform::System::File.
|
pure virtual |
Write data to the Stream at the current cursor position and advance the cursor by that amount.
ABuffer | The location to get the data to write |
AAmount | The number of bytes to be written |
AMaxAmount
, assume the underlying medium is currently out of space CYB::Exception::Violation | Error code: CYB::Exception::Violation::INVALID_OPERATION. Thrown if the Stream mode is Mode::READ |
Implemented in CYB::API::SafeStream, and CYB::Platform::System::File.