diff options
author | 2021-08-22 09:06:15 +1000 | |
---|---|---|
committer | 2021-08-22 09:06:15 +1000 | |
commit | e8bbea1fc6e94e14768509d322f6c624403ffb36 (patch) | |
tree | 74dd1606a900d83de8aecff17a6737af4113308d /src/emu/devdelegate.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/devdelegate.h')
-rw-r--r-- | src/emu/devdelegate.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/emu/devdelegate.h b/src/emu/devdelegate.h index 1ba303d3ef3..906e1da9274 100644 --- a/src/emu/devdelegate.h +++ b/src/emu/devdelegate.h @@ -111,12 +111,12 @@ class device_delegate<ReturnType (Params...)> : protected named_delegate<ReturnT private: using basetype = named_delegate<ReturnType (Params...)>; - template <class T, class U> struct is_related_device_implementation - { static constexpr bool value = std::is_base_of<T, U>::value && std::is_base_of<device_t, U>::value; }; - template <class T, class U> struct is_related_device_interface - { static constexpr bool value = std::is_base_of<T, U>::value && std::is_base_of<device_interface, U>::value && !std::is_base_of<device_t, U>::value; }; - template <class T, class U> struct is_related_device - { static constexpr bool value = is_related_device_implementation<T, U>::value || is_related_device_interface<T, U>::value; }; + template <class T, class U> + using is_related_device_implementation = std::bool_constant<std::is_base_of_v<T, U> && std::is_base_of_v<device_t, U> >; + template <class T, class U> + using is_related_device_interface = std::bool_constant<std::is_base_of_v<T, U> && std::is_base_of_v<device_interface, U> && !std::is_base_of_v<device_t, U> >; + template <class T, class U> + using is_related_device = std::bool_constant<is_related_device_implementation<T, U>::value || is_related_device_interface<T, U>::value>; template <class T> static std::enable_if_t<is_related_device_implementation<T, T>::value, device_t &> get_device(T &object) { return object; } template <class T> static std::enable_if_t<is_related_device_interface<T, T>::value, device_t &> get_device(T &object) { return object.device(); } @@ -124,8 +124,8 @@ private: public: template <unsigned Count> using array = device_delegate_array<ReturnType (Params...), Count>; - template <typename T> struct supports_callback - { static constexpr bool value = std::is_constructible<device_delegate, device_t &, char const *, T, char const *>::value; }; + template <typename T> + using supports_callback = std::bool_constant<std::is_constructible_v<device_delegate, device_t &, char const *, T, char const *> >; // construct/assign explicit device_delegate(device_t &owner) : basetype(), detail::device_delegate_helper(owner) { } |