From e8bbea1fc6e94e14768509d322f6c624403ffb36 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Sun, 22 Aug 2021 09:06:15 +1000 Subject: 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. --- src/lib/util/strformat.h | 54 ++++++++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 27 deletions(-) (limited to 'src/lib/util/strformat.h') diff --git a/src/lib/util/strformat.h b/src/lib/util/strformat.h index b8c9b4f1a99..a3ba1d11261 100644 --- a/src/lib/util/strformat.h +++ b/src/lib/util/strformat.h @@ -578,16 +578,16 @@ template class format_output { private: - template struct string_semantics - { static constexpr bool value = false; }; - template struct string_semantics > - { static constexpr bool value = true; }; - template struct string_semantics > - { static constexpr bool value = true; }; - template struct signed_integer_semantics - { static constexpr bool value = std::is_integral_v&& std::is_signed_v; }; - template struct unsigned_integer_semantics - { static constexpr bool value = std::is_integral_v&& !std::is_signed_v; }; + template + struct string_semantics : public std::false_type { }; + template + struct string_semantics > : public std::true_type { }; + template + struct string_semantics > : public std::true_type { }; + template + using signed_integer_semantics = std::bool_constant && std::is_signed_v >; + template + using unsigned_integer_semantics = std::bool_constant && !std::is_signed_v >; static void apply_signed(Stream &str, char16_t const &value) { @@ -865,8 +865,8 @@ template class format_output { protected: - template struct string_semantics - { static constexpr bool value = std::is_same, typename Stream::char_type>::value; }; + template + using string_semantics = std::bool_constant, typename Stream::char_type> >; public: template @@ -940,10 +940,10 @@ template class format_make_integer { private: - template struct use_unsigned_cast - { static constexpr bool value = std::is_convertible::value && std::is_unsigned::value; }; - template struct use_signed_cast - { static constexpr bool value = !use_unsigned_cast::value && std::is_convertible::value; }; + template + using use_unsigned_cast = std::bool_constant && std::is_unsigned_v >; + template + using use_signed_cast = std::bool_constant::value && std::is_convertible_v >; public: template static bool apply(U const &value, int &result) @@ -974,14 +974,14 @@ template class format_store_integer { private: - template struct is_non_const_ptr - { static constexpr bool value = std::is_pointer::value && !std::is_const >::value; }; - template struct is_unsigned_ptr - { static constexpr bool value = std::is_pointer::value && std::is_unsigned >::value; }; - template struct use_unsigned_cast - { static constexpr bool value = is_non_const_ptr::value && is_unsigned_ptr::value && std::is_convertible, std::remove_pointer_t >::value; }; - template struct use_signed_cast - { static constexpr bool value = is_non_const_ptr::value && !use_unsigned_cast::value && std::is_convertible >::value; }; + template + using is_non_const_ptr = std::bool_constant && !std::is_const_v > >; + template + using is_unsigned_ptr = std::bool_constant && std::is_unsigned_v > >; + template + using use_unsigned_cast = std::bool_constant::value && is_unsigned_ptr::value && std::is_convertible_v, std::remove_pointer_t > >; + template + using use_signed_cast = std::bool_constant::value && !use_unsigned_cast::value && std::is_convertible_v > >; public: template static bool apply(U const &value, std::streamoff data) @@ -1091,11 +1091,11 @@ public: protected: template - struct handle_char_ptr { static constexpr bool value = std::is_pointer::value && std::is_same >, char_type>::value; }; + using handle_char_ptr = std::bool_constant && std::is_same_v >, char_type> >; template - struct handle_char_array { static constexpr bool value = std::is_array::value && std::is_same >, char_type>::value; }; + using handle_char_array = std::bool_constant && std::is_same_v >, char_type> >; template - struct handle_container { static constexpr bool value = !handle_char_ptr::value && !handle_char_array::value; }; + using handle_container = std::bool_constant::value && !handle_char_array::value>; template format_argument_pack( -- cgit v1.2.3-70-g09d2