8 #ifndef BOOST_GIL_IO_MAKE_DYNAMIC_IMAGE_READER_HPP
9 #define BOOST_GIL_IO_MAKE_DYNAMIC_IMAGE_READER_HPP
11 #include <boost/gil/detail/mp11.hpp>
12 #include <boost/gil/io/get_reader.hpp>
14 #include <type_traits>
16 namespace boost {
namespace gil {
18 template <
typename String,
typename FormatTag>
20 auto make_dynamic_image_reader(
21 String
const& file_name, image_read_settings<FormatTag>
const& settings,
22 typename std::enable_if
26 detail::is_supported_path_spec<String>,
27 is_format_tag<FormatTag>
30 ->
typename get_dynamic_image_reader<String, FormatTag>::type
32 using device_t =
typename get_read_device<String, FormatTag>::type;
34 detail::convert_to_native_string(file_name),
35 typename detail::file_stream_device<FormatTag>::read_tag());
37 return typename get_dynamic_image_reader<String, FormatTag>::type(device, settings);
40 template <
typename FormatTag>
42 auto make_dynamic_image_reader(
43 std::wstring
const& file_name, image_read_settings<FormatTag>
const& settings)
44 ->
typename get_dynamic_image_reader<std::wstring, FormatTag>::type
46 char const* str = detail::convert_to_native_string(file_name);
48 using device_t =
typename get_read_device<std::wstring, FormatTag>::type;
49 device_t device(str,
typename detail::file_stream_device<FormatTag>::read_tag());
54 typename get_dynamic_image_reader<std::wstring, FormatTag>::type(device, settings);
57 template <
typename FormatTag>
59 auto make_dynamic_image_reader(
60 detail::filesystem::path
const& path, image_read_settings<FormatTag>
const& settings)
61 ->
typename get_dynamic_image_reader<std::wstring, FormatTag>::type
63 return make_dynamic_image_reader(path.wstring(), settings);
66 template <
typename Device,
typename FormatTag>
68 auto make_dynamic_image_reader(
69 Device& file, image_read_settings<FormatTag>
const& settings,
70 typename std::enable_if
74 detail::is_adaptable_input_device<FormatTag, Device>,
75 is_format_tag<FormatTag>
78 ->
typename get_dynamic_image_reader<Device, FormatTag>::type
80 typename get_read_device<Device, FormatTag>::type device(file);
81 return typename get_dynamic_image_reader<Device, FormatTag>::type(device, settings);
86 template <
typename String,
typename FormatTag>
88 auto make_dynamic_image_reader(String
const& file_name, FormatTag
const&,
89 typename std::enable_if
93 detail::is_supported_path_spec<String>,
94 is_format_tag<FormatTag>
97 ->
typename get_dynamic_image_reader<String, FormatTag>::type
99 return make_dynamic_image_reader(file_name, image_read_settings<FormatTag>());
102 template <
typename FormatTag>
104 auto make_dynamic_image_reader(std::wstring
const& file_name, FormatTag
const&)
105 ->
typename get_dynamic_image_reader<std::wstring, FormatTag>::type
107 return make_dynamic_image_reader(file_name, image_read_settings<FormatTag>());
110 template <
typename FormatTag>
112 auto make_dynamic_image_reader(detail::filesystem::path
const& path, FormatTag
const&)
113 ->
typename get_dynamic_image_reader<std::wstring, FormatTag>::type
115 return make_dynamic_image_reader(path.wstring(), image_read_settings<FormatTag>());
118 template <
typename Device,
typename FormatTag>
120 auto make_dynamic_image_reader(Device& file, FormatTag
const&,
121 typename std::enable_if
125 detail::is_adaptable_input_device<FormatTag, Device>,
126 is_format_tag<FormatTag>
129 ->
typename get_dynamic_image_reader<Device, FormatTag>::type
131 return make_dynamic_image_reader(file, image_read_settings<FormatTag>());
defined(BOOST_NO_CXX17_HDR_MEMORY_RESOURCE)
Definition: algorithm.hpp:36