MAV'RIC
|
Base class for file objects. More...
#include <file.hpp>
Public Member Functions | |
virtual bool | open (const char *path)=0 |
Open the file. | |
virtual bool | is_open ()=0 |
Indicates if the file is currently open. | |
virtual int8_t | exists (const char *path)=0 |
Indicates if the file exits. | |
virtual bool | close ()=0 |
Close the file. | |
virtual bool | read (uint8_t *data, uint32_t size)=0 |
Read from the file. | |
virtual bool | write (const uint8_t *data, uint32_t size)=0 |
Write to the file. | |
virtual bool | seek (int32_t offset, file_seekfrom_t origin)=0 |
Seek to a given offset within the file. | |
virtual uint32_t | offset ()=0 |
Get current location in file. | |
virtual uint32_t | length ()=0 |
Get the file length. | |
virtual bool | flush ()=0 |
flush buffer to file; Not implemented; | |
bool | newline () |
write newline character to file (' ') |
Base class for file objects.
virtual bool File::close | ( | ) | [pure virtual] |
Close the file.
Implemented in File_fat_fs, File_dummy, File_linux, and File_flash_avr32.
virtual int8_t File::exists | ( | const char * | path | ) | [pure virtual] |
Indicates if the file exits.
Implemented in File_fat_fs, File_linux, and File_flash_avr32.
virtual bool File::flush | ( | ) | [pure virtual] |
flush buffer to file; Not implemented;
Implemented in File_dummy, File_fat_fs, File_linux, and File_flash_avr32.
virtual bool File::is_open | ( | ) | [pure virtual] |
Indicates if the file is currently open.
Implemented in File_fat_fs, File_dummy, File_linux, and File_flash_avr32.
virtual uint32_t File::length | ( | ) | [pure virtual] |
Get the file length.
Implemented in File_dummy, File_fat_fs, File_linux, and File_flash_avr32.
bool File::newline | ( | ) |
write newline character to file ('
')
virtual uint32_t File::offset | ( | ) | [pure virtual] |
Get current location in file.
Implemented in File_dummy, File_fat_fs, File_linux, and File_flash_avr32.
virtual bool File::open | ( | const char * | path | ) | [pure virtual] |
virtual bool File::read | ( | uint8_t * | data, |
uint32_t | size | ||
) | [pure virtual] |
Read from the file.
data | Caller supplied buffer to write to. |
size | The number of bytes to attempt to read. |
Implemented in File_fat_fs, File_linux, and File_flash_avr32.
virtual bool File::seek | ( | int32_t | offset, |
file_seekfrom_t | origin | ||
) | [pure virtual] |
Seek to a given offset within the file.
Valid locations to seek to are from zero to the file length. Seeking to the file length moves the pointer to one past the end of the file data so that subsequent file writes append to the existing file.
offset | The distance to move from the origin parameter. |
origin | One of the file_seekfrom_t enumeration. |
Implemented in File_fat_fs, File_linux, and File_flash_avr32.
virtual bool File::write | ( | const uint8_t * | data, |
uint32_t | size | ||
) | [pure virtual] |
Write to the file.
data | The buffer to write. |
size | The number of bytes to write. |
Implemented in File_fat_fs, File_linux, and File_flash_avr32.