12 #ifndef INCLUDE_DISTORTOS_FILESYSTEM_FILE_HPP_ 13 #define INCLUDE_DISTORTOS_FILESYSTEM_FILE_HPP_ 49 virtual ~File() =
default;
65 virtual int close() = 0;
87 virtual std::pair<int, off_t>
getSize() = 0;
101 virtual int getStatus(
struct stat& status) = 0;
131 virtual void lock() = 0;
148 virtual std::pair<int, size_t>
read(
void* buffer,
size_t size) = 0;
178 virtual std::pair<int, off_t>
seek(
Whence whence, off_t offset) = 0;
202 virtual void unlock() = 0;
220 virtual std::pair<int, size_t>
write(
const void* buffer,
size_t size) = 0;
224 File& operator=(
const File&) =
delete;
229 #endif // INCLUDE_DISTORTOS_FILESYSTEM_FILE_HPP_ virtual int getStatus(struct stat &status)=0
Returns status of file.
virtual std::pair< int, off_t > seek(Whence whence, off_t offset)=0
Moves file offset.
Whence
seek() mode of operation
Definition: File.hpp:33
virtual int rewind()=0
Resets current file offset.
virtual void lock()=0
Locks the file for exclusive use by current thread.
set file offset to provided argument, similar to SEEK_SET
virtual std::pair< int, off_t > getSize()=0
Returns size of file.
virtual std::pair< int, size_t > read(void *buffer, size_t size)=0
Reads data from file.
virtual int synchronize()=0
Synchronizes state of a file, ensuring all cached writes are finished.
virtual std::pair< int, size_t > write(const void *buffer, size_t size)=0
Writes data to file.
set file offset to the size of the file plus provided argument, similar to SEEK_END
Top-level namespace of distortos project.
Definition: buttons.hpp:33
virtual ~File()=default
File's destructor.
virtual void unlock()=0
Unlocks the file which was previously locked by current thread.
set file offset to its current value plus provided argument, similar to SEEK_CUR
virtual int close()=0
Closes file.
virtual std::pair< int, off_t > getPosition()=0
Returns current file offset.
virtual std::pair< int, bool > isATerminal()=0
Tells whether the file is a terminal.