9 #ifndef BOOST_GIL_IO_MAKE_BACKEND_HPP
10 #define BOOST_GIL_IO_MAKE_BACKEND_HPP
12 #include <boost/gil/detail/mp11.hpp>
13 #include <boost/gil/io/get_reader.hpp>
15 #include <type_traits>
17 namespace boost {
namespace gil {
19 template <
typename String,
typename FormatTag>
21 auto make_reader_backend(
22 String
const& file_name, image_read_settings<FormatTag>
const& settings,
23 typename std::enable_if
27 detail::is_supported_path_spec<String>,
28 is_format_tag<FormatTag>
31 ->
typename get_reader_backend<String, FormatTag>::type
33 using device_t =
typename get_read_device<String, FormatTag>::type;
36 detail::convert_to_native_string(file_name),
37 typename detail::file_stream_device<FormatTag>::read_tag());
39 return reader_backend<device_t, FormatTag>(device, settings);
42 template <
typename FormatTag>
44 auto make_reader_backend(
45 std::wstring
const& file_name, image_read_settings<FormatTag>
const& settings)
46 ->
typename get_reader_backend<std::wstring, FormatTag>::type
48 char const* str = detail::convert_to_native_string(file_name);
50 using device_t =
typename get_read_device<std::wstring, FormatTag>::type;
51 device_t device(str,
typename detail::file_stream_device<FormatTag>::read_tag());
55 return reader_backend<device_t, FormatTag>(device, settings);
58 template <
typename FormatTag>
60 auto make_reader_backend(
61 detail::filesystem::path
const& path,
62 image_read_settings<FormatTag>
const& settings)
63 ->
typename get_reader_backend<std::wstring, FormatTag>::type
65 return make_reader_backend(path.wstring(), settings);
68 template <
typename Device,
typename FormatTag>
70 auto make_reader_backend(Device& io_dev, image_read_settings<FormatTag>
const& settings,
71 typename std::enable_if
75 detail::is_adaptable_input_device<FormatTag, Device>,
76 is_format_tag<FormatTag>
79 ->
typename get_reader_backend<Device, FormatTag>::type
81 using device_t =
typename get_read_device<Device, FormatTag>::type;
82 device_t device(io_dev);
84 return reader_backend<device_t, FormatTag>(device, settings);
87 template <
typename String,
typename FormatTag>
89 auto make_reader_backend(String
const& file_name, FormatTag
const&,
90 typename std::enable_if
94 detail::is_supported_path_spec<String>,
95 is_format_tag<FormatTag>
98 ->
typename get_reader_backend<String, FormatTag>::type
100 return make_reader_backend(file_name, image_read_settings<FormatTag>());
103 template <
typename Device,
typename FormatTag>
105 auto make_reader_backend(Device& io_dev, FormatTag
const&,
106 typename std::enable_if
110 detail::is_adaptable_input_device<FormatTag, Device>,
111 is_format_tag<FormatTag>
114 ->
typename get_reader_backend<Device, FormatTag>::type
116 return make_reader_backend(io_dev, image_read_settings<FormatTag>());
defined(BOOST_NO_CXX17_HDR_MEMORY_RESOURCE)
Definition: algorithm.hpp:36