PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
|
A read-only file interface. More...
#include <PropWare/filesystem/filereader.h>
Public Types | |
enum | ErrorCode { NO_ERROR = 0, BEG_ERROR = Filesystem::BEG_ERROR + 1, EOF_ERROR, INVALID_FILENAME, FILE_NOT_OPEN, END_ERROR = FILE_NOT_OPEN } |
enum | SeekDir { SeekDir::BEG, SeekDir::CUR, SeekDir::END } |
Public Member Functions | |
PropWare::ErrorCode | flush () |
Flush any modified data back to the SD card. More... | |
virtual PropWare::ErrorCode | safe_get_char (char &c)=0 |
Read a character from the file. More... | |
char | get_char () |
Read a character from the file. More... | |
bool | eof () const |
Determine whether the read pointer has reached the end of the file. More... | |
PropWare::ErrorCode | safe_peek (char &c) |
Read a character from the file without incrementing the pointer. More... | |
char | peek () |
Read a character from the file without incrementing the pointer. More... | |
PropWare::ErrorCode | get_error () const |
Get the latest error that occurred during an unsafe method call. More... | |
virtual PropWare::ErrorCode | open ()=0 |
Open the file. More... | |
virtual PropWare::ErrorCode | close () |
Close a file - a required step in any workflow that includes opening a file. More... | |
int32_t | get_length () const |
Return the number of bytes (characters) in the file. | |
int32_t | tell () const |
Obtain the value of the file position indicator. More... | |
PropWare::ErrorCode | seek (const int32_t offset, const SeekDir way) |
Sets the position of the next character to be read or written. More... | |
PropWare::ErrorCode | seek (const int32_t position) |
Static Public Attributes | |
static const unsigned int | MAX_FILENAME_LENGTH = 32 |
A read-only file interface.
Definition at line 36 of file filereader.h.
|
inherited |
|
stronginherited |
|
virtualinherited |
bool PropWare::FileReader::eof | ( | ) | const |
Determine whether the read pointer has reached the end of the file.
Definition at line 75 of file filereader.h.
|
virtual |
Flush any modified data back to the SD card.
Implements PropWare::File.
Definition at line 40 of file filereader.h.
|
virtual |
Read a character from the file.
FileReader::get_error()
Implements PropWare::ScanCapable.
Definition at line 60 of file filereader.h.
PropWare::ErrorCode PropWare::FileReader::get_error | ( | ) | const |
Get the latest error that occurred during an unsafe method call.
Methods such as FileReader::get_char()
would normally throw an exception if an error occurred in a C++ program, but due to size constraints, exceptions are not used by PropWare. Therefore, any error that is occurs in a function that does not return ErrorCode
simply saves the error to the internal state and returns a known value.
Definition at line 115 of file filereader.h.
|
pure virtualinherited |
Open the file.
Implemented in PropWare::FatFileReader, and PropWare::FatFileWriter.
char PropWare::FileReader::peek | ( | ) |
Read a character from the file without incrementing the pointer.
FileReader::get_error()
Definition at line 99 of file filereader.h.
|
pure virtual |
Read a character from the file.
[out] | c | Character from file will be stored into c |
Implemented in PropWare::FatFileReader.
PropWare::ErrorCode PropWare::FileReader::safe_peek | ( | char & | c | ) |
Read a character from the file without incrementing the pointer.
[out] | c | Character from file will be stored into c |
Definition at line 86 of file filereader.h.
|
inherited |
Sets the position of the next character to be read or written.
[in] | offset | Offset value, relative to the way parameter |
[in] | way | Starting position for the movement and direction of movement |
Definition at line 112 of file file.h.
|
inherited |
|
inherited |