8 #ifndef BOOST_GIL_IO_MAKE_READER_HPP
9 #define BOOST_GIL_IO_MAKE_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,
typename ConversionPolicy>
21 String
const&file_name,
22 image_read_settings<FormatTag>
const& settings,
23 ConversionPolicy
const&,
24 typename std::enable_if
28 detail::is_supported_path_spec<String>,
29 is_format_tag<FormatTag>
32 ->
typename get_reader<String, FormatTag, ConversionPolicy>::type
34 typename get_read_device<String, FormatTag>::type device(
35 detail::convert_to_native_string(file_name),
36 typename detail::file_stream_device<FormatTag>::read_tag());
39 typename get_reader<String, FormatTag, ConversionPolicy>::type(device, settings);
42 template <
typename FormatTag,
typename ConversionPolicy>
44 auto make_reader(std::wstring
const &file_name, image_read_settings<FormatTag>
const& settings, ConversionPolicy
const&)
45 ->
typename get_reader<std::wstring, FormatTag, ConversionPolicy>::type
47 const char* str = detail::convert_to_native_string( file_name );
49 typename get_read_device< std::wstring
52 ,
typename detail::file_stream_device< FormatTag >::read_tag()
57 return typename get_reader< std::wstring
65 template <
typename FormatTag,
typename ConversionPolicy>
67 auto make_reader(detail::filesystem::path
const& path, image_read_settings<FormatTag>
const& settings, ConversionPolicy
const& cc)
68 ->
typename get_reader<std::wstring, FormatTag, ConversionPolicy>::type
70 return make_reader(path.wstring(), settings, cc);
73 template <
typename Device,
typename FormatTag,
typename ConversionPolicy>
77 image_read_settings<FormatTag>
const& settings,
78 ConversionPolicy
const&,
79 typename std::enable_if
83 detail::is_adaptable_input_device<FormatTag, Device>,
84 is_format_tag<FormatTag>
87 ->
typename get_reader<Device, FormatTag, ConversionPolicy>::type
89 typename get_read_device<Device, FormatTag>::type device(file);
92 typename get_reader<Device, FormatTag, ConversionPolicy>::type(device, settings);
97 template <
typename String,
typename FormatTag,
typename ConversionPolicy>
100 String
const&file_name,
102 ConversionPolicy
const& cc,
103 typename std::enable_if
107 detail::is_supported_path_spec<String>,
108 is_format_tag<FormatTag>
111 ->
typename get_reader<String, FormatTag, ConversionPolicy>::type
113 return make_reader(file_name, image_read_settings<FormatTag>(), cc);
116 template <
typename FormatTag,
typename ConversionPolicy>
118 auto make_reader(std::wstring
const &file_name, FormatTag
const&, ConversionPolicy
const& cc)
119 ->
typename get_reader<std::wstring, FormatTag, ConversionPolicy>::type
121 return make_reader( file_name
122 , image_read_settings< FormatTag >()
127 template <
typename FormatTag,
typename ConversionPolicy>
129 auto make_reader(detail::filesystem::path
const& path, FormatTag
const&, ConversionPolicy
const& cc)
130 ->
typename get_reader<std::wstring, FormatTag, ConversionPolicy>::type
132 return make_reader(path.wstring(), image_read_settings<FormatTag>(), cc);
135 template <
typename Device,
typename FormatTag,
typename ConversionPolicy>
140 ConversionPolicy
const& cc,
141 typename std::enable_if
145 detail::is_adaptable_input_device<FormatTag, Device>,
146 is_format_tag<FormatTag>
149 ->
typename get_reader<Device, FormatTag, ConversionPolicy>::type
151 return make_reader(file, image_read_settings<FormatTag>(), cc);
defined(BOOST_NO_CXX17_HDR_MEMORY_RESOURCE)
Definition: algorithm.hpp:36