VirtualFile class provides an interface for file operations in a virtual file system.
More...
#include <VirtualFile.h>
|
void | getStat () const |
| Get the file status information.
|
|
|
VirtualFileSystem * | _fs |
| Pointer to the virtual file system.
|
|
FILE * | _file |
| Pointer to the file.
|
|
DIR * | _dir |
| Pointer to the directory.
|
|
char * | _path |
| Path of the file.
|
|
bool | _isDirectory |
| Whether the file is a directory.
|
|
struct stat | _stat |
| File status information.
|
|
bool | _written |
| Whether the file has been written to.
|
|
VirtualFile class provides an interface for file operations in a virtual file system.
◆ VirtualFile()
VirtualFile::VirtualFile |
( |
VirtualFileSystem * | fs, |
|
|
const char * | path, |
|
|
const char * | mode ) |
Constructor
- Parameters
-
fs | - pointer to the virtual file system |
path | - path of the file |
mode | - mode to open the file in |
◆ ~VirtualFile()
VirtualFile::~VirtualFile |
( |
| ) |
|
|
override |
◆ Close()
void VirtualFile::Close |
( |
| ) |
|
|
overridevirtual |
◆ Flush()
void VirtualFile::Flush |
( |
| ) |
|
|
overridevirtual |
◆ GetLastWrite()
time_t VirtualFile::GetLastWrite |
( |
| ) |
|
|
overridevirtual |
Get the last write time of the file
- Returns
- the last write time
Implements ntdv::IFile.
◆ GetNextFileName() [1/2]
String VirtualFile::GetNextFileName |
( |
| ) |
|
|
overridevirtual |
Get the name of the next file in the directory
- Returns
- the name of the next file
Implements ntdv::IFile.
◆ GetNextFileName() [2/2]
String VirtualFile::GetNextFileName |
( |
bool * | isDir | ) |
|
|
overridevirtual |
Get the name of the next file in the directory and whether it is a directory
- Parameters
-
isDir | - pointer to a boolean to store whether the file is a directory |
- Returns
- the name of the next file
Implements ntdv::IFile.
◆ getStat()
void VirtualFile::getStat |
( |
| ) |
const |
|
protected |
Get the file status information.
◆ IsDirectory()
boolean VirtualFile::IsDirectory |
( |
| ) |
|
|
overridevirtual |
Check if the file is a directory
- Returns
- true if the file is a directory, false otherwise
Implements ntdv::IFile.
◆ Name()
const char * VirtualFile::Name |
( |
| ) |
const |
|
overridevirtual |
Get the name of the file
- Returns
- the file name
Implements ntdv::IFile.
◆ OpenNextFile()
FilePtr VirtualFile::OpenNextFile |
( |
const char * | mode | ) |
|
|
overridevirtual |
Open the next file in the directory
- Parameters
-
mode | - mode to open the file in |
- Returns
- a shared pointer to the opened file
Implements ntdv::IFile.
◆ operator bool()
VirtualFile::operator bool |
( |
| ) |
|
|
overridevirtual |
Check if the file is valid
- Returns
- true if the file is valid, false otherwise
Implements ntdv::IFile.
◆ Path()
const char * VirtualFile::Path |
( |
| ) |
const |
|
overridevirtual |
Get the path of the file
- Returns
- the file path
Implements ntdv::IFile.
◆ Position()
size_t VirtualFile::Position |
( |
| ) |
const |
|
overridevirtual |
Get the current position in the file
- Returns
- the current position
Implements ntdv::IFile.
◆ Read()
size_t VirtualFile::Read |
( |
uint8_t * | buf, |
|
|
size_t | size ) |
|
overridevirtual |
Read data from the file
- Parameters
-
buf | - buffer to store the data |
size | - size of the data to read |
- Returns
- the number of bytes read
Implements ntdv::IFile.
◆ RewindDirectory()
void VirtualFile::RewindDirectory |
( |
| ) |
|
|
overridevirtual |
Go to the begining of the directory.
Implements ntdv::IFile.
◆ Seek()
bool VirtualFile::Seek |
( |
uint32_t | pos, |
|
|
SeekMode | mode ) |
|
overridevirtual |
Seek to a position in the file
- Parameters
-
pos | - position to seek to |
mode | - mode of seeking |
- Returns
- true if successful, false otherwise
Implements ntdv::IFile.
◆ SeekDir()
boolean VirtualFile::SeekDir |
( |
long | position | ) |
|
|
overridevirtual |
Seek to a position in the directory
- Parameters
-
position | - position to seek to |
- Returns
- true if successful, false otherwise
Implements ntdv::IFile.
◆ SetBufferSize()
bool VirtualFile::SetBufferSize |
( |
size_t | size | ) |
|
|
overridevirtual |
Set the buffer size for the file
- Parameters
-
- Returns
- true if successful, false otherwise
Implements ntdv::IFile.
◆ Size()
size_t VirtualFile::Size |
( |
| ) |
const |
|
overridevirtual |
Get the size of the file
- Returns
- the size of the file
Implements ntdv::IFile.
◆ Write()
size_t VirtualFile::Write |
( |
const uint8_t * | buf, |
|
|
size_t | size ) |
|
overridevirtual |
Write data to the file
- Parameters
-
buf | - buffer containing the data |
size | - size of the data |
- Returns
- the number of bytes written
Implements ntdv::IFile.
◆ _dir
DIR* ntdv::VirtualFile::_dir |
|
protected |
Pointer to the directory.
◆ _file
FILE* ntdv::VirtualFile::_file |
|
protected |
◆ _fs
Pointer to the virtual file system.
◆ _isDirectory
bool ntdv::VirtualFile::_isDirectory |
|
protected |
Whether the file is a directory.
◆ _path
char* ntdv::VirtualFile::_path |
|
protected |
◆ _stat
struct stat ntdv::VirtualFile::_stat |
|
protected |
◆ _written
bool ntdv::VirtualFile::_written |
|
mutableprotected |
Whether the file has been written to.
The documentation for this class was generated from the following files: