diff options
author | Vas Crabb <cuavas@users.noreply.github.com> | 2021-08-22 09:06:15 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-22 09:06:15 +1000 |
commit | e8bbea1fc6e94e14768509d322f6c624403ffb36 (patch) | |
tree | 74dd1606a900d83de8aecff17a6737af4113308d /src/emu/fileio.h | |
parent | e319bde5fc3696d7f48f62b15b6366c4377fe5d1 (diff) |
formats, osd, util: Started refactoring file I/O stuff. (#8456)
Added more modern generic I/O interfaces with implementation backed by stdio, osd_file and core_file, replacing io_generic. Also replaced core_file's build-in zlib compression with a filter.
unzip.cpp, un7z.cpp: Added option to supply abstract I/O interface rather than filename.
Converted osd_file, core_file, archive_file, chd_file and device_image_interface to use std::error_condition rather than their own error enums.
Allow mounting TI-99 RPK from inside archives.
Diffstat (limited to 'src/emu/fileio.h')
-rw-r--r-- | src/emu/fileio.h | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/src/emu/fileio.h b/src/emu/fileio.h index d05905efa83..f05706dffed 100644 --- a/src/emu/fileio.h +++ b/src/emu/fileio.h @@ -18,6 +18,7 @@ #include <iterator> #include <string> +#include <system_error> #include <type_traits> #include <utility> #include <vector> @@ -156,19 +157,16 @@ public: void set_restrict_to_mediapath(int rtmp) { m_restrict_to_mediapath = rtmp; } // open/close - osd_file::error open(std::string &&name); - osd_file::error open(std::string &&name, u32 crc); - osd_file::error open(std::string_view name) { return open(std::string(name)); } - osd_file::error open(std::string_view name, u32 crc) { return open(std::string(name), crc); } - osd_file::error open(const char *name) { return open(std::string(name)); } - osd_file::error open(const char *name, u32 crc) { return open(std::string(name), crc); } - osd_file::error open_next(); - osd_file::error open_ram(const void *data, u32 length); + std::error_condition open(std::string &&name); + std::error_condition open(std::string &&name, u32 crc); + std::error_condition open(std::string_view name) { return open(std::string(name)); } + std::error_condition open(std::string_view name, u32 crc) { return open(std::string(name), crc); } + std::error_condition open(const char *name) { return open(std::string(name)); } + std::error_condition open(const char *name, u32 crc) { return open(std::string(name), crc); } + std::error_condition open_next(); + std::error_condition open_ram(const void *data, u32 length); void close(); - // control - osd_file::error compress(int compress); - // position int seek(s64 offset, int whence); u64 tell(); @@ -213,11 +211,11 @@ private: } bool part_of_mediapath(const std::string &path); - bool compressed_file_ready(); + std::error_condition compressed_file_ready(); // internal helpers - osd_file::error attempt_zipped(); - osd_file::error load_zipped_file(); + std::error_condition attempt_zipped(); + std::error_condition load_zipped_file(); // internal state std::string m_filename; // original filename provided |