CyberEngineMkIII
|
Contains the basic File interface. Does not perform locking of any kind, be aware of possible race conditions. Note that reads and writes that fail should not be retried. More...
#include <File.hpp>
Public Types | |
enum | Method : byte { Method::ANY, Method::EXIST, Method::CREATE, Method::TRUNCATE } |
The method of handling Files that already exist. More... | |
using | Constructor = Interop::Constructor< const Path &, const Mode, const Method > |
See Interop Construction. Opens a file for access. More... | |
![]() | |
enum | ID { ID::NULL_ID, ID::File, ID::Mutex, ID::Path, ID::Semaphore } |
Defines the IDs of allocatable engine objects. More... | |
using | Constructor = NullConstructor |
Override in descendants. | |
using | CopyConstructor = NullConstructor |
Override in descendants. | |
![]() | |
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 unsigned long long | Size (void) const =0 |
Get the current size of the File. More... | |
virtual unsigned long long | CursorPosition (void) const noexcept=0 |
Get the current position of the read/write cursor in the Stream. Equivalent of Seek(0, SeekLocation::CURSOR) More... | |
virtual const Path & | GetPath (void) const noexcept=0 |
Get the Path indicating the current File. More... | |
virtual Method | OpenMethod (void) const noexcept=0 |
Gets the opening method of the File. Will never be Method::ANY. More... | |
![]() | |
virtual | ~Allocatable ()=default |
See Default Constructors and Destructor. | |
![]() | |
virtual void | Capabilities (Mode &AMode, bool &ASeek) const noexcept=0 |
Get the capabilities of the stream. 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... | |
Additional Inherited Members | |
![]() | |
template<class AParent > | |
static constexpr ID | GetID (void) |
Returns the ID of an allocatable object. More... | |
Contains the basic File interface. Does not perform locking of any kind, be aware of possible race conditions. Note that reads and writes that fail should not be retried.
using CYB::API::File::Constructor = Interop::Constructor<const Path&, const Mode, const Method> |
See Interop Construction. Opens a file for access.
AMode
equals Mode::READ and the file could not be opened AMode
equals Mode::WRITE or Mode::READ_WRITE and the file could not be opened AMethod
equals Method::EXIST and the file portion of APath
does not exist or if it is not valid in other cases. AMethod
equals Method::CREATE and the file portion of APath
already exists or is a directory AMode
, or AMethod
is invalid AMode
is Mode::READ and AMethod
is Method::TRUNCATE. Operating systems require write permissions to truncate a file
|
strong |
The method of handling Files that already exist.
Enumerator | |
---|---|
ANY |
The File may or may not exist. It will be created if it doesn't. OpenMethod will be set to EXIST or CREATE once constructed to indicate result. |
EXIST |
The File must exist. |
CREATE |
The File must not exist. It will be created. |
TRUNCATE |
Any existing File will be overwritten and an empty file will be created. |
Definition at line 8 of file File.hpp.
|
pure virtualnoexcept |
Get the current position of the read/write cursor in the Stream. Equivalent of Seek(0, SeekLocation::CURSOR)
Implements CYB::API::Stream.
Implemented in CYB::Platform::System::File.
|
pure virtualnoexcept |
Get the Path indicating the current File.
Implemented in CYB::Platform::System::File.
|
pure virtualnoexcept |
Gets the opening method of the File. Will never be Method::ANY.
Implemented in CYB::Platform::System::File.
|
pure virtual |
Get the current size of the File.
CYB::Exception::SystemData | Error code: CYB::Exception::SystemData::STREAM_NOT_READABLE. Thrown if the size could not be retrieved |
Implemented in CYB::Platform::System::File.