#ifndef FILE_H #define FILE_H #include #include #include "Span.h" class File { public: File() : m_fd(-1) {} ~File() { close(); } bool open(const char * filename, bool writing = false); void close(); size_t get_size(); bool read(uint8_t * buf, size_t size); bool write(const uint8_t * buf, size_t size); bool write(const Span & span) { return write(span.start, span.length); } protected: int m_fd; }; #endif