![]() |
Max OS 0.3
|
Handles file operations and information. More...
#include <filesystem.h>
Public Member Functions | |
| virtual void | write (common::buffer_t *data, size_t size) |
| write data to the file | |
| virtual void | read (common::buffer_t *data, size_t size) |
| read data from the file | |
| virtual void | flush () |
| Flush the file to the disk. | |
| void | seek (SeekType seek_type, size_t offset) |
| Seek to a position in the file. | |
| uint32_t | position () const |
| Get where the file is currently at (amount read/write/seeked) | |
| size_t | size () const |
| Get the size of the file. | |
| string | name () |
| Get the name of the file. | |
Protected Attributes | |
| uint32_t | m_offset = 0 |
| The current offset in the file. | |
| string | m_name |
| The name of the file. | |
| size_t | m_size = 0 |
| The size of the file. | |
Handles file operations and information.
Definition at line 31 of file filesystem.h.
|
virtual |
Flush the file to the disk.
Reimplemented in MaxOS::filesystem::format::ext2::Ext2File, and MaxOS::filesystem::format::Fat32File.
Definition at line 41 of file filesystem.cpp.
Referenced by MaxOS::filesystem::format::ext2::Ext2File::flush(), and MaxOS::filesystem::format::Fat32File::flush().
| string File::name | ( | ) |
Get the name of the file.
Definition at line 82 of file filesystem.cpp.
References m_name.
Referenced by MaxOS::filesystem::format::ext2::Ext2File::Ext2File(), MaxOS::filesystem::format::Fat32File::Fat32File(), and MaxOS::filesystem::Directory::rename_file().
| uint32_t File::position | ( | ) | const |
Get where the file is currently at (amount read/write/seeked)
Definition at line 73 of file filesystem.cpp.
References m_offset.
Referenced by MaxOS::filesystem::FileResource::read().
|
virtual |
read data from the file
| data | The byte buffer to read into |
| amount | The amount of data to read |
Reimplemented in MaxOS::filesystem::format::ext2::Ext2File, and MaxOS::filesystem::format::Fat32File.
Definition at line 35 of file filesystem.cpp.
Referenced by MaxOS::filesystem::FileResource::read().
Seek to a position in the file.
| seek_type | The type of seek to perform (where to seek to) |
| offset | The amount to seek |
Definition at line 50 of file filesystem.cpp.
References m_offset, and size().
Referenced by MaxOS::filesystem::FileResource::write().
| size_t File::size | ( | ) | const |
Get the size of the file.
Definition at line 91 of file filesystem.cpp.
References m_size.
Referenced by MaxOS::filesystem::FileResource::read(), and seek().
|
virtual |
write data to the file
| data | The byte buffer to write |
| amount | The amount of data to write |
Reimplemented in MaxOS::filesystem::format::ext2::Ext2File, and MaxOS::filesystem::format::Fat32File.
Definition at line 26 of file filesystem.cpp.
Referenced by MaxOS::filesystem::FileResource::write().
|
protected |
The name of the file.
Definition at line 35 of file filesystem.h.
Referenced by MaxOS::filesystem::format::ext2::Ext2File::Ext2File(), MaxOS::filesystem::format::Fat32File::Fat32File(), and name().
|
protected |
The current offset in the file.
Definition at line 34 of file filesystem.h.
Referenced by MaxOS::filesystem::format::Fat32File::Fat32File(), position(), MaxOS::filesystem::format::ext2::Ext2File::read(), MaxOS::filesystem::format::Fat32File::read(), seek(), MaxOS::filesystem::format::ext2::Ext2File::write(), and MaxOS::filesystem::format::Fat32File::write().
|
protected |
The size of the file.
Definition at line 36 of file filesystem.h.
Referenced by MaxOS::filesystem::format::ext2::Ext2File::Ext2File(), MaxOS::filesystem::format::Fat32File::Fat32File(), MaxOS::filesystem::format::ext2::Ext2File::read(), size(), MaxOS::filesystem::format::ext2::Ext2File::write(), and MaxOS::filesystem::format::Fat32File::write().