ReXGlue SDK
Loading...
Searching...
No Matches
rex::filesystem::IFile Class Referenceabstract

#include <rex/filesystem/file.h>

Inheritance diagram for rex::filesystem::IFile:
[legend]

Public Member Functions

virtual FileStat GetInfo () const =0
virtual void Refresh ()=0
virtual Access GetAccess () const =0
virtual VolumeStat GetVolume () const =0
virtual Result< size_t > Read (std::span< u8 > buffer, u64 offset)=0
virtual Result< size_t > Write (std::span< const u8 > buffer, u64 offset)=0
virtual Result< void > SetLength (u64 length)=0
virtual Result< void > Flush ()=0
virtual Result< void > SetAttributes (FileAttributes attributes)=0
virtual Result< void > SetTimes (const FileTimes &times)=0
virtual void SetDeleteOnClose (bool delete_on_close)=0
virtual Result< std::unique_ptr< IDirectory > > List (std::string_view pattern)=0
virtual Result< std::span< const u8 > > View ()=0

Additional Inherited Members

Protected Member Functions inherited from rex::NonCopyable
 NonCopyable (const NonCopyable &)=delete
NonCopyable & operator= (const NonCopyable &)=delete

Detailed Description

An open file or directory. Handles on one path share a node.

Member Function Documentation

◆ GetAccess()

virtual Access rex::filesystem::IFile::GetAccess ( ) const
nodiscardpure virtual

Returns the access the file was opened with, generic bits expanded to data bits.

◆ List()

virtual Result< std::unique_ptr< IDirectory > > rex::filesystem::IFile::List ( std::string_view pattern)
nodiscardpure virtual

Starts a walk of the children of this directory.

Parameters
patternThe wildcard pattern, empty for every child.
Returns
The walk, or kNotDirectory for a file.

◆ Read()

virtual Result< size_t > rex::filesystem::IFile::Read ( std::span< u8 > buffer,
u64 offset )
nodiscardpure virtual

Copies bytes of the file.

Parameters
offsetByte offset in the file.
Returns
The bytes copied, kAccessDenied without read access, or kEndOfFile.

◆ Refresh()

virtual void rex::filesystem::IFile::Refresh ( )
pure virtual

Reads the node size again from its provider.

◆ SetLength()

virtual Result< void > rex::filesystem::IFile::SetLength ( u64 length)
nodiscardpure virtual

Changes the file size.

Parameters
lengthThe new size in bytes.
Returns
kAccessDenied without write access, kUnsupported when the provider cannot.

◆ SetTimes()

virtual Result< void > rex::filesystem::IFile::SetTimes ( const FileTimes & times)
nodiscardpure virtual

Changes the times of the node. An empty field keeps its time.

Returns
kAccessDenied on a read only mount.

◆ View()

virtual Result< std::span< const u8 > > rex::filesystem::IFile::View ( )
nodiscardpure virtual

Returns the whole file as bytes without a copy, or kUnsupported.

◆ Write()

virtual Result< size_t > rex::filesystem::IFile::Write ( std::span< const u8 > buffer,
u64 offset )
nodiscardpure virtual

Writes bytes into the file.

Parameters
bufferSource bytes.
offsetByte offset in the file.
Returns
The bytes written, or kAccessDenied without write access.

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