mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2026-09-11 00:59:28 +00:00
Improve File error handling. Massive effects...
API is somewhat stolen from Rust std::fs::File. Static factories didn't work out so well, though. Move semantics made my head explode. TODO: Still a lot of places where errors aren't handled, but it's an improvement...
This commit is contained in:
@@ -31,16 +31,16 @@ using namespace lpc43xx;
|
||||
|
||||
class LogFile {
|
||||
public:
|
||||
LogFile(const std::string& file_path);
|
||||
Optional<File::Error> append(const std::string& filename) {
|
||||
return file.append(filename);
|
||||
}
|
||||
|
||||
bool is_open() const;
|
||||
|
||||
bool write_entry(const rtc::RTC& datetime, const std::string& entry);
|
||||
File::Result<size_t> write_entry(const rtc::RTC& datetime, const std::string& entry);
|
||||
|
||||
private:
|
||||
File file;
|
||||
|
||||
bool write(const std::string& message);
|
||||
File::Result<size_t> write(const std::string& message);
|
||||
};
|
||||
|
||||
#endif/*__LOG_FILE_H__*/
|
||||
|
||||
Reference in New Issue
Block a user