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
43 ,
typename ConversionPolicy
46 typename get_reader< std::wstring
50 make_reader(
const std::wstring& file_name
51 ,
const image_read_settings< FormatTag >& settings
52 ,
const ConversionPolicy&
55 const char* str = detail::convert_to_native_string( file_name );
57 typename get_read_device< std::wstring
60 ,
typename detail::file_stream_device< FormatTag >::read_tag()
65 return typename get_reader< std::wstring
73 #ifdef BOOST_GIL_IO_ADD_FS_PATH_SUPPORT 74 template<
typename FormatTag
75 ,
typename ConversionPolicy
78 typename get_reader< std::wstring
82 make_reader(
const filesystem::path& path
83 ,
const image_read_settings< FormatTag >& settings
84 ,
const ConversionPolicy& cc
87 return make_reader( path.wstring()
92 #endif // BOOST_GIL_IO_ADD_FS_PATH_SUPPORT 94 template <
typename Device,
typename FormatTag,
typename ConversionPolicy>
98 image_read_settings<FormatTag>
const& settings,
99 ConversionPolicy
const&,
100 typename std::enable_if
104 detail::is_adaptable_input_device<FormatTag, Device>,
105 is_format_tag<FormatTag>
108 ->
typename get_reader<Device, FormatTag, ConversionPolicy>::type
110 typename get_read_device<Device, FormatTag>::type device(file);
113 typename get_reader<Device, FormatTag, ConversionPolicy>::type(device, settings);
118 template <
typename String,
typename FormatTag,
typename ConversionPolicy>
121 String
const&file_name,
123 ConversionPolicy
const& cc,
124 typename std::enable_if
128 detail::is_supported_path_spec<String>,
129 is_format_tag<FormatTag>
132 ->
typename get_reader<String, FormatTag, ConversionPolicy>::type
134 return make_reader(file_name, image_read_settings<FormatTag>(), cc);
137 template<
typename FormatTag
138 ,
typename ConversionPolicy
141 typename get_reader< std::wstring
145 make_reader(
const std::wstring& file_name
147 ,
const ConversionPolicy& cc
150 return make_reader( file_name
151 , image_read_settings< FormatTag >()
156 #ifdef BOOST_GIL_IO_ADD_FS_PATH_SUPPORT 157 template<
typename FormatTag
158 ,
typename ConversionPolicy
161 typename get_reader< std::wstring
165 make_reader(
const filesystem::path& path
167 ,
const ConversionPolicy& cc
170 return make_reader( path.wstring()
171 , image_read_settings< FormatTag >()
175 #endif // BOOST_GIL_IO_ADD_FS_PATH_SUPPORT 177 template <
typename Device,
typename FormatTag,
typename ConversionPolicy>
182 ConversionPolicy
const& cc,
183 typename std::enable_if
187 detail::is_adaptable_input_device<FormatTag, Device>,
188 is_format_tag<FormatTag>
191 ->
typename get_reader<Device, FormatTag, ConversionPolicy>::type
193 return make_reader(file, image_read_settings<FormatTag>(), cc);