DiskFile¶
class DiskFile : public File
A File
implementation that reads and writes a file on disk.
Functions¶
Name | Description |
---|---|
DiskFile | Creates a new DiskFile instance. |
DiskFile | Creates a new DiskFile instance from a file handle. |
DiskFile | Creates a new DiskFile instance by opening a file at the given path. |
~DiskFile | Destroys the instance and release the file handler. |
GetPath | @inherit |
Eof | @inherit |
Read | @inherit |
Write | @inherit |
Length | @inherit |
Seek | @inherit |
Position | @inherit |
GetPtr | @inherit |
IsValid | @inherit |
Open | Opens a file at the given path. |
Close | Closes the file. |
Function Details¶
Close¶
void Close()
Closes the file.
DiskFile¶
DiskFile()
Creates a new DiskFile
instance.
explicit DiskFile(AmFileHandle fp)
Creates a new DiskFile
instance from a file handle.
- Parameter
fp
- The file handle to manage in this instance.
explicit DiskFile( const std::filesystem::path& fileName, eFileOpenMode mode = eFileOpenMode_Read, eFileOpenKind kind = eFileOpenKind_Binary)
Creates a new DiskFile instance by opening a file at the given path.
- Parameter
fileName
- The path to the file to open.
- Parameter
mode
- The open mode to use.
- Parameter
kind
- The type of file to open.
Eof¶
bool Eof() override
@inherit
GetPath¶
[[nodiscard]] AmOsString GetPath() const override
@inherit
GetPtr¶
AmVoidPtr GetPtr() override
@inherit
IsValid¶
[[nodiscard]] bool IsValid() const override
@inherit
Length¶
AmSize Length() override
@inherit
Open¶
AmResult Open( const std::filesystem::path& filePath, eFileOpenMode mode = eFileOpenMode_Read, eFileOpenKind kind = eFileOpenKind_Binary)
Opens a file at the given path.
- Parameter
filePath
- The path to the file to open.
- Parameter
mode
- The open mode to use.
- Parameter
kind
- The type of file to open.
- Return
- The result of the operation.
Position¶
AmSize Position() override
@inherit
Read¶
AmSize Read(AmUInt8Buffer dst, AmSize bytes) override
@inherit
Seek¶
void Seek(AmInt64 offset, eFileSeekOrigin origin) override
@inherit
Write¶
AmSize Write(AmConstUInt8Buffer src, AmSize bytes) override
@inherit
~DiskFile¶
~DiskFile() override
Destroys the instance and release the file handler.